[vlmc-devel] R: [PATCH] Fix vlmc build
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Wed Nov 20 10:22:01 CET 2019
Hi,
Thanks a lot for contributing to VLMC! If you prefer, you can open some merge requests on the repo (but you'll need to send me your username privately so you can fork the repo beforehand)
On Tue, Nov 19, 2019, at 4:01 PM, Luni- 4 wrote:
>
> Please forget this patch, don't know why but my name got lost...
>
> *Da:* Vlmc-devel <vlmc-devel-bounces at videolan.org> per conto di Luni- 4
> <luni-4 at hotmail.it>
> *Inviato:* martedì 19 novembre 2019 15:55
> *A:* vlmc-devel at videolan.org <vlmc-devel at videolan.org>
> *Oggetto:* [vlmc-devel] [PATCH] Fix vlmc build
> Use the latest version of medialibrary to build vlmc
> ---
> src/Library/Library.cpp | 52 +++++++++++++++++++++++++------
> src/Library/Library.h | 23 +++++++++-----
> src/Library/MediaLibraryModel.cpp | 8 ++---
> src/Media/Media.cpp | 2 +-
> src/Media/Media.h | 1 +
> 5 files changed, 64 insertions(+), 22 deletions(-)
>
> diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
> index c7488fc0..b747b539 100644
> --- a/src/Library/Library.cpp
> +++ b/src/Library/Library.cpp
> @@ -218,13 +218,13 @@ Library::onMediaAdded(
> std::vector<medialibrary::MediaPtr> mediaList )
> }
>
> void
> -Library::onMediaUpdated( std::vector<medialibrary::MediaPtr> mediaList )
> +Library::onMediaModified( std::vector<int64_t> mediaList )
> {
> for ( auto m : mediaList )
> {
> QMetaObject::invokeMethod( m_model, "updateMedia",
> Qt::QueuedConnection,
> - Q_ARG( medialibrary::MediaPtr, m ) );
> + Q_ARG( int64_t, m ) );
> }
> }
>
> @@ -237,13 +237,18 @@ Library::onMediaDeleted( std::vector<int64_t> mediaList )
> Q_ARG( int64_t, id ) );
> }
>
> +void
> +Library::onMediaThumbnailReady( medialibrary::MediaPtr media,
> medialibrary::ThumbnailSizeType sizeType, bool success )
> +{
> +}
> +
> void
> Library::onArtistsAdded( std::vector<medialibrary::ArtistPtr> )
> {
> }
>
> void
> -Library::onArtistsModified( std::vector<medialibrary::ArtistPtr> )
> +Library::onArtistsModified( std::vector<int64_t> )
> {
> }
>
> @@ -258,7 +263,7 @@ Library::onAlbumsAdded(
> std::vector<medialibrary::AlbumPtr> )
> }
>
> void
> -Library::onAlbumsModified( std::vector<medialibrary::AlbumPtr> )
> +Library::onAlbumsModified( std::vector<int64_t> )
> {
> }
>
> @@ -289,7 +294,7 @@ Library::onDiscoveryProgress( const std::string&
> entryPoint )
> }
>
> void
> -Library::onDiscoveryCompleted( const std::string& entryPoint )
> +Library::onDiscoveryCompleted( const std::string& entryPoint, bool
> success )
> {
> if ( entryPoint.empty() == true )
> QMetaObject::invokeMethod( m_model, "refresh",
> @@ -310,7 +315,7 @@ Library::onPlaylistsAdded(
> std::vector<medialibrary::PlaylistPtr> )
> }
>
> void
> -Library::onPlaylistsModified( std::vector<medialibrary::PlaylistPtr> )
> +Library::onPlaylistsModified( std::vector<int64_t> )
> {
> }
>
> @@ -325,16 +330,21 @@ Library::onReloadStarted( const std::string& )
> }
>
> void
> -Library::onReloadCompleted( const std::string& entryPoint )
> +Library::onEntryPointAdded( const std::string& entryPoint, bool success )
> +{
> +}
> +
> +void
> +Library::onReloadCompleted( const std::string& entryPoint, bool success )
> {
> if ( entryPoint.empty() == true )
> {
> - for ( auto media : m_ml->videoFiles() )
> + for ( auto media : m_ml->videoFiles().get()->items(0, 0) )
That seems incorrect, the .get()-> is not needed, you can directly do videoFiles()->items(...)
And in addition to that, I'm not sure items(0,0) will return anything, since you're asking for 0 items at the offset 0
You could use all() though, which is more likely to do what you want
> QMetaObject::invokeMethod( m_model, "addMedia",
> Qt::QueuedConnection,
> Q_ARG( medialibrary::MediaPtr, media ) );
>
> - for ( auto media : m_ml->audioFiles() )
> + for ( auto media : m_ml->audioFiles().get()->items(0, 0) )
Same remark here
> QMetaObject::invokeMethod( m_model, "addMedia",
> Qt::QueuedConnection,
> Q_ARG( medialibrary::MediaPtr, media ) );
> @@ -359,5 +369,29 @@ Library::onEntryPointUnbanned( const std::string&, bool )
> void
> Library::onBackgroundTasksIdleChanged( bool )
> {
> +}
> +
> +void
> +Library::onGenresAdded( std::vector<medialibrary::GenrePtr> genres )
> +{
> +}
> +
> +void
> +Library::onGenresModified( std::vector<int64_t> genres )
> +{
> +}
> +
> +void
> +Library::onGenresDeleted( std::vector<int64_t> genreIds )
> +{
> +}
>
> +void
> +Library::onHistoryChanged( medialibrary::HistoryType type )
> +{
> +}
> +
> +void
> +Library::onRescanStarted( )
> +{
> }
> diff --git a/src/Library/Library.h b/src/Library/Library.h
> index b38f276a..1460c263 100644
> --- a/src/Library/Library.h
> +++ b/src/Library/Library.h
> @@ -84,29 +84,36 @@ private:
>
> private:
> virtual void onMediaAdded( std::vector<medialibrary::MediaPtr> media )
> override;
> - virtual void onMediaUpdated( std::vector<medialibrary::MediaPtr>
> media ) override;
> + virtual void onMediaModified( std::vector<int64_t> media ) override;
> virtual void onMediaDeleted( std::vector<int64_t> ids ) override;
> + virtual void onMediaThumbnailReady( medialibrary::MediaPtr media,
> medialibrary::ThumbnailSizeType sizeType, bool success ) override;
> virtual void onArtistsAdded( std::vector<medialibrary::ArtistPtr>
> artists ) override;
> - virtual void onArtistsModified( std::vector<medialibrary::ArtistPtr>
> artist ) override;
> + virtual void onArtistsModified( std::vector<int64_t> artist )
> override;
> virtual void onArtistsDeleted( std::vector<int64_t> ids ) override;
> virtual void onAlbumsAdded( std::vector<medialibrary::AlbumPtr> albums
> ) override;
> - virtual void onAlbumsModified( std::vector<medialibrary::AlbumPtr>
> albums ) override;
> + virtual void onAlbumsModified( std::vector<int64_t> albums )
> override;
> virtual void onAlbumsDeleted( std::vector<int64_t> ids ) override;
> - virtual void onTracksAdded( std::vector<medialibrary::AlbumTrackPtr>
> tracks ) override;
> - virtual void onTracksDeleted( std::vector<int64_t> trackIds )
> override;
> + virtual void onTracksAdded( std::vector<medialibrary::AlbumTrackPtr>
> tracks );
> + virtual void onTracksDeleted( std::vector<int64_t> trackIds );
> virtual void onDiscoveryStarted( const std::string& entryPoint )
> override;
> virtual void onDiscoveryProgress( const std::string& entryPoint )
> override;
> - virtual void onDiscoveryCompleted( const std::string& entryPoint )
> override;
> + virtual void onDiscoveryCompleted( const std::string& entryPoint,
> bool success ) override;
> virtual void onParsingStatsUpdated( uint32_t percent ) override;
> virtual void onPlaylistsAdded( std::vector<medialibrary::PlaylistPtr>
> playlists ) override;
> - virtual void onPlaylistsModified(
> std::vector<medialibrary::PlaylistPtr> playlists ) override;
> + virtual void onPlaylistsModified( std::vector<int64_t> playlists )
> override;
> virtual void onPlaylistsDeleted( std::vector<int64_t> playlistIds )
> override;
> virtual void onReloadStarted( const std::string& entryPoint ) override;
> - virtual void onReloadCompleted( const std::string& entryPoint )
> override;
> + virtual void onReloadCompleted( const std::string& entryPoint, bool
> success ) override;
> + virtual void onEntryPointAdded( const std::string& entryPoint, bool
> success ) override;
> virtual void onEntryPointRemoved( const std::string& entryPoint, bool
> success ) override;
> virtual void onEntryPointBanned( const std::string& entryPoint, bool
> success ) override;
> virtual void onEntryPointUnbanned( const std::string& entryPoint, bool
> success ) override;
> virtual void onBackgroundTasksIdleChanged( bool isIdle ) override;
> + virtual void onGenresAdded( std::vector<medialibrary::GenrePtr>
> genres ) override;
> + virtual void onGenresModified( std::vector<int64_t> genres )
> override;
> + virtual void onGenresDeleted( std::vector<int64_t> genreIds )
> override;
> + virtual void onHistoryChanged( medialibrary::HistoryType type )
> override;
> + virtual void onRescanStarted( ) override;
>
> private:
> std::unique_ptr<medialibrary::IMediaLibrary> m_ml;
> diff --git a/src/Library/MediaLibraryModel.cpp
> b/src/Library/MediaLibraryModel.cpp
> index ab0be056..876dae40 100644
> --- a/src/Library/MediaLibraryModel.cpp
> +++ b/src/Library/MediaLibraryModel.cpp
> @@ -95,10 +95,10 @@ QVariant MediaLibraryModel::data( const
> QModelIndex &index, int role ) const
> return QVariant( QUrl::fromPercentEncoding( QByteArray(
> m->title().c_str() ) ) );
> #ifdef WITH_GUI
> case Qt::DecorationRole:
> - return QPixmap( QString::fromStdString( m->thumbnail() ) );
> + return QPixmap( QString::fromStdString(
> m->thumbnailMrl(medialibrary::ThumbnailSizeType::Thumbnail) ) );
> #endif
> case Roles::ThumbnailPath:
> - return QVariant( QString::fromStdString( m->thumbnail() ) );
> + return QVariant( QString::fromStdString(
> m->thumbnailMrl(medialibrary::ThumbnailSizeType::Thumbnail) ) );
> case Roles::Duration:
> return QVariant::fromValue( m->duration() );
> case Roles::Id:
> @@ -126,8 +126,8 @@ MediaLibraryModel::roleNames() const
> void MediaLibraryModel::refresh()
> {
> beginResetModel();
> - const auto& audioFiles = m_ml.audioFiles();
> - const auto& videoFiles = m_ml.videoFiles();
> + const auto& audioFiles = m_ml.audioFiles().get()->items(0, 0);
> + const auto& videoFiles = m_ml.videoFiles().get()->items(0, 0);
And here :)
> m_media.insert( m_media.end(), audioFiles.begin(), audioFiles.end() );
> m_media.insert( m_media.end(), videoFiles.begin(), videoFiles.end() );
> endResetModel();
> diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
> index c5a28b90..edc75ec1 100644
> --- a/src/Media/Media.cpp
> +++ b/src/Media/Media.cpp
> @@ -205,7 +205,7 @@ Media::fromVariant( const QVariant& v )
> QString
> Media::snapshot()
> {
> - return QString::fromStdString( m_mlMedia->thumbnail() );
> + return QString::fromStdString(
> m_mlMedia->thumbnailMrl(medialibrary::ThumbnailSizeType::Thumbnail) );
> }
>
> QSharedPointer<Clip>
> diff --git a/src/Media/Media.h b/src/Media/Media.h
> index 4a4b6295..08aad5c2 100644
> --- a/src/Media/Media.h
> +++ b/src/Media/Media.h
> @@ -44,6 +44,7 @@
> #include "Backend/MLT/MLTInput.h"
>
> #include <medialibrary/IMedia.h>
> +#include <medialibrary/IMediaLibrary.h>
> #include <medialibrary/IFile.h>
>
> namespace Backend
Otherwise this looks good to me!
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the Vlmc-devel
mailing list