[vlc-commits] es_out: remove a legacy variable usage

Thomas Guillem git at videolan.org
Wed Jul 18 18:07:06 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 18 17:01:19 2018 +0200| [cfea200c8c7596de07d9e4b7bb88f993015939be] | committer: Thomas Guillem

es_out: remove a legacy variable usage

The variables "video", "audio", and "spu" were reset to true only when an ES
was changed from "*-es" variables.

To fix this issue, add a new arg to the ES_OUT_SET_ES_BY_ID control that allow
to bypass initial user preferences regarding track selection.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cfea200c8c7596de07d9e4b7bb88f993015939be
---

 src/input/es_out.c | 14 ++++++++++++--
 src/input/es_out.h |  2 +-
 src/input/input.c  |  4 ++--
 src/input/var.c    |  6 ------
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 676e1816ce..1a894f3936 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -84,6 +84,7 @@ struct es_out_id_t
 
     /* */
     bool b_scrambled;
+    bool b_forced; /* if true, bypass variables when selecting this track */
 
     /* Channel in the track type */
     int         i_channel;
@@ -1562,6 +1563,7 @@ static es_out_id_t *EsOutAddSlave( es_out_t *out, const es_format_t *fmt, es_out
     es->i_id = es->fmt.i_id;
     es->i_meta_id = p_sys->i_id++; /* always incremented */
     es->b_scrambled = false;
+    es->b_forced = false;
 
     switch( es->fmt.i_cat )
     {
@@ -1741,7 +1743,12 @@ static void EsSelect( es_out_t *out, es_out_id_t *es )
     else
     {
         const bool b_sout = input_priv(p_input)->p_sout != NULL;
-        if( es->fmt.i_cat == VIDEO_ES || es->fmt.i_cat == SPU_ES )
+        if( es->b_forced )
+        {
+            /* ES specifically requested by the user: bypass the following vars
+             * check. */
+        }
+        else if( es->fmt.i_cat == VIDEO_ES || es->fmt.i_cat == SPU_ES )
         {
             if( !var_GetBool( p_input, b_sout ? "sout-video" : "video" ) )
             {
@@ -2677,7 +2684,10 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
 
         switch( i_query )
         {
-        case ES_OUT_SET_ES_BY_ID:         i_new_query = ES_OUT_SET_ES; break;
+        case ES_OUT_SET_ES_BY_ID:         i_new_query = ES_OUT_SET_ES;
+            if( i_id >= 0 )
+                p_es->b_forced = true;
+            break;
         case ES_OUT_RESTART_ES_BY_ID:     i_new_query = ES_OUT_RESTART_ES; break;
         case ES_OUT_SET_ES_DEFAULT_BY_ID: i_new_query = ES_OUT_SET_ES_DEFAULT; break;
         default:
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 8a3b2e5ea0..2976021ea1 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -45,7 +45,7 @@ enum es_out_query_private_e
     ES_OUT_GET_WAKE_UP,                             /* arg1=vlc_tick_t*            res=cannot fail */
 
     /* Wrapper for some ES command to work with id */
-    ES_OUT_SET_ES_BY_ID,
+    ES_OUT_SET_ES_BY_ID,                            /* arg1= int, arg2= bool (forced) */
     ES_OUT_RESTART_ES_BY_ID,
     ES_OUT_SET_ES_DEFAULT_BY_ID,
     ES_OUT_GET_ES_OBJECTS_BY_ID,                    /* arg1=int id, vlc_object_t **dec, vout_thread_t **, audio_output_t ** res=can fail*/
diff --git a/src/input/input.c b/src/input/input.c
index d542d53238..fe622bf81f 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2031,7 +2031,7 @@ static bool Control( input_thread_t *p_input,
         case INPUT_CONTROL_SET_ES:
             /* No need to force update, es_out does it if needed */
             es_out_Control( input_priv(p_input)->p_es_out_display,
-                            ES_OUT_SET_ES_BY_ID, (int)param.val.i_int );
+                            ES_OUT_SET_ES_BY_ID, (int)param.val.i_int, true );
 
             demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,
                     (int)param.val.i_int );
@@ -3303,7 +3303,7 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
         const int i_id = list[count].i_int;
 
         es_out_Control( input_priv(p_input)->p_es_out_display, ES_OUT_SET_ES_DEFAULT_BY_ID, i_id );
-        es_out_Control( input_priv(p_input)->p_es_out_display, ES_OUT_SET_ES_BY_ID, i_id );
+        es_out_Control( input_priv(p_input)->p_es_out_display, ES_OUT_SET_ES_BY_ID, i_id, false );
     }
     free(list);
 
diff --git a/src/input/var.c b/src/input/var.c
index 3202429932..7a0e665031 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -975,8 +975,6 @@ static int EsVideoCallback( vlc_object_t *p_this, char const *psz_cmd,
 
     if( newval.i_int < 0 )
         newval.i_int = -VIDEO_ES; /* disable video es */
-    else
-        var_SetBool( p_input, "video", true );
 
     input_ControlPushHelper( p_input, INPUT_CONTROL_SET_ES, &newval );
 
@@ -991,8 +989,6 @@ static int EsAudioCallback( vlc_object_t *p_this, char const *psz_cmd,
 
     if( newval.i_int < 0 )
         newval.i_int = -AUDIO_ES; /* disable audio es */
-    else
-        var_SetBool( p_input, "audio", true );
 
     input_ControlPushHelper( p_input, INPUT_CONTROL_SET_ES, &newval );
 
@@ -1007,8 +1003,6 @@ static int EsSpuCallback( vlc_object_t *p_this, char const *psz_cmd,
 
     if( newval.i_int < 0 )
         newval.i_int = -SPU_ES; /* disable spu es */
-    else
-        var_SetBool( p_input, "spu", true );
 
     input_ControlPushHelper( p_input, INPUT_CONTROL_SET_ES, &newval );
 



More information about the vlc-commits mailing list