[FFmpeg-cvslog] r18019 - trunk/libavformat/mov.c

reimar subversion
Mon Mar 16 21:49:53 CET 2009


Author: reimar
Date: Mon Mar 16 21:49:52 2009
New Revision: 18019

Log:
Extend mov edit list support to work for a first padding entry with
time == -1 and duration. Complicated since time is relative to stream,
duration relative to container time base.

Modified:
   trunk/libavformat/mov.c

Modified: trunk/libavformat/mov.c
==============================================================================
--- trunk/libavformat/mov.c	Mon Mar 16 21:22:39 2009	(r18018)
+++ trunk/libavformat/mov.c	Mon Mar 16 21:49:52 2009	(r18019)
@@ -1278,8 +1278,9 @@ static void mov_build_index(MOVContext *
 
     /* adjust first dts according to edit list */
     if (sc->time_offset) {
+        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 = - (sc->time_offset / sc->time_rate);
+        current_dts = - (rescaled / sc->time_rate);
     }
 
     /* only use old uncompressed audio chunk demuxing when stts specifies it */
@@ -1774,12 +1775,12 @@ static int mov_read_elst(MOVContext *c, 
 
     for(i=0; i<edit_count; i++){
         int time;
-        get_be32(pb); /* Track duration */
+        int duration = get_be32(pb); /* Track duration */
         time = get_be32(pb); /* Media time */
         get_be32(pb); /* Media rate */
-        if (i == 0 && time != -1) {
-            sc->time_offset = time;
-            sc->time_rate = av_gcd(sc->time_rate, time);
+        if (i == 0 && time >= -1) {
+            sc->time_offset = time != -1 ? time : -duration;
+            sc->time_rate = av_gcd(sc->time_rate, FFABS(sc->time_offset));
         }
     }
 




More information about the ffmpeg-cvslog mailing list