[vlc-devel] [PATCH 08/17] demux: ts: handle matching time
Thomas Guillem
thomas at gllm.fr
Tue Mar 9 15:15:37 UTC 2021
---
modules/demux/mpeg/ts.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 30dd177ecdc..2de758f70c1 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1043,14 +1043,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return VLC_SUCCESS;
}
break;
- case DEMUX_GET_NORMAL_TIME:
- if ((p_sys->b_access_control && !EITCurrentEventTime( p_pmt, p_sys, NULL, NULL))
- || (!p_pmt || p_pmt->pcr.i_current == -1 || p_pmt->pcr.i_first == -1))
- return VLC_EGENERIC; /* use VLC_TICK_0 as Normal Play Time*/
-
- /* Use the first pcr of the current program as Normal Play Time */
- *va_arg( args, vlc_tick_t * ) = FROM_SCALE( p_pmt->pcr.i_first );
- return VLC_SUCCESS;
case DEMUX_GET_LENGTH:
if( p_sys->b_access_control )
@@ -2267,7 +2259,14 @@ static void ProgramSetPCR( demux_t *p_demux, ts_pmt_t *p_pmt, stime_t i_pcr )
if ( p_sys->i_pmt_es )
{
- if( p_sys->b_access_control == false )
+ vlc_tick_t i_matching_time = VLC_TICK_INVALID;
+ if( p_sys->b_access_control )
+ {
+ time_t i_event_start;
+ if( !EITCurrentEventTime( p_pmt, p_sys, &i_event_start, NULL ) )
+ i_matching_time = vlc_tick_from_sec( i_event_start );
+ }
+ else
{
/* growing files/named fifo handling */
if( vlc_stream_Tell( p_sys->stream ) > p_pmt->i_last_dts_byte )
@@ -2281,8 +2280,10 @@ static void ProgramSetPCR( demux_t *p_demux, ts_pmt_t *p_pmt, stime_t i_pcr )
}
}
}
+ if( i_matching_time == VLC_TICK_INVALID )
+ i_matching_time = FROM_SCALE(i_pcr - p_pmt->pcr.i_first);
- es_out_Control( p_demux->out, ES_OUT_SET_GROUP_PCR, p_pmt->i_number, FROM_SCALE(i_pcr), VLC_TICK_INVALID );
+ es_out_Control( p_demux->out, ES_OUT_SET_GROUP_PCR, p_pmt->i_number, FROM_SCALE(i_pcr), i_matching_time );
}
}
--
2.30.0
More information about the vlc-devel
mailing list