]> git.sesse.net Git - vlc/commitdiff
TS mux: start timestamps from 0
authorRafaël Carré <funman@videolan.org>
Fri, 9 May 2014 08:21:01 +0000 (10:21 +0200)
committerRafaël Carré <funman@videolan.org>
Fri, 9 May 2014 08:21:53 +0000 (10:21 +0200)
Make mplayer timeline display nicer

modules/mux/mpeg/ts.c

index f97376915e6b41e06651c68570707142b597a73c..5028924ea8305245941eab2e810276fed5b1e85d 100644 (file)
@@ -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 ) ||