[vlc-commits] input: add input_SetProgramId

Thomas Guillem git at videolan.org
Mon Feb 8 09:30:16 UTC 2021


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb  1 16:52:23 2021 +0100| [07b50f6db477c88230a7b45a0bf82d8dfb1c9879] | committer: Thomas Guillem

input: add input_SetProgramId

Select a program id when the input thread is not running.

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

 src/input/input.c          | 17 +++++++++++++++++
 src/input/input_internal.h |  9 +++++++++
 2 files changed, 26 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 7de662221d..7279fb0bec 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -633,6 +633,15 @@ 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.
+ * This function is not thread-safe, the caller should handle the locking.
+ */
+void input_SetProgramId(input_thread_t *input, int group_id);
+
 /**
  * Set the list of string ids to enable for a category
  *



More information about the vlc-commits mailing list