Skip to content

Commit

Permalink
TS mux: start timestamps from 0
Browse files Browse the repository at this point in the history
Make mplayer timeline display nicer
  • Loading branch information
funman committed May 9, 2014
1 parent 882be2a commit ebcc69c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/mux/mpeg/ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) ||
Expand Down

0 comments on commit ebcc69c

Please sign in to comment.