<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}
p.MsoNormal,p.MsoNoSpacing{margin:0}
p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>On Wed, Mar 10, 2021, at 12:56, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt" style=""><div>Hi,<br></div><div><br></div><div>This is wrong IMO. As I think I've pointed out way back when, we should report the mapping from timestamp to NPT, which in practice is an offset that rarely changes.<br></div></blockquote><div><br></div><div><br></div><div>For the few demuxers that need NPT or matching time, it's a little simpler to send the matching_time (one less subtraction, and use the already implemented GET_TIME code).<br></div><div><br></div><div>I'm OK with both solution. If we are certain that NPT can't move, then yes, I can send it via a new ES_OUT control only one time, but I don't think that's the case with TS.<br></div><div><br></div><div>The previous implementation was wrong (DEMUX_GET_NPT) since there was possibly a delay of 200ms before getting the correct time (so UI glitch).<br></div><div><br></div><blockquote type="cite" id="qt" style=""><div><br></div><div>We should *not* tie this to reporting the PCR. In fact, this should probably not tie into the ES output, as it is an input/user thing.<br></div><div><br></div><div class="qt-gmail_quote"><div>Le 9 mars 2021 17:15:33 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div><blockquote class="qt-gmail_quote" style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;"><pre class="qt-k9mail"><div>This will replace DEMUX_GET_NORMAL_TIME.<br></div><div><br></div><div>Demux modules should set a valid matching_time if the PCR and the time<br></div><div>reported by DEMUX_GET_TIME don't have the same origin.<br></div><div>This is the case for mpeg/ts, dvd, bluray, cdda, adaptive.<hr> include/vlc_es_out.h | 16 +++++++++++++---<br></div><div> modules/demux/adaptive/PlaylistManager.cpp | 2 +-<br></div><div> modules/demux/adaptive/plumbing/Demuxer.cpp | 2 +-<br></div><div> modules/demux/mpeg/ts.c | 2 +-<br></div><div> modules/demux/timestamps_filter.h | 5 +++--<br></div><div> src/input/es_out_timeshift.c | 7 +++++--<br></div><div> 6 files changed, 24 insertions(+), 10 deletions(-)<br></div><div><br></div><div>diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h<br></div><div>index 49635f8594f..a10d2a1a555 100644<br></div><div>--- a/include/vlc_es_out.h<br></div><div>+++ b/include/vlc_es_out.h<br></div><div>@@ -60,9 +60,13 @@ enum es_out_query_e<br></div><div> * to slow down the demuxer so that it reads at the right speed.<br></div><div> * XXX: if you want PREROLL just call ES_OUT_SET_NEXT_DISPLAY_TIME and send<br></div><div> * as you would normally do.<br></div><div>+ * Modules should set a valid matching_time (!= VLC_TICK_INVALID) when<br></div><div>+ * their PCR is not based on 0 (DEMUX_GET_TIME and PCR are not based on the<br></div><div>+ * same origin).<br></div><div>+ *<br></div><div> */<br></div><div>- ES_OUT_SET_PCR, /* arg1=vlc_tick_t i_pcr(microsecond!) (using default group 0)*/<br></div><div>- ES_OUT_SET_GROUP_PCR, /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/<br></div><div>+ ES_OUT_SET_PCR, /* arg1=vlc_tick_t i_pcr, arg2=vlc_tick_t i_matching_time (using default group 0) */<br></div><div>+ ES_OUT_SET_GROUP_PCR, /* arg1= int i_group, arg2=vlc_tick_t i_pcr, arg3=vlc_tick_t i_matching_time */<br></div><div> ES_OUT_RESET_PCR, /* no arg */<br></div><div> <br></div><div> /* This will update the fmt, drain and restart the decoder (if any).<br></div><div>@@ -184,7 +188,13 @@ static inline void es_out_Delete( es_out_t *p_out )<br></div><div> <br></div><div> static inline int es_out_SetPCR( es_out_t *out, vlc_tick_t pcr )<br></div><div> {<br></div><div>- return es_out_Control( out, ES_OUT_SET_PCR, pcr );<br></div><div>+ return es_out_Control( out, ES_OUT_SET_PCR, pcr, VLC_TICK_INVALID );<br></div><div>+}<br></div><div>+<br></div><div>+static inline int es_out_SetPCRTime( es_out_t *out, vlc_tick_t pcr,<br></div><div>+ vlc_tick_t matching_time )<br></div><div>+{<br></div><div>+ return es_out_Control( out, ES_OUT_SET_PCR, pcr, matching_time );<br></div><div> }<br></div><div> <br></div><div> static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta )<br></div><div>diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp<br></div><div>index e38e4d2fd6d..12773950159 100644<br></div><div>--- a/modules/demux/adaptive/PlaylistManager.cpp<br></div><div>+++ b/modules/demux/adaptive/PlaylistManager.cpp<br></div><div>@@ -505,7 +505,7 @@ int PlaylistManager::doDemux(vlc_tick_t increment)<br></div><div> {<br></div><div> demux.i_nzpcr = i_nzbarrier;<br></div><div> vlc_tick_t pcr = VLC_TICK_0 + std::max(INT64_C(0), demux.i_nzpcr - VLC_TICK_FROM_MS(100));<br></div><div>- es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, 0, pcr);<br></div><div>+ es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, 0, pcr, VLC_TICK_INVALID);<br></div><div> }<br></div><div> vlc_mutex_unlock(&demux.lock);<br></div><div> break;<br></div><div>diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp<br></div><div>index 0317f7309a5..d00fe280073 100644<br></div><div>--- a/modules/demux/adaptive/plumbing/Demuxer.cpp<br></div><div>+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp<br></div><div>@@ -281,6 +281,6 @@ AbstractDemuxer::Status SlaveDemuxer::demux(vlc_tick_t nz_deadline)<br></div><div> return Status::Eof;<br></div><div> }<br></div><div> Status status = Demuxer::demux(i_next_demux_time);<br></div><div>- es_out_Control(p_es_out, ES_OUT_SET_GROUP_PCR, 0, i_next_demux_time);<br></div><div>+ es_out_Control(p_es_out, ES_OUT_SET_GROUP_PCR, 0, i_next_demux_time, VLC_TICK_INVALID);<br></div><div> return status;<br></div><div> }<br></div><div>diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c<br></div><div>index 6361715cc67..52319fd220c 100644<br></div><div>--- a/modules/demux/mpeg/ts.c<br></div><div>+++ b/modules/demux/mpeg/ts.c<br></div><div>@@ -2267,7 +2267,7 @@ static void ProgramSetPCR( demux_t *p_demux, ts_pmt_t *p_pmt, stime_t i_pcr )<br></div><div> <br></div><div> if ( p_sys->i_pmt_es )<br></div><div> {<br></div><div>- es_out_Control( p_demux->out, ES_OUT_SET_GROUP_PCR, p_pmt->i_number, FROM_SCALE(i_pcr) );<br></div><div>+ es_out_Control( p_demux->out, ES_OUT_SET_GROUP_PCR, p_pmt->i_number, FROM_SCALE(i_pcr), VLC_TICK_INVALID );<br></div><div> /* growing files/named fifo handling */<br></div><div> if( p_sys->b_access_control == false &&<br></div><div> vlc_stream_Tell( p_sys->stream ) > p_pmt->i_last_dts_byte )<br></div><div>diff --git a/modules/demux/timestamps_filter.h b/modules/demux/timestamps_filter.h<br></div><div>index a3563326e30..46491021788 100644<br></div><div>--- a/modules/demux/timestamps_filter.h<br></div><div>+++ b/modules/demux/timestamps_filter.h<br></div><div>@@ -171,6 +171,7 @@ static int timestamps_filter_es_out_Control(es_out_t *out, input_source_t *in, i<br></div><div> else<br></div><div> i_group = 0;<br></div><div> int64_t pcr = va_arg(va_list, int64_t);<br></div><div>+ int64_t matching_time = va_arg(va_list, int64_t);<br></div><div> <br></div><div> if(timestamps_filter_push("PCR ", &p_sys->pcrtf, pcr, 0, p_sys->b_discontinuity, true))<br></div><div> {<br></div><div>@@ -200,9 +201,9 @@ static int timestamps_filter_es_out_Control(es_out_t *out, input_source_t *in, i<br></div><div> pcr += p_sys->pcrtf.sequence_offset;<br></div><div> <br></div><div> if(i_query == ES_OUT_SET_GROUP_PCR)<br></div><div>- return es_out_Control(p_sys->original_es_out, i_query, i_group, pcr);<br></div><div>+ return es_out_Control(p_sys->original_es_out, i_query, i_group, pcr, matching_time);<br></div><div> else<br></div><div>- return es_out_SetPCR(p_sys->original_es_out, pcr);<br></div><div>+ return es_out_SetPCRTime(p_sys->original_es_out, pcr, matching_time);<br></div><div> }<br></div><div> break;<br></div><div> case ES_OUT_RESET_PCR:<br></div><div>diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c<br></div><div>index da01feb8b9c..2ecc7c3b6bd 100644<br></div><div>--- a/src/input/es_out_timeshift.c<br></div><div>+++ b/src/input/es_out_timeshift.c<br></div><div>@@ -1533,11 +1533,13 @@ static int CmdInitControl( ts_cmd_control_t *p_cmd, input_source_t *in,<br></div><div> <br></div><div> case ES_OUT_SET_PCR:<br></div><div> p_cmd->u.int_i64_i64.i_i64_1 = va_arg( args, vlc_tick_t );<br></div><div>+ p_cmd->u.int_i64_i64.i_i64_2 = va_arg( args, vlc_tick_t );<br></div><div> break;<br></div><div> <br></div><div> case ES_OUT_SET_GROUP_PCR: /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/<br></div><div> p_cmd->u.int_i64_i64.i_int = va_arg( args, int );<br></div><div> p_cmd->u.int_i64_i64.i_i64_1 = va_arg( args, vlc_tick_t );<br></div><div>+ p_cmd->u.int_i64_i64.i_i64_2 = va_arg( args, vlc_tick_t );<br></div><div> break;<br></div><div> <br></div><div> case ES_OUT_SET_ES_SCRAMBLED_STATE:<br></div><div>@@ -1670,11 +1672,12 @@ static int CmdExecuteControl( es_out_t *p_tsout, ts_cmd_control_t *p_cmd )<br></div><div> return es_out_in_Control( p_sys->p_out, in, i_query, p_cmd->u.i_i64 );<br></div><div> <br></div><div> case ES_OUT_SET_PCR:<br></div><div>- return es_out_in_Control( p_sys->p_out, in, i_query, p_cmd->u.int_i64_i64.i_i64_1 );<br></div><div>+ return es_out_in_Control( p_sys->p_out, in, i_query, p_cmd->u.int_i64_i64.i_i64_1,<br></div><div>+ p_cmd->u.int_i64_i64.i_i64_2 );<br></div><div> <br></div><div> case ES_OUT_SET_GROUP_PCR: /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/<br></div><div> return es_out_in_Control( p_sys->p_out, in, i_query, p_cmd->u.int_i64_i64.i_int,<br></div><div>- p_cmd->u.int_i64_i64.i_i64_1 );<br></div><div>+ p_cmd->u.int_i64_i64.i_i64_1, p_cmd->u.int_i64_i64.i_i64_2 );<br></div><div> <br></div><div> case ES_OUT_RESET_PCR: /* no arg */<br></div><div> return es_out_in_Control( p_sys->p_out, in, i_query );<br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><br></div></body></html>