changeset 4615:f4a14f5afd8a libavcodec

support for mjpeg bottom field first in mov
author bcoudurier
date Fri, 02 Mar 2007 12:26:07 +0000
parents 3c6c557aa977
children 8036b117ae26
files mjpeg.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mjpeg.c	Fri Mar 02 10:08:05 2007 +0000
+++ b/mjpeg.c	Fri Mar 02 12:26:07 2007 +0000
@@ -965,6 +965,13 @@
         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 @@
             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 @@
         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 @@
                         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;