Hi! I guess that attached patch fixes ticket #5151. It is the user's responsibility to know if the input stream is suitable for the bitstream filter or not.
Please comment, Carl Eugen
diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index 68640db..b29039e 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -31,6 +31,7 @@ #include "avcodec.h" #include "jpegtables.h" +#include "mjpeg.h" static const uint8_t jpeg_header[] = { 0xff, 0xd8, // SOI @@ -88,11 +89,11 @@ static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc, av_log(avctx, AV_LOG_ERROR, "input is truncated\n"); return AVERROR_INVALIDDATA; } - if (memcmp("AVI1", buf + 6, 4)) { - av_log(avctx, AV_LOG_ERROR, "input is not MJPEG/AVI1\n"); - return AVERROR_INVALIDDATA; + if (buf[2] == 0xff && buf[3] == APP0) { + input_skip = (buf[4] << 8) + buf[5] + 4; + } else { + input_skip = 2; } - input_skip = (buf[4] << 8) + buf[5] + 4; if (buf_size < input_skip) { av_log(avctx, AV_LOG_ERROR, "input is truncated\n"); return AVERROR_INVALIDDATA;
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel