[vlc-devel] [PATCH 05/14] input: Allow track autoselection to be enabled/disabled

Hugo Beauzée-Luyssen hugo at beauzee.fr
Mon Sep 23 11:44:48 CEST 2019


---
 include/vlc_es_out.h       |  4 ++++
 src/input/es_out.c         | 20 ++++++++++++++++++++
 src/input/input.c          |  4 ++++
 src/input/input_internal.h |  6 ++++++
 4 files changed, 34 insertions(+)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 8ee4ef0be1..46dffa9846 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -112,6 +112,10 @@ enum es_out_query_e
     ES_OUT_SPU_SET_HIGHLIGHT, /* arg1= es_out_id_t* (spu es),
                                  arg2= const vlc_spu_highlight_t *, res=can fail  */
 
+    /* Disable autoselection of tracks from a given category */
+    ES_OUT_SET_AUTOSELECT,  /* arg1= int (es category),
+                               arg2= int (enabled/disabled), res=can fail */
+
     /* First value usable for private control */
     ES_OUT_PRIVATE_START = 0x10000,
 };
diff --git a/src/input/es_out.c b/src/input/es_out.c
index f663a1db4d..bbd4e83fb1 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3460,6 +3460,26 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
         }
         return ret;
     }
+    case ES_OUT_SET_AUTOSELECT:
+    {
+        int i_cat = va_arg( args, int );
+        bool b_enabled = va_arg( args, int );
+        switch ( i_cat )
+        {
+            case VIDEO_ES:
+                p_sys->video.b_autoselect = b_enabled;
+                break;
+            case AUDIO_ES:
+                p_sys->audio.b_autoselect = b_enabled;
+                break;
+            case SPU_ES:
+                p_sys->sub.b_autoselect = b_enabled;
+                break;
+            default:
+                return VLC_EGENERIC;
+        }
+        return VLC_SUCCESS;
+    }
     default:
         msg_Err( p_sys->p_input, "unknown query 0x%x in %s", i_query,
                  __func__  );
diff --git a/src/input/input.c b/src/input/input.c
index 8469d11920..abd84936b9 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2267,6 +2267,10 @@ static bool Control( input_thread_t *p_input,
                             param.vbi_transparency.id,
                             param.vbi_transparency.enabled );
             break;
+        case INPUT_CONTROL_SET_ES_AUTOSELECT:
+            es_out_Control( priv->p_es_out_display, ES_OUT_SET_AUTOSELECT,
+                            param.es_autoselect.cat, param.es_autoselect.enabled );
+            break;
 
         case INPUT_CONTROL_NAV_ACTIVATE:
         case INPUT_CONTROL_NAV_UP:
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 7a9bd1541e..23250e72c7 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -411,6 +411,10 @@ typedef union
         vlc_es_id_t *id;
         bool enabled;
     } vbi_transparency;
+    struct {
+        enum es_format_category_e cat;
+        bool enabled;
+    } es_autoselect;
 } input_control_param_t;
 
 typedef struct
@@ -561,6 +565,8 @@ enum input_control_e
 
     INPUT_CONTROL_SET_VBI_PAGE,
     INPUT_CONTROL_SET_VBI_TRANSPARENCY,
+
+    INPUT_CONTROL_SET_ES_AUTOSELECT,
 };
 
 /* Internal helpers */
-- 
2.20.1



More information about the vlc-devel mailing list