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

Thomas Guillem thomas at gllm.fr
Tue Feb 2 12:34:29 UTC 2021


It is used from the player, with the player lock held. There is only one client of the input_thread here : the player.
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.

On Tue, Feb 2, 2021, at 07:10, Rémi Denis-Courmont wrote:
> This looks racy if the input is being started.
> 
> Le 1 février 2021 17:52:23 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>> 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
>>   *
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20210202/d63c909a/attachment.html>


More information about the vlc-devel mailing list