[vlc-devel] [PATCH 3/5] input: add input_SetProgramId

Thomas Guillem thomas at gllm.fr
Mon Feb 1 15:52:23 UTC 2021


Select a program id when the input thread is not running.
---
 src/input/input.c          | 17 +++++++++++++++++
 src/input/input_internal.h |  8 ++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index 0319505532..ea64473a0b 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1814,6 +1814,23 @@ static void ControlInsertDemuxFilter( input_thread_t* p_input, const char* psz_d
         msg_Dbg(p_input, "Failed to create demux filter %s", psz_demux_chain);
 }
 
+void input_SetProgramId(input_thread_t *input, int group_id)
+
+{
+    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_Control(sys->p_es_out_display, ES_OUT_SET_GROUP, group_id);
+    }
+    else
+    {
+        input_ControlPushHelper(input, INPUT_CONTROL_SET_PROGRAM,
+                                &(vlc_value_t) { .i_int = group_id });
+    }
+}
 
 void input_SetEsCatIds(input_thread_t *input, enum es_format_category_e cat,
                        const char *str_ids)
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 36b2e8428b..366bf0be3c 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -633,6 +633,14 @@ static inline int input_ControlPushEsHelper( input_thread_t *p_input, int i_type
     } );
 }
 
+/**
+ * Set the program id
+ *
+ * cf. ES_OUT_SET_GROUP
+ * This function can be called before start or while started.
+ */
+void input_SetProgramId(input_thread_t *input, int group_id);
+
 /**
  * Set the list of string ids to enable for a category
  *
-- 
2.29.2



More information about the vlc-devel mailing list