[vlc-devel] [PATCH 2/4] input: add input_source_IsCatAutoselected

Thomas Guillem thomas at gllm.fr
Fri Feb 28 14:49:36 CET 2020


---
 src/input/input.c          | 9 +++++++++
 src/input/input_internal.h | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index 4955a499aa8..c40d79d48e6 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2821,6 +2821,12 @@ int input_source_GetNewAutoId( input_source_t *in )
     return in->auto_id++;
 }
 
+bool input_source_IsCatAutoselected( input_source_t *in,
+                                     enum es_format_category_e cat )
+{
+    return in->autoselect_cats[cat];
+}
+
 /*****************************************************************************
  * InputSourceDestroy:
  *****************************************************************************/
@@ -3379,6 +3385,9 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
     if( !p_source )
         return VLC_EGENERIC;
 
+    if( b_forced )
+        p_source->autoselect_cats[i_cat] = true;
+
     int ret = InputSourceInit( p_source, p_input, psz_uri,
                                psz_forced_demux,
                                b_can_fail || psz_forced_demux );
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 324f891eb84..18dead6d1ac 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -379,6 +379,7 @@ struct input_source_t
 
     char *str_id;
     int auto_id;
+    bool autoselect_cats[ES_CATEGORY_COUNT];
 
     /* Title infos for that input */
     bool         b_title_demux; /* Titles/Seekpoints provided by demux */
@@ -677,6 +678,12 @@ const char *input_source_GetStrId( input_source_t *in );
  */
 int input_source_GetNewAutoId( input_source_t *in );
 
+/**
+ * Returns true if a category should be auto-selected for a given source
+ */
+bool input_source_IsCatAutoselected( input_source_t *in,
+                                     enum es_format_category_e cat );
+
 /* Bound pts_delay */
 #define INPUT_PTS_DELAY_MAX VLC_TICK_FROM_SEC(60)
 
-- 
2.20.1



More information about the vlc-devel mailing list