Commit ebcc69cf authored by Rafaël Carré's avatar Rafaël Carré

TS mux: start timestamps from 0

Make mplayer timeline display nicer
parent 882be2a1
...@@ -379,6 +379,7 @@ struct sout_mux_sys_t ...@@ -379,6 +379,7 @@ struct sout_mux_sys_t
int64_t i_pcr_delay; int64_t i_pcr_delay;
int64_t i_dts_delay; int64_t i_dts_delay;
mtime_t first_dts;
bool b_use_key_frames; bool b_use_key_frames;
...@@ -1274,7 +1275,7 @@ static bool MuxStreams(sout_mux_t *p_mux ) ...@@ -1274,7 +1275,7 @@ static bool MuxStreams(sout_mux_t *p_mux )
/* Don't mux the SPU yet if it is too early */ /* Don't mux the SPU yet if it is too early */
block_t *p_spu = block_FifoShow( p_input->p_fifo ); 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 ) && if( ( i_spu_delay > i_shaping_delay ) &&
( i_spu_delay < INT64_C(100000000) ) ) ( i_spu_delay < INT64_C(100000000) ) )
continue; continue;
...@@ -1317,6 +1318,12 @@ static bool MuxStreams(sout_mux_t *p_mux ) ...@@ -1317,6 +1318,12 @@ static bool MuxStreams(sout_mux_t *p_mux )
VLC_CODEC_SUBT ) VLC_CODEC_SUBT )
p_data->i_length = 1000; 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 && if( ( p_pcr_stream->i_pes_dts > 0 &&
p_data->i_dts - 10000000 > p_pcr_stream->i_pes_dts + p_data->i_dts - 10000000 > p_pcr_stream->i_pes_dts +
p_pcr_stream->i_pes_length ) || p_pcr_stream->i_pes_length ) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment