From 2f75dcdc1c89737d480d0bc303ee224cb6ccf6ec Mon Sep 17 00:00:00 2001 From: Piotr Bandurski Date: Sun, 19 May 2013 11:24:41 +0200 Subject: [PATCH] mjpegdec: Fix field orderforinterlacedAVDJand AVRN in ntsc mode Fixes ticket1656 Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 52168cce86..b933a712ea 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1501,8 +1501,10 @@ static int mjpeg_decode_com(MJpegDecodeContext *s) av_log(s->avctx, AV_LOG_INFO, "comment: '%s'\n", cbuf); /* buggy avid, it puts EOI only at every 10th frame */ - if (!strcmp(cbuf, "AVID")) { + if (len > 3 && (!strncmp(cbuf, "AVID", 4))) { s->buggy_avid = 1; + if (len > 14 && cbuf[12] == 1) /* 1 - NTSC, 2 - PAL */ + s->interlace_polarity = 1; } else if (!strcmp(cbuf, "CS=ITU601")) s->cs_itu601 = 1; else if ((len > 31 && !strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32)) ||