[FFmpeg-cvslog] r10285 - in trunk: libavformat/utils.c tests/libav.regression.ref

benoit subversion
Mon Sep 3 09:56:26 CEST 2007


Author: benoit
Date: Mon Sep  3 09:56:26 2007
New Revision: 10285

Log:
If a stream has no start time, but the first packet has a 'pts', use that
pts to set the start_time.
patch by Neil Brown: [neilb suse de]
original thread: [FFmpeg-devel] [patch 3/3] Make timing calculations less
dependant on start_time being defined.
date: 08/16/2007 08:27 AM


Modified:
   trunk/libavformat/utils.c
   trunk/tests/libav.regression.ref

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Mon Sep  3 09:56:26 2007
@@ -590,7 +590,9 @@ static int is_intra_only(AVCodecContext 
     return 0;
 }
 
-static void update_initial_timestamps(AVFormatContext *s, int stream_index, int64_t dts){
+static void update_initial_timestamps(AVFormatContext *s, int stream_index,
+                                      int64_t dts, int64_t pts)
+{
     AVStream *st= s->streams[stream_index];
     AVPacketList *pktl= s->packet_buffer;
 
@@ -613,6 +615,8 @@ static void update_initial_timestamps(AV
         if(st->start_time == AV_NOPTS_VALUE && pktl->pkt.pts != AV_NOPTS_VALUE)
             st->start_time= pktl->pkt.pts;
     }
+    if (st->start_time == AV_NOPTS_VALUE)
+        st->start_time = pts;
 }
 
 static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
@@ -670,7 +674,7 @@ static void compute_pkt_fields(AVFormatC
             /* PTS = presentation time stamp */
             if (pkt->dts == AV_NOPTS_VALUE)
                 pkt->dts = st->last_IP_pts;
-            update_initial_timestamps(s, pkt->stream_index, pkt->dts);
+            update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts);
             if (pkt->dts == AV_NOPTS_VALUE)
                 pkt->dts = st->cur_dts;
 
@@ -696,7 +700,7 @@ static void compute_pkt_fields(AVFormatC
             /* presentation is not delayed : PTS and DTS are the same */
             if(pkt->pts == AV_NOPTS_VALUE)
                 pkt->pts = pkt->dts;
-            update_initial_timestamps(s, pkt->stream_index, pkt->pts);
+            update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts);
             if(pkt->pts == AV_NOPTS_VALUE)
                 pkt->pts = st->cur_dts;
             pkt->dts = pkt->pts;
@@ -713,7 +717,7 @@ static void compute_pkt_fields(AVFormatC
         if(pkt->dts == AV_NOPTS_VALUE)
             pkt->dts= st->pts_buffer[0];
         if(delay>1){
-            update_initial_timestamps(s, pkt->stream_index, pkt->dts); // this should happen on the first packet
+            update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet
         }
         if(pkt->dts > st->cur_dts)
             st->cur_dts = pkt->dts;

Modified: trunk/tests/libav.regression.ref
==============================================================================
--- trunk/tests/libav.regression.ref	(original)
+++ trunk/tests/libav.regression.ref	Mon Sep  3 09:56:26 2007
@@ -4,7 +4,7 @@ ffmpeg regression test
 ./tests/data/b-libav.avi CRC=0x400c29e9
 786446e80ead936e5faa8f5908f19281 *./tests/data/b-libav.asf
 339775 ./tests/data/b-libav.asf
-./tests/data/b-libav.asf CRC=0x7f38e57b
+./tests/data/b-libav.asf CRC=0x74113749
 1ce78eeb6881ffe5b649a9b5105de919 *./tests/data/b-libav.rm
 355405 ./tests/data/b-libav.rm
 bdb7484c68db722f66ba1630cf79844c *./tests/data/b-libav.mpg




More information about the ffmpeg-cvslog mailing list