[FFmpeg-devel] [PATCH]lavc/mjpeg2jpeg: Accept more mjpeg streams as input
Carl Eugen Hoyos
cehoyos at ag.or.at
Tue Jan 12 09:58:53 CET 2016
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
-------------- next part --------------
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;
More information about the ffmpeg-devel
mailing list