[vlc-commits] input: Allow track autoselection to be enabled/disabled

Hugo Beauzée-Luyssen git at videolan.org
Tue Sep 24 14:34:21 CEST 2019


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Aug  7 14:46:42 2019 +0200| [f800fd9ee730410072613012015d89eec1e658cf] | committer: Hugo Beauzée-Luyssen

input: Allow track autoselection to be enabled/disabled

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

 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 8b8200285d..810f243a70 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3495,6 +3495,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 983e235917..655c7bb139 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2277,6 +2277,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 e69d76b381..723a0dbf50 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -435,6 +435,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
@@ -586,6 +590,8 @@ enum input_control_e
 
     INPUT_CONTROL_SET_VBI_PAGE,
     INPUT_CONTROL_SET_VBI_TRANSPARENCY,
+
+    INPUT_CONTROL_SET_ES_AUTOSELECT,
 };
 
 /* Internal helpers */



More information about the vlc-commits mailing list