[vlc-devel] [PATCH 5/5] qt: medialib: use new requestThumbnail() API
Pierre Lamot
pierre at videolabs.io
Thu Jan 7 13:34:29 UTC 2021
hum, the patch title doesn't match the content.
On 2021-01-07 14:24, Romain Vimont wrote:
> A new medialibrary API has been added to request asynchronous thumbnail
> generation from a media id:
> https://code.videolan.org/videolan/medialibrary/-/merge_requests/350
>
> This avoids to retrieve a Media from the media id beforehand via a
> blocking call (executing SQL queries) on the UI thread.
> ---
> modules/misc/medialibrary/medialibrary.cpp | 23 +++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/modules/misc/medialibrary/medialibrary.cpp
> b/modules/misc/medialibrary/medialibrary.cpp
> index 1d7a12547c..6c4583f66e 100644
> --- a/modules/misc/medialibrary/medialibrary.cpp
> +++ b/modules/misc/medialibrary/medialibrary.cpp
> @@ -598,13 +598,24 @@ int MediaLibrary::Control( int query, va_list
> args )
> *va_arg( args, vlc_ml_media_t**) =
> CreateAndConvert<vlc_ml_media_t>( media.get() );
> return VLC_SUCCESS;
> }
> + case VLC_ML_MEDIA_GENERATE_THUMBNAIL:
> + {
> + auto mediaId = va_arg( args, int64_t );
> + auto sizeType = va_arg( args, int );
> + auto width = va_arg( args, uint32_t );
> + auto height = va_arg( args, uint32_t );
> + auto position = va_arg( args, double );
> + auto res = m_ml->requestThumbnail( mediaId,
> +
> static_cast<medialibrary::ThumbnailSizeType>( sizeType ),
> + width, height, position
> );
> + return res == true ? VLC_SUCCESS : VLC_EGENERIC;
> + }
> case VLC_ML_MEDIA_UPDATE_PROGRESS:
> case VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE:
> case VLC_ML_MEDIA_SET_MEDIA_PLAYBACK_STATE:
> case VLC_ML_MEDIA_GET_ALL_MEDIA_PLAYBACK_STATES:
> case VLC_ML_MEDIA_SET_ALL_MEDIA_PLAYBACK_STATES:
> case VLC_ML_MEDIA_SET_THUMBNAIL:
> - case VLC_ML_MEDIA_GENERATE_THUMBNAIL:
> case VLC_ML_MEDIA_ADD_EXTERNAL_MRL:
> case VLC_ML_MEDIA_SET_TYPE:
> case VLC_ML_MEDIA_ADD_BOOKMARK:
> @@ -1228,16 +1239,6 @@ int MediaLibrary::controlMedia( int query,
> va_list args )
> m->setThumbnail( mrl,
> static_cast<medialibrary::ThumbnailSizeType>( sizeType ) );
> return VLC_SUCCESS;
> }
> - case VLC_ML_MEDIA_GENERATE_THUMBNAIL:
> - {
> - auto sizeType = va_arg( args, int );
> - auto width = va_arg( args, uint32_t );
> - auto height = va_arg( args, uint32_t );
> - auto position = va_arg( args, double );
> - auto res = m->requestThumbnail(
> static_cast<medialibrary::ThumbnailSizeType>( sizeType ),
> - width, height, position );
> - return res == true ? VLC_SUCCESS : VLC_EGENERIC;
> - }
> case VLC_ML_MEDIA_ADD_EXTERNAL_MRL:
> {
> auto mrl = va_arg( args, const char* );
More information about the vlc-devel
mailing list