[vlc-commits] es_out: ask the source if a track should be autoselected

Thomas Guillem git at videolan.org
Fri Feb 28 20:46:56 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb 28 14:11:20 2020 +0100| [8a9dac6718f04f66704e04bd5ac260840a41441c] | committer: Thomas Guillem

es_out: ask the source if a track should be autoselected

It replaces the ugly i_last_es_cat hack.

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

 src/input/es_out.c         | 10 ++--------
 src/input/input.c          | 12 ------------
 src/input/input_internal.h |  4 ----
 3 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 8b5f9e6e2e..16463899f3 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1242,13 +1242,6 @@ static void EsOutSendEsEvent(es_out_t *out, es_out_id_t *es, int action,
     es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
     input_thread_t *p_input = p_sys->p_input;
 
-    if (action == VLC_INPUT_ES_ADDED)
-    {
-        input_thread_private_t *priv = input_priv(p_input);
-        /*FIXME: see input_SlaveSourceAdd */
-        priv->i_last_es_id = es->fmt.i_id;
-        priv->i_last_es_cat = es->fmt.i_cat;
-    }
     input_SendEventEs(p_input, &(struct vlc_input_event_es) {
         .action = action,
         .id = &es->id,
@@ -2452,7 +2445,8 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
             policy = ES_OUT_ES_POLICY_EXCLUSIVE;
     }
 
-    bool b_auto_selected = p_esprops->b_autoselect;
+    bool b_auto_selected = p_esprops->b_autoselect
+        || input_source_IsCatAutoselected( es->id.source, es->fmt.i_cat );
     bool b_auto_unselect = p_sys->i_mode == ES_OUT_MODE_AUTO &&
                            policy == ES_OUT_ES_POLICY_EXCLUSIVE &&
                            p_esprops->p_main_es && p_esprops->p_main_es != es;
diff --git a/src/input/input.c b/src/input/input.c
index c40d79d48e..4f8d70a8ca 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -330,8 +330,6 @@ static input_thread_t *Create( vlc_object_t *p_parent,
     else
         vlc_viewpoint_init( &priv->viewpoint );
 
-    priv->i_last_es_cat = UNKNOWN_ES;
-
     input_item_Hold( p_item ); /* Released in Destructor() */
     priv->p_item = p_item;
 
@@ -3379,8 +3377,6 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
     msg_Dbg( p_input, "loading %s slave: %s (forced: %d)",
              i_cat == SPU_ES ? "spu" : "audio", psz_uri, b_forced );
 
-    priv->i_last_es_cat = UNKNOWN_ES;
-
     input_source_t *p_source = InputSourceNew( psz_uri );
     if( !p_source )
         return VLC_EGENERIC;
@@ -3434,14 +3430,6 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
 
     TAB_APPEND( priv->i_slave, priv->slave, p_source );
 
-    if( !b_forced || priv->i_last_es_cat != i_cat )
-        return VLC_SUCCESS;
-
-    assert( priv->i_last_es_id != -1 );
-
-    es_out_SetEsDefaultById( priv->p_es_out_display, priv->i_last_es_id );
-    es_out_SetEsById( priv->p_es_out_display, priv->i_last_es_id, false );
-
     return VLC_SUCCESS;
 }
 
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 18dead6d1a..1391571eea 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -521,10 +521,6 @@ typedef struct input_thread_private_t
     input_source_t **slave;
     float          slave_subs_rate;
 
-    /* Last ES added */
-    enum es_format_category_e i_last_es_cat;
-    int                       i_last_es_id;
-
     /* Resources */
     input_resource_t *p_resource;
 



More information about the vlc-commits mailing list