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