diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-01-13 09:01:29 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-01-13 09:01:29 +0100 |
commit | d3fe2e0dc991720bab723e6bc467976e0b14709a (patch) | |
tree | 17fde2dff40adf7d2a38f0f5c28ec8d8da9036b0 /libavcodec/mjpeg2jpeg_bsf.c | |
parent | 9ca64c31d2f435646fead0cc89207e4c63759ac5 (diff) | |
download | ffmpeg-d3fe2e0dc991720bab723e6bc467976e0b14709a.tar.gz |
lavc/mjpeg2jpeg: Accept more mjpeg streams as input.
Fixes ticket #5151.
Diffstat (limited to 'libavcodec/mjpeg2jpeg_bsf.c')
-rw-r--r-- | libavcodec/mjpeg2jpeg_bsf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index 71f015491a..92dc3ca230 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -32,6 +32,7 @@ #include "avcodec.h" #include "jpegtables.h" +#include "mjpeg.h" static const uint8_t jpeg_header[] = { 0xff, 0xd8, // SOI @@ -93,11 +94,11 @@ static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc, av_log(avctx, AV_LOG_ERROR, "input is not MJPEG\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; |