[vlc-devel] [PATCH] [RFC] playlist: broadcast the input_thread_t about to be started for a chance to alter it

Steve Lhomme robux4 at gmail.com
Wed Dec 30 09:57:43 CET 2015


On Mon, Dec 28, 2015 at 12:21 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2015-12-23 23:32, Steve Lhomme a écrit :
>>
>> --
>> deprecates https://patches.videolan.org/patch/10518/
>
>
> I still don't see the point.
>
> On the one hand, this patch does not really seem to add any functionality,
> that the playlist would not already expose in some way. On the other hand,
> it seems likely to be abused solely for breaking the MVC model, and thus
> break multiple simultaneous control interfaces.
>
> And lastly, as we have already experienced with input-current, this type of
> hook is a recipe for deadlocks.

The idea of this patch is the same as for "input-current" but since
the latter is already tied to other modules it's better to live it
untouched.

This new variable allows changing the decoding parameters by a module
before input_Start() is called. In my case setting the proper
Chromecast streaming parameters according to the source/recipient.
There is no deadlock because it doesn't wait for anything.

This approach has limits though. Using multiple "changers" means
depending on the order the modules are loaded (or callback hook set)
the output may differ.

>> ---
>>  src/playlist/engine.c | 1 +
>>  src/playlist/thread.c | 4 ++++
>>  2 files changed, 5 insertions(+)
>>
>> diff --git a/src/playlist/engine.c b/src/playlist/engine.c
>> index 6000a37..971667c 100644
>> --- a/src/playlist/engine.c
>> +++ b/src/playlist/engine.c
>> @@ -450,6 +450,7 @@ static void VariablesInit( playlist_t *p_playlist )
>>      var_Create( p_playlist, "playlist-item-append", VLC_VAR_ADDRESS );
>>
>>      var_Create( p_playlist, "input-current", VLC_VAR_ADDRESS );
>> +    var_Create( p_playlist, "input-prepare", VLC_VAR_ADDRESS );
>>
>>      /* Variables to control playback */
>>      var_Create( p_playlist, "playlist-autostart", VLC_VAR_BOOL |
>> VLC_VAR_DOINHERIT );
>> diff --git a/src/playlist/thread.c b/src/playlist/thread.c
>> index a348479..4fd7580 100644
>> --- a/src/playlist/thread.c
>> +++ b/src/playlist/thread.c
>> @@ -207,6 +207,9 @@ static bool PlayItem( playlist_t *p_playlist,
>> playlist_item_t *p_item )
>>
>>      input_thread_t *p_input_thread = input_Create( p_playlist,
>> p_input, NULL,
>>
>> p_sys->p_input_resource );
>> +
>> +    var_SetAddress( p_playlist, "input-prepare", p_input_thread );
>> +
>>      if( likely(p_input_thread != NULL) )
>>      {
>>          var_AddCallback( p_input_thread, "intf-event",
>> @@ -451,6 +454,7 @@ static void LoopInput( playlist_t *p_playlist )
>>          PL_DEBUG( "dead input" );
>>          PL_UNLOCK;
>>
>> +        var_SetAddress( p_playlist, "input-prepare", NULL );
>>          var_SetAddress( p_playlist, "input-current", NULL );
>>
>>          /* WARNING: Input resource manipulation and callback deletion are
>
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list