[vlc-devel] [PATCH] decoder: separate vout initialization from buffer allocation

Rémi Denis-Courmont remi at remlab.net
Thu Oct 30 10:48:19 CET 2014


Le 2014-10-30 11:35, Thomas Guillem a écrit :
> diff --git a/modules/stream_out/mosaic_bridge.c
> b/modules/stream_out/mosaic_bridge.c
> index ae20ef4..3930536 100644
> --- a/modules/stream_out/mosaic_bridge.c
> +++ b/modules/stream_out/mosaic_bridge.c
> @@ -602,21 +603,34 @@ static int Send( sout_stream_t *p_stream,
> sout_stream_id_sys_t *id,
>      return VLC_SUCCESS;
>  }
>
> +inline static int video_update_format_decoder( decoder_t *p_dec )
> +{
> +    return video_update_format( VLC_OBJECT( p_dec ),
> +                                (decoder_owner_sys_t 
> *)p_dec->p_owner,
> +                                &p_dec->fmt_out );
> +}
> +
>  inline static picture_t *video_new_buffer_decoder( decoder_t *p_dec 
> )
>  {
> -    return video_new_buffer( VLC_OBJECT( p_dec ),
> -                             (decoder_owner_sys_t *)p_dec->p_owner,
> -                             &p_dec->fmt_out );
> +    if( decoder_UpdateVideoFormat( p_dec ) ) {
> +        msg_Warn( p_dec, "can't get output picture" );
> +        return NULL;
> +    }

I would move that block to decoder_NewPicture(), as with 
decoder_NewAudioBuffer() as:
- the code is identical across all (four?) decoder front-ends,
and
- it paves the way for pf_vout_buffer_new to become reentrant for 
threaded decoders.

> +    return picture_NewFromFormat( &fmt_out->video );
>  }
>
>  inline static picture_t *video_new_buffer_filter( filter_t *p_filter 
> )
>  {
> -    return video_new_buffer( VLC_OBJECT( p_filter ),
> +    if( video_update_format( VLC_OBJECT( p_filter ),
>                               (decoder_owner_sys_t 
> *)p_filter->owner.sys,
> -                             &p_filter->fmt_out );
> +                             &p_filter->fmt_out ) ) {
> +        msg_Warn( p_filter, "can't get output picture" );
> +        return NULL;
> +    }
> +    return picture_NewFromFormat( &p_filter->fmt_out.video );
>  }
>
> -static picture_t *video_new_buffer( vlc_object_t *p_this,
> +static int video_update_format( vlc_object_t *p_this,
>                                      decoder_owner_sys_t *p_sys,
>                                      es_format_t *fmt_out )
>  {

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list