<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>It is used from the player, with the player lock held. There is only one client of the input_thread here : the player.<br></div><div>Maybe I should document that it's not thread safe and that thread safety need to handled externally. This avoids adding one more locks and complicate everything.<br></div><div><br></div><div>On Tue, Feb 2, 2021, at 07:10, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt" style=""><div>This looks racy if the input is being started.<br></div><div><br></div><div class="qt-gmail_quote"><div>Le 1 février 2021 17:52:23 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div><blockquote class="qt-gmail_quote" style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;"><pre class="qt-k9mail"><div>Select a program id when the input thread is not running.<hr> src/input/input.c          | 17 +++++++++++++++++<br></div><div> src/input/input_internal.h |  8 ++++++++<br></div><div> 2 files changed, 25 insertions(+)<br></div><div><br></div><div>diff --git a/src/input/input.c b/src/input/input.c<br></div><div>index 0319505532..ea64473a0b 100644<br></div><div>--- a/src/input/input.c<br></div><div>+++ b/src/input/input.c<br></div><div>@@ -1814,6 +1814,23 @@ static void ControlInsertDemuxFilter( input_thread_t* p_input, const char* psz_d<br></div><div>         msg_Dbg(p_input, "Failed to create demux filter %s", psz_demux_chain);<br></div><div> }<br></div><div> <br></div><div>+void input_SetProgramId(input_thread_t *input, int group_id)<br></div><div>+<br></div><div>+{<br></div><div>+    input_thread_private_t *sys = input_priv(input);<br></div><div>+<br></div><div>+    if (!sys->is_running && !sys->is_stopped)<br></div><div>+    {<br></div><div>+        /* Not running, send the control synchronously since we are sure that<br></div><div>+         * it won't block */<br></div><div>+        es_out_Control(sys->p_es_out_display, ES_OUT_SET_GROUP, group_id);<br></div><div>+    }<br></div><div>+    else<br></div><div>+    {<br></div><div>+        input_ControlPushHelper(input, INPUT_CONTROL_SET_PROGRAM,<br></div><div>+                                &(vlc_value_t) { .i_int = group_id });<br></div><div>+    }<br></div><div>+}<br></div><div> <br></div><div> void input_SetEsCatIds(input_thread_t *input, enum es_format_category_e cat,<br></div><div>                        const char *str_ids)<br></div><div>diff --git a/src/input/input_internal.h b/src/input/input_internal.h<br></div><div>index 36b2e8428b..366bf0be3c 100644<br></div><div>--- a/src/input/input_internal.h<br></div><div>+++ b/src/input/input_internal.h<br></div><div>@@ -633,6 +633,14 @@ static inline int input_ControlPushEsHelper( input_thread_t *p_input, int i_type<br></div><div>     } );<br></div><div> }<br></div><div> <br></div><div>+/**<br></div><div>+ * Set the program id<br></div><div>+ *<br></div><div>+ * cf. ES_OUT_SET_GROUP<br></div><div>+ * This function can be called before start or while started.<br></div><div>+ */<br></div><div>+void input_SetProgramId(input_thread_t *input, int group_id);<br></div><div>+<br></div><div> /**<br></div><div>  * Set the list of string ids to enable for a category<br></div><div>  *<br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><br></div></body></html>