aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpeg.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-03-02 12:26:07 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-03-02 12:26:07 +0000
commit9a63497b0f27a5c302a63103e88c239c02d430bb (patch)
tree4d39c4e7c7446426327d847a2bc0a4e0f369b8ce /libavcodec/mjpeg.c
parent014a51028250b9e3c6674284a44bda4c9ba07ee0 (diff)
downloadffmpeg-9a63497b0f27a5c302a63103e88c239c02d430bb.tar.gz
support for mjpeg bottom field first in mov
Originally committed as revision 8192 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpeg.c')
-rw-r--r--libavcodec/mjpeg.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index 956f809922..ed6016f939 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -965,6 +965,13 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
mjpeg_decode_dht(s);
/* 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;
}
@@ -1185,8 +1192,9 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->org_height != 0 &&
s->height < ((s->org_height * 3) / 4)) {
s->interlaced = 1;
-// s->bottom_field = (s->interlace_polarity) ? 1 : 0;
- s->bottom_field = 0;
+ s->bottom_field = s->interlace_polarity;
+ s->picture.interlaced_frame = 1;
+ s->picture.top_field_first = !s->interlace_polarity;
height *= 2;
}
@@ -1197,7 +1205,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->first_picture = 0;
}
- if(s->interlaced && s->bottom_field)
+ if(s->interlaced && (s->bottom_field == !s->interlace_polarity))
return 0;
/* XXX: not complete test ! */
@@ -2167,7 +2175,7 @@ eoi_parser:
if (s->interlaced) {
s->bottom_field ^= 1;
/* if not bottom field, do not output image yet */
- if (s->bottom_field)
+ if (s->bottom_field == !s->interlace_polarity)
goto not_the_end;
}
*picture = s->picture;