]> git.sesse.net Git - vlc/commitdiff
avformat: set the "duration/length/ of a packet if known.
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 18 Sep 2008 14:35:44 +0000 (16:35 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 18 Sep 2008 14:35:44 +0000 (16:35 +0200)
modules/demux/avformat/demux.c

index 84d8bb914cf025aac575eda4b68618c894daa6c4..683c184ef3108d3ef086210c4a93342a6f7ba1f8 100644 (file)
@@ -377,6 +377,10 @@ static int Demux( demux_t *p_demux )
         0 : (pkt.pts) * 1000000 *
         p_sys->ic->streams[pkt.stream_index]->time_base.num /
         p_sys->ic->streams[pkt.stream_index]->time_base.den - i_start_time;
+    if( pkt.duration > 0 )
+        p_frame->i_length = pkt.duration * 1000000 *
+            p_sys->ic->streams[pkt.stream_index]->time_base.num /
+            p_sys->ic->streams[pkt.stream_index]->time_base.den - i_start_time;
 
 #ifdef AVFORMAT_DEBUG
     msg_Dbg( p_demux, "tk[%d] dts=%"PRId64" pts=%"PRId64,