[vlc-devel] [PATCH 1/3] lib: media: Mandate an explicit destroy of thumbnail requests
Thomas Guillem
thomas at gllm.fr
Thu Oct 24 11:32:52 CEST 2019
OK for the set
On Thu, Oct 24, 2019, at 11:32, Hugo Beauzée-Luyssen wrote:
> ---
> include/vlc/libvlc_media.h | 16 ++++++++++++++--
> lib/libvlc.sym | 1 +
> lib/media.c | 6 ++++--
> 3 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
> index 6861181270..e64ecdb84c 100644
> --- a/include/vlc/libvlc_media.h
> +++ b/include/vlc/libvlc_media.h
> @@ -830,7 +830,8 @@ typedef enum libvlc_thumbnailer_seek_speed_t
> * \param timeout A timeout value in ms, or 0 to disable timeout
> *
> * \return A valid opaque request object, or NULL in case of failure.
> - * It must be released by libvlc_media_thumbnail_cancel().
> + * It may be cancelled by libvlc_media_thumbnail_cancel().
> + * It must be released by libvlc_media_thumbnail_destroy().
> *
> * \version libvlc 4.0 or later
> *
> @@ -860,7 +861,8 @@ libvlc_media_thumbnail_request_by_time( libvlc_media_t *md,
> * \param timeout A timeout value in ms, or 0 to disable timeout
> *
> * \return A valid opaque request object, or NULL in case of failure.
> - * It must be released by libvlc_media_thumbnail_cancel().
> + * It may be cancelled by libvlc_media_thumbnail_cancel().
> + * It must be released by libvlc_media_thumbnail_destroy().
> *
> * \version libvlc 4.0 or later
> *
> @@ -886,6 +888,16 @@ libvlc_media_thumbnail_request_by_pos( libvlc_media_t *md,
> LIBVLC_API void
> libvlc_media_thumbnail_cancel( libvlc_media_thumbnail_request_t *p_req );
>
> +/**
> + * @brief libvlc_media_thumbnail_destroy destroys a thumbnail request
> + * @param p_req An opaque thumbnail request object.
> + *
> + * If the request has not completed or hasn't been cancelled yet, the
> behavior
> + * is undefined
> + */
> +LIBVLC_API void
> +libvlc_media_thumbnail_destroy( libvlc_media_thumbnail_request_t
> *p_req );
> +
> /**
> * Add a slave to the current media.
> *
> diff --git a/lib/libvlc.sym b/lib/libvlc.sym
> index d1ee941cac..3a4870120d 100644
> --- a/lib/libvlc.sym
> +++ b/lib/libvlc.sym
> @@ -84,6 +84,7 @@ libvlc_media_get_parsed_status
> libvlc_media_thumbnail_request_by_time
> libvlc_media_thumbnail_request_by_pos
> libvlc_media_thumbnail_cancel
> +libvlc_media_thumbnail_destroy
> libvlc_media_list_add_media
> libvlc_media_list_count
> libvlc_media_list_event_manager
> diff --git a/lib/media.c b/lib/media.c
> index 8860a9e1aa..27df35b454 100644
> --- a/lib/media.c
> +++ b/lib/media.c
> @@ -1106,8 +1106,6 @@ static void media_on_thumbnail_ready( void* data,
> picture_t* thumbnail )
> libvlc_event_send( &p_media->event_manager, &event );
> if ( pic != NULL )
> libvlc_picture_release( pic );
> - libvlc_media_release( p_media );
> - free( req );
> }
>
> libvlc_media_thumbnail_request_t*
> @@ -1188,6 +1186,10 @@ void libvlc_media_thumbnail_cancel(
> libvlc_media_thumbnail_request_t *req )
> libvlc_priv_t *p_priv =
> libvlc_priv(req->md->p_libvlc_instance->p_libvlc_int);
> assert( p_priv->p_thumbnailer != NULL );
> vlc_thumbnailer_Cancel( p_priv->p_thumbnailer, req->req );
> +}
> +
> +void libvlc_media_thumbnail_destroy( libvlc_media_thumbnail_request_t
> *req )
> +{
> libvlc_media_release( req->md );
> free( req );
> }
> --
> 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