[vlc-devel] [RFC PATCH 1/5] filter: add a way to signal error from callbacks

Thomas Guillem thomas at gllm.fr
Thu Feb 28 17:41:50 CET 2019



On Thu, Feb 28, 2019, at 17:00, Thomas Guillem wrote:
> TODO:
>  - document for video/spu
>  - Check if all filters are loaded with error = false
> ---
>  include/vlc_filter.h | 9 ++++++++-
>  src/misc/filter.c    | 1 +
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/include/vlc_filter.h b/include/vlc_filter.h
> index b2a8f871a4..4822de7771 100644
> --- a/include/vlc_filter.h
> +++ b/include/vlc_filter.h
> @@ -83,12 +83,19 @@ struct filter_t
>      /* Filter configuration */
>      config_chain_t *    p_cfg;
>  
> +    /** Set to true to signal an error from any callbacks */
> +    bool                error;

Using a signal_error() callback from filter_owner_t seems a better idea.
That way, only the owner has to deal with the error state. Especially since nothing prevent to call pf_filter() again after an error.

> +
>      union
>      {
>          /** Filter a picture (video filter) */
>          picture_t * (*pf_video_filter)( filter_t *, picture_t * );
>  
> -        /** Filter an audio block (audio filter) */
> +        /**
> +         * Filter an audio block (audio filter)A
> +         * @return a valid output block or NULL (if the module need more data
> +         * to output a block). Set filter_t.error to true to signal an error.
> +         */
>          block_t * (*pf_audio_filter)( filter_t *, block_t * );
>  
>          /** Blend a subpicture onto a picture (blend) */
> diff --git a/src/misc/filter.c b/src/misc/filter.c
> index 465677a12f..678b88965e 100644
> --- a/src/misc/filter.c
> +++ b/src/misc/filter.c
> @@ -148,6 +148,7 @@ int filter_ConfigureBlend( filter_t *p_blend,
>      p_blend->fmt_out.video.i_visible_width  = i_dst_width;
>      p_blend->fmt_out.video.i_height         =
>      p_blend->fmt_out.video.i_visible_height = i_dst_height;
> +    p_blend->error = false;
>  
>      /* */
>      if( !p_blend->p_module )
> -- 
> 2.20.1
> 
> _______________________________________________
> 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