aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-12-12 15:09:10 +0100
committerAnton Khirnov <anton@khirnov.net>2021-02-25 11:46:28 +0100
commit9e4225cf7f26b57e0054470127bcc032b6d29742 (patch)
treec13c00b8ca9669abd8a8d1d194e546c72184c990 /libavformat/avidec.c
parentae4f6379d6b52e480e4ad335e0a71292effdf839 (diff)
downloadffmpeg-9e4225cf7f26b57e0054470127bcc032b6d29742.tar.gz
Handle AVID MJPEG streams directly in the MJPEG decoder.
AVID streams - currently handled by the AVRN decoder - can be (depending on extradata contents) either MJPEG or raw video. To decode the MJPEG variant, the AVRN decoder currently instantiates a MJPEG decoder internally and forwards decoded frames to the caller (possibly after cropping them). This is suboptimal, because the AVRN decoder does not forward all the features of the internal MJPEG decoder, such as direct rendering. Handling such forwarding in a full and generic manner would be quite hard, so it is simpler to just handle those streams in the MJPEG decoder directly. The AVRN decoder, which now handles only the raw streams, can now be marked as supporting direct rendering. This also removes the last remaining internal use of the obsolete decoding API.
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 547eb63b1b..5ea6160eef 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -838,6 +838,12 @@ static int avi_read_header(AVFormatContext *s)
st->codecpar->codec_tag == MKTAG('H', '2', '6', '5'))
st->need_parsing = AVSTREAM_PARSE_FULL;
+ if (st->codecpar->codec_id == AV_CODEC_ID_AVRN &&
+ st->codecpar->codec_tag == MKTAG('A', 'V', 'R', 'n') &&
+ (st->codecpar->extradata_size < 31 ||
+ memcmp(&st->codecpar->extradata[28], "1:1", 3)))
+ st->codecpar->codec_id = AV_CODEC_ID_MJPEG;
+
if (st->codecpar->codec_tag == 0 && st->codecpar->height > 0 &&
st->codecpar->extradata_size < 1U << 30) {
st->codecpar->extradata_size += 9;