diff mov.c @ 4790:0493d65debd7 libavformat

set wrong_dts for iMovie created files which has huge ctts delay, fix ffmpeg_sample.m4v
author bcoudurier
date Wed, 25 Mar 2009 06:07:13 +0000
parents d5ae967cc549
children c3f239ee623f
line wrap: on
line diff
--- a/mov.c	Tue Mar 24 03:24:59 2009 +0000
+++ b/mov.c	Wed Mar 25 06:07:13 2009 +0000
@@ -1281,6 +1281,12 @@
         int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset;
         assert(sc->time_offset % sc->time_rate == 0);
         current_dts = - (rescaled / sc->time_rate);
+        if (sc->ctts_data && sc->ctts_data[0].duration / sc->stts_data[0].duration > 16) {
+            /* more than 16 frames delay, dts are likely wrong
+               this happens with files created by iMovie */
+            sc->wrong_dts = 1;
+            st->codec->has_b_frames = 1;
+        }
     }
 
     /* only use old uncompressed audio chunk demuxing when stts specifies it */