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

Rémi Denis-Courmont remi at remlab.net
Mon Dec 28 12:21:50 CET 2015


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.

> ---
>  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/


More information about the vlc-devel mailing list