Commit 9a63497b authored by Baptiste Coudurier's avatar Baptiste Coudurier

support for mjpeg bottom field first in mov

Originally committed as revision 8192 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 014a5102
...@@ -965,6 +965,13 @@ static int mjpeg_decode_init(AVCodecContext *avctx) ...@@ -965,6 +965,13 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
mjpeg_decode_dht(s); mjpeg_decode_dht(s);
/* should check for error - but dunno */ /* should check for error - but dunno */
} }
if (avctx->extradata_size > 9 &&
AV_RL32(avctx->extradata + 4) == MKTAG('f','i','e','l')) {
if (avctx->extradata[9] == 6) { /* quicktime icefloe 019 */
s->interlace_polarity = 1; /* bottom field first */
av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n");
}
}
return 0; return 0;
} }
...@@ -1185,8 +1192,9 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -1185,8 +1192,9 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->org_height != 0 && s->org_height != 0 &&
s->height < ((s->org_height * 3) / 4)) { s->height < ((s->org_height * 3) / 4)) {
s->interlaced = 1; s->interlaced = 1;
// s->bottom_field = (s->interlace_polarity) ? 1 : 0; s->bottom_field = s->interlace_polarity;
s->bottom_field = 0; s->picture.interlaced_frame = 1;
s->picture.top_field_first = !s->interlace_polarity;
height *= 2; height *= 2;
} }
...@@ -1197,7 +1205,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -1197,7 +1205,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->first_picture = 0; s->first_picture = 0;
} }
if(s->interlaced && s->bottom_field) if(s->interlaced && (s->bottom_field == !s->interlace_polarity))
return 0; return 0;
/* XXX: not complete test ! */ /* XXX: not complete test ! */
...@@ -2167,7 +2175,7 @@ eoi_parser: ...@@ -2167,7 +2175,7 @@ eoi_parser:
if (s->interlaced) { if (s->interlaced) {
s->bottom_field ^= 1; s->bottom_field ^= 1;
/* if not bottom field, do not output image yet */ /* if not bottom field, do not output image yet */
if (s->bottom_field) if (s->bottom_field == !s->interlace_polarity)
goto not_the_end; goto not_the_end;
} }
*picture = s->picture; *picture = s->picture;
......
...@@ -1366,6 +1366,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { ...@@ -1366,6 +1366,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG( 'e', 'd', 't', 's' ), mov_read_default }, { MKTAG( 'e', 'd', 't', 's' ), mov_read_default },
{ MKTAG( 'e', 'l', 's', 't' ), mov_read_elst }, { MKTAG( 'e', 'l', 's', 't' ), mov_read_elst },
{ MKTAG( 'e', 'n', 'd', 'a' ), mov_read_enda }, { MKTAG( 'e', 'n', 'd', 'a' ), mov_read_enda },
{ MKTAG( 'f', 'i', 'e', 'l' ), mov_read_extradata },
{ MKTAG( 'f', 't', 'y', 'p' ), mov_read_ftyp }, { MKTAG( 'f', 't', 'y', 'p' ), mov_read_ftyp },
{ MKTAG( 'h', 'd', 'l', 'r' ), mov_read_hdlr }, { MKTAG( 'h', 'd', 'l', 'r' ), mov_read_hdlr },
{ MKTAG( 'j', 'p', '2', 'h' ), mov_read_extradata }, { MKTAG( 'j', 'p', '2', 'h' ), mov_read_extradata },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment