[vlc-commits] es_out: remove the final legacy variable usage
Thomas Guillem
git at videolan.org
Wed Jul 18 18:07:08 CEST 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 18 17:41:51 2018 +0200| [a750d50e8a39235d5af33671d478e926e54eb836] | committer: Thomas Guillem
es_out: remove the final legacy variable usage
Count ESes using the foreach_es_then_es_slaves() helper and add the "Disable"
track from legacy var callbacks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a750d50e8a39235d5af33671d478e926e54eb836
---
src/input/es_out.c | 24 +++++-------------------
src/input/var.c | 9 +++++++++
2 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 30e226de66..eb4f40f23b 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -924,7 +924,8 @@ static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id,
es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
input_thread_t *p_input = p_sys->p_input;
vlc_value_t text;
- size_t count;
+ es_out_id_t *es;
+ size_t count = 0;
if( b_delete )
{
@@ -936,24 +937,9 @@ static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id,
}
/* Get the number of ES already added */
- const char *psz_var;
- if( fmt->i_cat == AUDIO_ES )
- psz_var = "audio-es";
- else if( fmt->i_cat == VIDEO_ES )
- psz_var = "video-es";
- else
- psz_var = "spu-es";
-
- var_Change( p_input, psz_var, VLC_VAR_CHOICESCOUNT, &count );
- if( count == 0 )
- {
- vlc_value_t val2;
-
- /* First one, we need to add the "Disable" choice */
- val2.i_int = -1;
- var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, val2, _("Disable") );
- count++;
- }
+ foreach_es_then_es_slaves(es)
+ if( es->fmt.i_cat == fmt->i_cat )
+ count++;
/* Take care of the ES description */
if( fmt->psz_description && *fmt->psz_description )
diff --git a/src/input/var.c b/src/input/var.c
index 7a0e665031..9882b9e60a 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -307,8 +307,17 @@ void input_LegacyEvents( input_thread_t *p_input, void *user_data,
{
const char *varname = GetEsVarName( event->es.cat );
if( varname )
+ {
+ size_t count;
+ var_Change( p_input, varname, VLC_VAR_CHOICESCOUNT, &count );
+ if( count == 0 )
+ {
+ /* First one, we need to add the "Disable" choice */
+ VarListAdd( p_input, varname, -1, _("Disable") );
+ }
VarListAdd( p_input, varname, event->es.id,
event->es.title );
+ }
break;
}
case VLC_INPUT_ES_DELETED:
More information about the vlc-commits
mailing list