[vlc-devel] [PATCHv2] Fix input variables

Laurent Aimar fenrir at elivagar.org
Wed Nov 24 10:30:07 CET 2010


Hi

On Wed, Nov 24, 2010 at 09:15:30AM +0100, Pierre Ynard wrote:
> The input resources create a dedicated parent object, and input
> variables are parsed and set on this object too.
 I don't think it is the job of the input_resource_t to do that, but of the one
creating an input.
 For example, in the current code, the parent wanted for normal playback is
probably the playlist.
 So if I understand your issue, you just need to create an parent object per
input in VLM and that should be enough.

> diff --git a/src/input/input.c b/src/input/input.c
> index 8a0e070..0a53028 100644
> --- a/src/input/input.c
> +++ b/src/input/input.c
> @@ -321,14 +321,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
>      if( !p_input->p )
>          return NULL;
>  
> -    /* Parse input options */
> -    vlc_mutex_lock( &p_item->lock );
> -    assert( (int)p_item->optflagc == p_item->i_options );
> -    for( i = 0; i < p_item->i_options; i++ )
> -        var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i],
> -                         !!(p_item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED) );
> -    vlc_mutex_unlock( &p_item->lock );
> -
>      p_input->b_preparsing = b_quick;
>      p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
>  
> @@ -396,6 +388,20 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
>      }
>      input_resource_SetInput( p_input->p->p_resource, p_input );
>  
> +    /* Parse input options */
> +    vlc_object_t *p_obj = input_resource_GetParent( p_input->p->p_resource );
> +    vlc_mutex_lock( &p_item->lock );
> +    assert( (int)p_item->optflagc == p_item->i_options );
> +    for( i = 0; i < p_item->i_options; i++ )
> +    {
> +        var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i],
> +                         !!(p_item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED) );
> +        var_OptionParse( p_obj, p_item->ppsz_options[i],
> +                         !!(p_item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED) );
> +    }
> +    vlc_mutex_unlock( &p_item->lock );
> +    vlc_object_release( p_obj );
 Thoses variables must be scoped by input and not reused from one input to the
other one (by  definition)...

Regards,

-- 
fenrir




More information about the vlc-devel mailing list