[vlc-commits] TS mux: start timestamps from 0

Rafaël Carré git at videolan.org
Fri May 9 10:22:16 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri May  9 10:21:01 2014 +0200| [ebcc69cfb1569a0fcedf10498606b231ae6fcb7c] | committer: Rafaël Carré

TS mux: start timestamps from 0

Make mplayer timeline display nicer

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ebcc69cfb1569a0fcedf10498606b231ae6fcb7c
---

 modules/mux/mpeg/ts.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index f973769..5028924 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -379,6 +379,7 @@ struct sout_mux_sys_t
     int64_t         i_pcr_delay;
 
     int64_t         i_dts_delay;
+    mtime_t         first_dts;
 
     bool            b_use_key_frames;
 
@@ -1274,7 +1275,7 @@ static bool MuxStreams(sout_mux_t *p_mux )
                 /* Don't mux the SPU yet if it is too early */
                 block_t *p_spu = block_FifoShow( p_input->p_fifo );
 
-                int64_t i_spu_delay = p_spu->i_dts - p_pcr_stream->i_pes_dts;
+                int64_t i_spu_delay = p_spu->i_dts - p_sys->first_dts - p_pcr_stream->i_pes_dts;
                 if( ( i_spu_delay > i_shaping_delay ) &&
                     ( i_spu_delay < INT64_C(100000000) ) )
                     continue;
@@ -1317,6 +1318,12 @@ static bool MuxStreams(sout_mux_t *p_mux )
                    VLC_CODEC_SUBT )
             p_data->i_length = 1000;
 
+        if (p_sys->first_dts == 0)
+            p_sys->first_dts = p_data->i_dts;
+
+        p_data->i_dts -= p_sys->first_dts;
+        p_data->i_pts -= p_sys->first_dts;
+
         if( ( p_pcr_stream->i_pes_dts > 0 &&
               p_data->i_dts - 10000000 > p_pcr_stream->i_pes_dts +
               p_pcr_stream->i_pes_length ) ||



More information about the vlc-commits mailing list