[vlc-commits] input: add a function to change str ids

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


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 20 15:33:54 2020 +0100| [e39882dc2b85b84632a2877484d7d984eac6e990] | committer: Thomas Guillem

input: add a function to change str ids

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

 src/input/input.c          | 27 +++++++++++++++++++++++++++
 src/input/input_internal.h | 15 +++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index 7f2f211fee..84cfee5a9a 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1619,6 +1619,9 @@ static void ControlRelease( int i_type, const input_control_param_t *p_param )
         free(p_param->list.ids);
         break;
     }
+    case INPUT_CONTROL_SET_ES_CAT_IDS:
+        free( p_param->cat_ids.str_ids );
+        break;
 
     default:
         break;
@@ -1825,6 +1828,26 @@ void input_ControlSync(input_thread_t *p_input, int i_type,
     Control( p_input, i_type, *param );
 }
 
+void input_SetEsCatIds(input_thread_t *input, enum es_format_category_e cat,
+                       const char *str_ids)
+{
+    input_thread_private_t *sys = input_priv(input);
+
+    if (!sys->is_running && !sys->is_stopped)
+    {
+        /* Not running, send the control synchronously since we are sure that
+         * it won't block */
+        es_out_SetEsCatIds(sys->p_es_out_display, cat, str_ids);
+    }
+    else
+    {
+        const input_control_param_t param = {
+            .cat_ids = { cat, str_ids ? strdup(str_ids) : NULL }
+        };
+        input_ControlPush(input, INPUT_CONTROL_SET_ES_CAT_IDS, &param);
+    }
+}
+
 static bool Control( input_thread_t *p_input,
                      int i_type, input_control_param_t param )
 {
@@ -2062,6 +2085,10 @@ static bool Control( input_thread_t *p_input,
         case INPUT_CONTROL_RESTART_ES:
             es_out_RestartEs( priv->p_es_out_display, param.id );
             break;
+        case INPUT_CONTROL_SET_ES_CAT_IDS:
+            es_out_SetEsCatIds( priv->p_es_out_display, param.cat_ids.cat,
+                                param.cat_ids.str_ids );
+            break;
 
         case INPUT_CONTROL_SET_VIEWPOINT:
         case INPUT_CONTROL_SET_INITIAL_VIEWPOINT:
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 3b36f8c8a3..2cc672f6ed 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -430,6 +430,11 @@ typedef union
         vlc_tick_t delay;
     } cat_delay;
     struct
+    {
+        enum es_format_category_e cat;
+        char *str_ids;
+    } cat_ids;
+    struct
     {
         vlc_es_id_t *id;
         vlc_tick_t delay;
@@ -578,6 +583,7 @@ enum input_control_e
     INPUT_CONTROL_SET_ES_LIST,  // select a list of ES atomically
     INPUT_CONTROL_UNSET_ES,
     INPUT_CONTROL_RESTART_ES,
+    INPUT_CONTROL_SET_ES_CAT_IDS,
 
     INPUT_CONTROL_SET_VIEWPOINT,    // new absolute viewpoint
     INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video)
@@ -636,6 +642,15 @@ static inline int input_ControlPushEsHelper( input_thread_t *p_input, int i_type
  */
 void input_ControlSync(input_thread_t *, int, const input_control_param_t *);
 
+/**
+ * Set the list of string ids to enable for a category
+ *
+ * cf. ES_OUT_SET_ES_CAT_IDS
+ * This function can be called before start or while started.
+ */
+void input_SetEsCatIds(input_thread_t *, enum es_format_category_e cat,
+                       const char *str_ids);
+
 bool input_Stopped( input_thread_t * );
 
 int input_GetAttachments(input_thread_t *input, input_attachment_t ***attachments);



More information about the vlc-commits mailing list