[vlc-devel] [PATCH V3 04/19] ts: update the origin time to the es_out
Thomas Guillem
thomas at gllm.fr
Fri Sep 6 17:20:34 CEST 2019
---
modules/demux/mpeg/ts.c | 24 ++++++++++++++++++++++++
modules/demux/mpeg/ts_streams.c | 2 +-
modules/demux/mpeg/ts_streams_private.h | 1 +
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 93009d487a..353d1527c1 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1512,6 +1512,29 @@ static void SendDataChain( demux_t *p_demux, ts_es_t *p_es, block_t *p_chain )
}
}
+static void UpdateOriginTime( demux_t *p_demux, ts_pmt_t *p_pmt, block_t *p_block )
+{
+ demux_sys_t *p_sys = p_demux->p_sys;
+
+ if( p_sys->b_access_control && !EITCurrentEventTime( p_pmt, p_sys, NULL, NULL ) )
+ {
+ if( p_pmt->pcr.i_origin != TS_TICK_UNKNOWN )
+ {
+ es_out_Control( p_demux->out, ES_OUT_ADD_ORIGIN_TIME,
+ p_pmt->i_number, VLC_TICK_0, p_block->i_pts );
+ p_pmt->pcr.i_origin = TS_TICK_UNKNOWN;
+ }
+ }
+ else if( p_pmt->pcr.i_first != p_pmt->pcr.i_origin )
+ {
+ const vlc_tick_t origin = p_pmt->pcr.i_first == TS_TICK_UNKNOWN ?
+ VLC_TICK_0 : FROM_SCALE( p_pmt->pcr.i_first );
+ es_out_Control( p_demux->out, ES_OUT_ADD_ORIGIN_TIME, p_pmt->i_number,
+ origin, p_block->i_pts );
+ p_pmt->pcr.i_origin = p_pmt->pcr.i_first;
+ }
+}
+
/****************************************************************************
* gathering stuff
****************************************************************************/
@@ -1719,6 +1742,7 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
p_block = ConvertPESBlock( p_demux, p_es, i_pes_size, i_stream_id, p_block );
}
+ UpdateOriginTime( p_demux, p_pmt, p_block );
SendDataChain( p_demux, p_es, p_block );
}
else
diff --git a/modules/demux/mpeg/ts_streams.c b/modules/demux/mpeg/ts_streams.c
index 84e2cbeccf..6698fe99ca 100644
--- a/modules/demux/mpeg/ts_streams.c
+++ b/modules/demux/mpeg/ts_streams.c
@@ -128,7 +128,7 @@ ts_pmt_t *ts_pmt_New( demux_t *p_demux )
pmt->p_si_sdt_pid = NULL;
pmt->pcr.i_current = TS_TICK_UNKNOWN;
- pmt->pcr.i_first = TS_TICK_UNKNOWN;
+ pmt->pcr.i_first = pmt->pcr.i_origin = TS_TICK_UNKNOWN;
pmt->pcr.b_disable = false;
pmt->pcr.i_first_dts = TS_TICK_UNKNOWN;
pmt->pcr.i_pcroffset = -1;
diff --git a/modules/demux/mpeg/ts_streams_private.h b/modules/demux/mpeg/ts_streams_private.h
index b5646c41d7..ae095abf64 100644
--- a/modules/demux/mpeg/ts_streams_private.h
+++ b/modules/demux/mpeg/ts_streams_private.h
@@ -60,6 +60,7 @@ struct ts_pmt_t
{
stime_t i_current;
stime_t i_first; // seen <> != TS_TICK_UNKNOWN
+ stime_t i_origin;
/* broken PCR handling */
stime_t i_first_dts;
stime_t i_pcroffset;
--
2.20.1
More information about the vlc-devel
mailing list