<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>On Fri, Jun 21, 2019, at 11:31, Roland Bewick wrote:<br></div><blockquote type="cite" id="qt"><div><div><br></div><div><div class="qt-gmail_quote"><br></div></div></div><div><div><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr">On Fri, 21 Jun 2019 at 3:41 PM, Thomas Guillem <<a href="mailto:thomas@gllm.fr">thomas@gllm.fr</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div><br></div><div><br></div><div>On Fri, Jun 21, 2019, at 06:57, Roland Bewick wrote:<br></div><div> > <br></div><div> > On 20/06/2019 10:23 PM, Thomas Guillem wrote:<br></div><div> > > From: Roland Bewick <<a href="mailto:roland.bewick@gmail.com">roland.bewick@gmail.com</a>><br></div><div> > ><br></div><div> > > Signed-off-by: Thomas Guillem <<a href="mailto:thomas@gllm.fr">thomas@gllm.fr</a>><br></div><div> > > ---<br></div><div> > > include/vlc_es_out.h | 1 +<br></div><div> > > modules/access/bluray.c | 1 +<br></div><div> > > modules/demux/adaptive/plumbing/FakeESOut.cpp | 1 +<br></div><div> > > src/input/es_out.c | 44 +++++++++++++++++++<br></div><div> > > src/input/es_out_timeshift.c | 1 +<br></div><div> > > src/input/input.c | 41 +++++++++++++++++<br></div><div> > > src/input/input_internal.h | 5 +++<br></div><div> > > 7 files changed, 94 insertions(+)<br></div><div> > ><br></div><div> > > diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h<br></div><div> > > index 06b6a8f338..8ee4ef0be1 100644<br></div><div> > > --- a/include/vlc_es_out.h<br></div><div> > > +++ b/include/vlc_es_out.h<br></div><div> > > @@ -36,6 +36,7 @@ enum es_out_query_e<br></div><div> > > {<br></div><div> > > /* set or change the selected ES in its category (audio/video/spu) */<br></div><div> > > ES_OUT_SET_ES, /* arg1= es_out_id_t* */<br></div><div> > > + ES_OUT_SET_ES_LIST, /* arg1= es_out_id_t *const* (null terminated array) */<br></div><div> > > ES_OUT_UNSET_ES, /* arg1= es_out_id_t* res=can fail */<br></div><div> > > ES_OUT_RESTART_ES, /* arg1= es_out_id_t* */<br></div><div> > > <br></div><div> > > diff --git a/modules/access/bluray.c b/modules/access/bluray.c<br></div><div> > > index 95f1afe389..b12a416e36 100644<br></div><div> > > --- a/modules/access/bluray.c<br></div><div> > > +++ b/modules/access/bluray.c<br></div><div> > > @@ -1546,6 +1546,7 @@ static int bluray_esOutControl(es_out_t *p_out, int i_query, va_list args)<br></div><div> > > <br></div><div> > > case ES_OUT_SET_ES_DEFAULT:<br></div><div> > > case ES_OUT_SET_ES:<br></div><div> > > + case ES_OUT_SET_ES_LIST:<br></div><div> > > case ES_OUT_UNSET_ES:<br></div><div> > > case ES_OUT_SET_ES_STATE:<br></div><div> > > i_ret = VLC_EGENERIC;<br></div><div> > > diff --git a/modules/demux/adaptive/plumbing/FakeESOut.cpp b/modules/demux/adaptive/plumbing/FakeESOut.cpp<br></div><div> > > index 69d00f7e7f..f1f274e0cf 100644<br></div><div> > > --- a/modules/demux/adaptive/plumbing/FakeESOut.cpp<br></div><div> > > +++ b/modules/demux/adaptive/plumbing/FakeESOut.cpp<br></div><div> > > @@ -470,6 +470,7 @@ int FakeESOut::esOutControl_Callback(es_out_t *fakees, int i_query, va_list args<br></div><div> > > }<br></div><div> > > <br></div><div> > > case ES_OUT_SET_ES:<br></div><div> > > + case ES_OUT_SET_ES_LIST:<br></div><div> > > case ES_OUT_SET_ES_DEFAULT:<br></div><div> > > case ES_OUT_SET_ES_STATE:<br></div><div> > > return VLC_SUCCESS;<br></div><div> > > diff --git a/src/input/es_out.c b/src/input/es_out.c<br></div><div> > > index 1da90c76fa..366c9e65c7 100644<br></div><div> > > --- a/src/input/es_out.c<br></div><div> > > +++ b/src/input/es_out.c<br></div><div> > > @@ -220,6 +220,8 @@ static void EsOutDel ( es_out_t *, es_out_id_t * );<br></div><div> > > <br></div><div> > > static void EsOutTerminate( es_out_t * );<br></div><div> > > static void EsOutSelect( es_out_t *, es_out_id_t *es, bool b_force );<br></div><div> > > +static void EsOutSelectList( es_out_t *, enum es_format_category_e cat,<br></div><div> > > + vlc_es_id_t *const* es_id_list );<br></div><div> > > static void EsOutUpdateInfo( es_out_t *, es_out_id_t *es, const vlc_meta_t * );<br></div><div> > > static int EsOutSetRecord( es_out_t *, bool b_record );<br></div><div> > > <br></div><div> > > @@ -2219,6 +2221,41 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )<br></div><div> > > p_esprops->p_main_es = es;<br></div><div> > > }<br></div><div> > > <br></div><div> > > +static void EsOutSelectList( es_out_t *out, enum es_format_category_e cat,<br></div><div> > > + vlc_es_id_t * const*es_id_list )<br></div><div> > > +{<br></div><div> > > +<br></div><div> > > + es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);<br></div><div> > > + es_out_id_t *other;<br></div><div> > > +<br></div><div> > > + foreach_es_then_es_slaves(other)<br></div><div> > > + {<br></div><div> > > + if( other->fmt.i_cat == cat )<br></div><div> > > + {<br></div><div> > > + bool select = false;<br></div><div> > > + for( size_t i = 0; ; i++ )<br></div><div> > > + {<br></div><div> > > + vlc_es_id_t *es_id = es_id_list[i];<br></div><div> > > + if( es_id == NULL )<br></div><div> > > + break;<br></div><div> > > + else if( es_id->i_id == other->id.i_id )<br></div><div> > > + {<br></div><div> > > + select = true;<br></div><div> > > + break;<br></div><div> > > + }<br></div><div> > > + }<br></div><div> > > + if( !select && EsIsSelected( other ) )<br></div><div> > > + {<br></div><div> > > + EsOutUnselectEs( out, other, other->p_pgrm == p_sys->p_pgrm );<br></div><div> > > + }<br></div><div> > > + else if( select && !EsIsSelected( other ) )<br></div><div> > > + {<br></div><div> > > + EsOutSelectEs( out, other );<br></div><div> > > + }<br></div><div> > > + }<br></div><div> > > + }<br></div><div> > > +}<br></div><div> > > +<br></div><div> > > static void EsOutCreateCCChannels( es_out_t *out, vlc_fourcc_t codec, uint64_t i_bitmap,<br></div><div> > > const char *psz_descfmt, es_out_id_t *parent )<br></div><div> > > {<br></div><div> > > @@ -2668,6 +2705,13 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )<br></div><div> > > EsOutStopFreeVout( out );<br></div><div> > > return VLC_SUCCESS;<br></div><div> > > }<br></div><div> > > + case ES_OUT_SET_ES_LIST:<br></div><div> > > + {<br></div><div> > > + enum es_format_category_e cat = va_arg( args, enum es_format_category_e );<br></div><div> > > + vlc_es_id_t *const*es_id_list = va_arg( args, vlc_es_id_t ** );<br></div><div> > > + EsOutSelectList( out, cat, es_id_list );<br></div><div> > > + return VLC_SUCCESS;<br></div><div> > > + }<br></div><div> > > case ES_OUT_UNSET_ES:<br></div><div> > > {<br></div><div> > > es_out_id_t *es = va_arg( args, es_out_id_t * ), *other;<br></div><div> > > diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c<br></div><div> > > index cff9691d71..2fd8855251 100644<br></div><div> > > --- a/src/input/es_out_timeshift.c<br></div><div> > > +++ b/src/input/es_out_timeshift.c<br></div><div> > > @@ -737,6 +737,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )<br></div><div> > > <br></div><div> > > /* Invalid queries for this es_out level */<br></div><div> > > case ES_OUT_SET_ES_BY_ID:<br></div><div> > > + case ES_OUT_SET_ES_LIST:<br></div><div> > > case ES_OUT_RESTART_ES_BY_ID:<br></div><div> > > case ES_OUT_SET_ES_DEFAULT_BY_ID:<br></div><div> > > case ES_OUT_STOP_ALL_ES:<br></div><div> > > diff --git a/src/input/input.c b/src/input/input.c<br></div><div> > > index efc338f33c..ab96f29afa 100644<br></div><div> > > --- a/src/input/input.c<br></div><div> > > +++ b/src/input/input.c<br></div><div> > > @@ -1594,6 +1594,18 @@ static void ControlRelease( int i_type, const input_control_param_t *p_param )<br></div><div> > > case INPUT_CONTROL_RESTART_ES:<br></div><div> > > vlc_es_id_Release( p_param->id );<br></div><div> > > break;<br></div><div> > > + case INPUT_CONTROL_SET_ES_LIST:<br></div><div> > > + {<br></div><div> > > + for (size_t i = 0; ; i++)<br></div><div> > > + {<br></div><div> > > + vlc_es_id_t *es_id = p_param->list.ids[i];<br></div><div> > > + if (es_id == NULL)<br></div><div> > > + break;<br></div><div> > > + vlc_es_id_Release(es_id);<br></div><div> > > + }<br></div><div> > > + free(p_param->list.ids);<br></div><div> > > + break;<br></div><div> > > + }<br></div><div> > > <br></div><div> > > default:<br></div><div> > > break;<br></div><div> > > @@ -2013,6 +2025,35 @@ static bool Control( input_thread_t *p_input,<br></div><div> > > demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,<br></div><div> > > vlc_es_id_GetInputId( <a rel="noreferrer" href="http://param.id">param.id</a> ) );<br></div><div> > > break;<br></div><div> > > + case INPUT_CONTROL_SET_ES_LIST:<br></div><div> > > + {<br></div><div> > > + if( es_out_Control( input_priv(p_input)->p_es_out_display,<br></div><div> > > + ES_OUT_SET_ES_LIST, <a rel="noreferrer" href="http://param.list.cat">param.list.cat</a>,<br></div><div> > > + param.list.ids ) == VLC_SUCCESS )<br></div><div> > > + {<br></div><div> > > + if( param.list.ids[0] != NULL && param.list.ids[1] == NULL )<br></div><div> > > + demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,<br></div><div> > > + vlc_es_id_GetInputId( param.list.ids[0] ) );<br></div><div> > <br></div><div> > If two tracks were selected previously and now we want to select a <br></div><div> > single track, is it OK to use DEMUX_SET_ES instead of DEMUX_SET_ES_LIST?<br></div><div> <br></div><div> For me, yes, I don't see any problem. DEMUX_SET_ES is like DEMUX_SET_ES_LIST for only one track.<br></div><div> <br></div><div> > <br></div><div> > DEMUX_SET_ES would then have to disable all ids except the given id. It <br></div><div> > looks like it won't cause any issues with the current demuxers because <br></div><div> > they seem to only support single selection, but it's inconsistent with <br></div><div> > how the ES selection works.<br></div><div> <br></div><div> Yes. How is it inconsistent ?<br></div></blockquote><div dir="auto"><br></div></div></div></div><div><div dir="auto" class="qt-gmail_quote"><div dir="auto">ES_OUT_SET_ES_LIST Will loop through all ES and deselect any currently selected ES in the same category if it’s not in the list.<br></div><div dir="auto"><br></div><div dir="auto">ES_OUT_SET_ES doesn’t do that. It only deselects one track and selects one. (Maybe this is the real problem - ES_OUT_SET_ES might need to be updated to use the same deselection as ES_OUT_SET_ES_LIST rather than using <span style="color:rgb(51, 51, 51)" class="colour"><span style="font-family:Menlo, "DejaVu Sans Mono", "Liberation Mono", Consolas, "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace" class="font"><span style="font-size:12.6px" class="size">p_main_es</span></span></span>)<br></div></div></div></blockquote><div><br></div><div>ES_OUT_SET_ES_LIST is called even when the list contain only one track.<br></div><div><br></div><div>Only the demux control DEMUX_SET_ES is called when the list have one track.<br></div><div><br></div><blockquote type="cite" id="qt"><div><div><div class="qt-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div><br></div><div><br></div><div>><br></div><div> > > + else<br></div><div> > > + {<br></div><div> > > + /* Send an array of int id from the array of es_id to the<br></div><div> > > + * demux */<br></div><div> > > + size_t count;<br></div><div> > > + for (count = 0; param.list.ids[count] != NULL; count++);<br></div><div> > > +<br></div><div> > > + int *ids = count ? vlc_alloc(count, sizeof(int)) : NULL;<br></div><div> > > + if (count == 0 || ids)<br></div><div> > > + {<br></div><div> > > + for (size_t i = 0; i < count; ++i)<br></div><div> > > + ids[i] = vlc_es_id_GetInputId(param.list.ids[i]);<br></div><div> > > + demux_Control(input_priv(p_input)->master->p_demux,<br></div><div> > > + DEMUX_SET_ES_LIST, count, ids);<br></div><div> > > + }<br></div><div> > > + free(ids);<br></div><div> > > + }<br></div><div> > > + }<br></div><div> > > + break;<br></div><div> > > + }<br></div><div> > > case INPUT_CONTROL_UNSET_ES:<br></div><div> > > es_out_Control( input_priv(p_input)->p_es_out_display,<br></div><div> > > ES_OUT_UNSET_ES, vlc_es_id_get_out(<a rel="noreferrer" href="http://param.id">param.id</a>) );<br></div><div> > > diff --git a/src/input/input_internal.h b/src/input/input_internal.h<br></div><div> > > index 3b2f5533e9..b159033b1c 100644<br></div><div> > > --- a/src/input/input_internal.h<br></div><div> > > +++ b/src/input/input_internal.h<br></div><div> > > @@ -434,6 +434,10 @@ typedef union<br></div><div> > > vlc_value_t val;<br></div><div> > > vlc_viewpoint_t viewpoint;<br></div><div> > > vlc_es_id_t *id;<br></div><div> > > + struct {<br></div><div> > > + enum es_format_category_e cat;<br></div><div> > > + vlc_es_id_t **ids;<br></div><div> > > + } list;<br></div><div> > > struct {<br></div><div> > > bool b_fast_seek;<br></div><div> > > vlc_tick_t i_val;<br></div><div> > > @@ -580,6 +584,7 @@ enum input_control_e<br></div><div> > > INPUT_CONTROL_RESTART_ES_BY_ID,<br></div><div> > > <br></div><div> > > INPUT_CONTROL_SET_ES,<br></div><div> > > + INPUT_CONTROL_SET_ES_LIST, // select a list of ES atomically<br></div><div> > > INPUT_CONTROL_UNSET_ES,<br></div><div> > > INPUT_CONTROL_RESTART_ES,<br></div><div> > > <br></div><div> > _______________________________________________<br></div><div> > vlc-devel mailing list<br></div><div> > To unsubscribe or modify your subscription options:<br></div><div> > <a rel="noreferrer" href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div><div> _______________________________________________<br></div><div> vlc-devel mailing list<br></div><div> To unsubscribe or modify your subscription options:<br></div><div> <a rel="noreferrer" href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote></div></div></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>