[vlc-devel] [PATCH] decoder: make AbortPictures() impl-dependant

Steve Lhomme robux4 at ycbcr.xyz
Tue Sep 24 11:44:13 CEST 2019


OK for me.

On 2019-09-24 11:23, Romain Vimont wrote:
> The API function decoder_AbortPictures() assumed a specific private
> implementation (the one from input/decoder.c), so calling it with
> another decoder implementation was undefined.
> 
> Instead, expose this function in decoder owner ops, and delegate the
> call to its specific implementation.
> ---
>   include/vlc_codec.h         | 2 ++
>   src/input/decoder.c         | 3 ++-
>   src/input/decoder_helpers.c | 7 +++++++
>   3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/include/vlc_codec.h b/include/vlc_codec.h
> index 28a65846d9..25e516c5f0 100644
> --- a/include/vlc_codec.h
> +++ b/include/vlc_codec.h
> @@ -53,6 +53,8 @@ struct decoder_owner_callbacks
>   
>               /* cf. decoder_NewPicture, can be called from any decoder thread */
>               picture_t*  (*buffer_new)( decoder_t * );
> +            /* cf. decoder_AbortPictures */
> +            void        (*abort_pictures)( decoder_t *, bool b_abort );
>               /* cf.decoder_QueueVideo */
>               void        (*queue)( decoder_t *, picture_t * );
>               /* cf.decoder_QueueCC */
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 57c9de6a1e..ffd0467680 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -767,7 +767,7 @@ static void RequestReload( struct decoder_owner *p_owner )
>       atomic_compare_exchange_strong( &p_owner->reload, &expected, RELOAD_DECODER );
>   }
>   
> -void decoder_AbortPictures( decoder_t *p_dec, bool b_abort )
> +static void DecoderThread_AbortPictures( decoder_t *p_dec, bool b_abort )
>   {
>       struct decoder_owner *p_owner = dec_get_owner( p_dec );
>   
> @@ -1703,6 +1703,7 @@ static const struct decoder_owner_callbacks dec_video_cbs =
>       .video = {
>           .format_update = ModuleThread_UpdateVideoFormat,
>           .buffer_new = ModuleThread_NewVideoBuffer,
> +        .abort_pictures = DecoderThread_AbortPictures,
>           .queue = ModuleThread_QueueVideo,
>           .queue_cc = ModuleThread_QueueCc,
>           .get_display_date = ModuleThread_GetDisplayDate,
> diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
> index 6d5b0050ed..d2c9a82c38 100644
> --- a/src/input/decoder_helpers.c
> +++ b/src/input/decoder_helpers.c
> @@ -93,6 +93,13 @@ picture_t *decoder_NewPicture( decoder_t *dec )
>       return dec->cbs->video.buffer_new( dec );
>   }
>   
> +void decoder_AbortPictures(decoder_t *dec, bool abort)
> +{
> +    vlc_assert(dec->fmt_in.i_cat == VIDEO_ES && dec->cbs);
> +    if (dec->cbs->video.abort_pictures)
> +        dec->cbs->video.abort_pictures(dec, abort);
> +}
> +
>   struct vlc_decoder_device_priv
>   {
>       struct vlc_decoder_device device;
> -- 
> 2.23.0
> 
> _______________________________________________
> 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