vlc | branch: master | Rafaël Carré <[email protected]> | Wed Sep 10 17:15:45 2014 +0200| [c9e95ac9365206902efaa390e2faa5d6047ca3cf] | committer: Rafaël Carré
TS mux: fix ebcc69cfb1569a0fcedf10498606b231ae6fcb7c Only modify bitstream (PCR & PES), but not VLC core timestamps > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c9e95ac9365206902efaa390e2faa5d6047ca3cf --- modules/mux/mpeg/pes.c | 13 ++++++++----- modules/mux/mpeg/pes.h | 2 +- modules/mux/mpeg/ps.c | 2 +- modules/mux/mpeg/ts.c | 11 ++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/mux/mpeg/pes.c b/modules/mux/mpeg/pes.c index 5f1bd0b..634f6d0 100644 --- a/modules/mux/mpeg/pes.c +++ b/modules/mux/mpeg/pes.c @@ -319,11 +319,10 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts, void EStoPES ( block_t **pp_pes, es_format_t *p_fmt, int i_stream_id, int b_mpeg2, int b_data_alignment, int i_header_size, - int i_max_pes_size ) + int i_max_pes_size, mtime_t ts_offset ) { block_t *p_es = *pp_pes; block_t *p_pes = NULL; - mtime_t i_pts, i_dts, i_length; uint8_t *p_data; int i_size; @@ -383,8 +382,12 @@ void EStoPES ( block_t **pp_pes, } - i_pts = p_es->i_pts <= 0 ? 0 : p_es->i_pts * 9 / 100; // 90000 units clock - i_dts = p_es->i_dts <= 0 ? 0 : p_es->i_dts * 9 / 100; // 90000 units clock + mtime_t i_dts = 0; + mtime_t i_pts = 0; + if (p_es->i_pts > VLC_TS_INVALID) + i_pts = (p_es->i_pts - ts_offset) * 9 / 100; + if (p_es->i_dts > VLC_TS_INVALID) + i_dts = (p_es->i_dts - ts_offset) * 9 / 100; i_size = p_es->i_buffer; p_data = p_es->p_buffer; @@ -434,7 +437,7 @@ void EStoPES ( block_t **pp_pes, /* Now redate all pes */ i_dts = p_pes->i_dts; - i_length = p_pes->i_length / i_pes_count; + mtime_t i_length = p_pes->i_length / i_pes_count; while( p_pes ) { p_pes->i_dts = i_dts; diff --git a/modules/mux/mpeg/pes.h b/modules/mux/mpeg/pes.h index 17dda53..71eb699 100644 --- a/modules/mux/mpeg/pes.h +++ b/modules/mux/mpeg/pes.h @@ -38,4 +38,4 @@ void EStoPES ( block_t **pp_pes, es_format_t *p_fmt, int i_stream_id, int b_mpeg2, int b_data_alignment, int i_header_size, - int i_max_pes_size ); + int i_max_pes_size, mtime_t ts_offset ); diff --git a/modules/mux/mpeg/ps.c b/modules/mux/mpeg/ps.c index 599dfb1..6dd65c9 100644 --- a/modules/mux/mpeg/ps.c +++ b/modules/mux/mpeg/ps.c @@ -514,7 +514,7 @@ static int Mux( sout_mux_t *p_mux ) /* Get and mux a packet */ p_data = block_FifoGet( p_input->p_fifo ); EStoPES ( &p_data, p_input->p_fmt, p_stream->i_stream_id, - p_sys->b_mpeg2, 0, 0, p_sys->i_pes_max_size ); + p_sys->b_mpeg2, 0, 0, p_sys->i_pes_max_size, 0 ); block_ChainAppend( &p_ps, p_data ); diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index 8d440ec..3d7badb 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -1274,7 +1274,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_sys->first_dts - p_pcr_stream->i_pes_dts; + int64_t i_spu_delay = p_spu->i_dts - p_pcr_stream->i_pes_dts; if( ( i_spu_delay > i_shaping_delay ) && ( i_spu_delay < 100 * CLOCK_FREQ ) ) continue; @@ -1320,9 +1320,6 @@ static bool MuxStreams(sout_mux_t *p_mux ) 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 - 10 * CLOCK_FREQ > p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length ) || @@ -1384,7 +1381,7 @@ static bool MuxStreams(sout_mux_t *p_mux ) p_spu->p_buffer[2] = ' '; EStoPES( &p_spu, p_input->p_fmt, - p_stream->i_stream_id, 1, 0, 0, 0 ); + p_stream->i_stream_id, 1, 0, 0, 0, p_sys->first_dts ); p_data->p_next = p_spu; } break; @@ -1431,7 +1428,7 @@ static bool MuxStreams(sout_mux_t *p_mux ) EStoPES ( &p_data, p_input->p_fmt, p_stream->i_stream_id, 1, b_data_alignment, i_header_size, - i_max_pes_size ); + i_max_pes_size, p_sys->first_dts ); BufferChainAppend( &p_stream->chain_pes, p_data ); @@ -1799,7 +1796,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts, if( p_ts->i_flags & BLOCK_FLAG_CLOCK ) { /* msg_Dbg( p_mux, "pcr=%lld ms", p_ts->i_dts / 1000 ); */ - TSSetPCR( p_ts, p_ts->i_dts - p_sys->i_dts_delay ); + TSSetPCR( p_ts, p_ts->i_dts - p_sys->i_dts_delay - p_sys->first_dts ); } if( p_ts->i_flags & BLOCK_FLAG_SCRAMBLED ) { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
