[vlc-devel] [PATCH 5/5] qt: medialib: use new requestThumbnail() API
Pierre Lamot
pierre at videolabs.io
Thu Jan 7 14:03:20 UTC 2021
On 2021-01-07 14:47, Romain Vimont wrote:
> On Thu, Jan 07, 2021 at 02:34:29PM +0100, Pierre Lamot wrote:
>> hum, the patch title doesn't match the content.
>
> It's not obvious from the diff, but the previous version called:
>
> Media::requestThumbnail(...)
>
> while the new version calls the new API:
>
> MediaLibrary::requestThumbnail(mediaId, ...)
>
> It is also moved because it's not in the function requiring to retrieve
> a Media instance anymore (controlMedia()).
I meant that the patch is not a Qt patch, it will affect other
interfaces using the vlc_ml_media_generate_thumbnail (OSX for instance)
>
>> 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* );
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> 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