[vlc-commits] medialibrary: Bump contrib version & adapt to API changes

Hugo Beauzée-Luyssen git at videolan.org
Mon Dec 16 11:53:34 CET 2019


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Nov 15 16:05:46 2019 +0100| [c2bcb9952bf13574e3c0897e961068b4f7a9a8c4] | committer: Hugo Beauzée-Luyssen

medialibrary: Bump contrib version & adapt to API changes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c2bcb9952bf13574e3c0897e961068b4f7a9a8c4
---

 contrib/src/medialibrary/rules.mak        |  4 ++--
 include/vlc_media_library.h               |  2 --
 modules/misc/medialibrary/Thumbnailer.cpp |  6 +++---
 modules/misc/medialibrary/entities.cpp    | 21 ++++++++-------------
 modules/misc/medialibrary/medialib.cpp    | 15 ++++++++++-----
 modules/misc/medialibrary/medialibrary.h  |  6 +++---
 6 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/contrib/src/medialibrary/rules.mak b/contrib/src/medialibrary/rules.mak
index a868819a5a..096fce097e 100644
--- a/contrib/src/medialibrary/rules.mak
+++ b/contrib/src/medialibrary/rules.mak
@@ -1,4 +1,4 @@
-MEDIALIBRARY_HASH := a6a3bf2cf19fcff5c816ac478ad4086fa9ea4193
+MEDIALIBRARY_HASH := 3dddb7b13466930792bf10c27ece35943edefaaf
 MEDIALIBRARY_VERSION := git-$(MEDIALIBRARY_HASH)
 MEDIALIBRARY_GITURL := https://code.videolan.org/videolan/medialibrary.git
 
@@ -10,7 +10,7 @@ endif
 DEPS_medialibrary = sqlite $(DEPS_sqlite)
 
 $(TARBALLS)/medialibrary-$(MEDIALIBRARY_VERSION).tar.xz:
-	$(call download_git,$(MEDIALIBRARY_GITURL),0.6.x,$(MEDIALIBRARY_HASH))
+	$(call download_git,$(MEDIALIBRARY_GITURL),,$(MEDIALIBRARY_HASH))
 
 .sum-medialibrary: medialibrary-$(MEDIALIBRARY_VERSION).tar.xz
 	$(call check_githash,$(MEDIALIBRARY_HASH))
diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index 00227f46ba..81b4204ee3 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -39,8 +39,6 @@ typedef enum vlc_ml_media_type_t
     VLC_ML_MEDIA_TYPE_UNKNOWN,
     VLC_ML_MEDIA_TYPE_VIDEO,
     VLC_ML_MEDIA_TYPE_AUDIO,
-    VLC_ML_MEDIA_TYPE_EXTERNAL,
-    VLC_ML_MEDIA_TYPE_STREAM,
 } vlc_ml_media_type_t;
 
 typedef enum vlc_ml_media_subtype_t
diff --git a/modules/misc/medialibrary/Thumbnailer.cpp b/modules/misc/medialibrary/Thumbnailer.cpp
index 78968501ad..0a5aafe7f0 100644
--- a/modules/misc/medialibrary/Thumbnailer.cpp
+++ b/modules/misc/medialibrary/Thumbnailer.cpp
@@ -53,9 +53,9 @@ void Thumbnailer::onThumbnailComplete( void* data, picture_t* thumbnail )
     ctx->thumbnailer->m_cond.signal();
 }
 
-bool Thumbnailer::generate( const std::string& mrl, uint32_t desiredWidth,
-                            uint32_t desiredHeight, float position,
-                            const std::string& dest )
+bool Thumbnailer::generate( const medialibrary::IMedia&, const std::string& mrl,
+                            uint32_t desiredWidth, uint32_t desiredHeight,
+                            float position, const std::string& dest )
 {
     ThumbnailerCtx ctx{};
     auto item = vlc::wrap_cptr( input_item_New( mrl.c_str(), nullptr ),
diff --git a/modules/misc/medialibrary/entities.cpp b/modules/misc/medialibrary/entities.cpp
index ea4b402257..d41fb9632c 100644
--- a/modules/misc/medialibrary/entities.cpp
+++ b/modules/misc/medialibrary/entities.cpp
@@ -65,7 +65,8 @@ static bool convertThumbnails( const T input, vlc_ml_thumbnail_t *output )
     for ( auto i = 0u; i < VLC_ML_THUMBNAIL_SIZE_COUNT; ++i )
     {
         auto sizeType = static_cast<medialibrary::ThumbnailSizeType>( i );
-        if ( input->isThumbnailGenerated( sizeType ) == false )
+        if ( input->thumbnailStatus( sizeType ) !=
+             medialibrary::ThumbnailStatus::Available )
         {
             output[i].psz_mrl = nullptr;
             output[i].b_generated = false;
@@ -97,8 +98,8 @@ bool Convert( const medialibrary::IAlbumTrack* input, vlc_ml_album_track_t& outp
 
 bool Convert( const medialibrary::IShowEpisode* input, vlc_ml_show_episode_t& output )
 {
-    output.i_episode_nb = input->episodeNumber();
-    output.i_season_number = input->seasonNumber();
+    output.i_episode_nb = input->episodeId();
+    output.i_season_number = input->seasonId();
 
     if( !strdup_helper( input->shortSummary(), output.psz_summary ) ||
         !strdup_helper( input->tvdbId(), output.psz_tvdb_id ) )
@@ -226,14 +227,9 @@ bool Convert( const medialibrary::IMedia* input, vlc_ml_media_t& output )
             }
             break;
         }
-        case medialibrary::IMedia::Type::External:
-            output.i_type = VLC_ML_MEDIA_TYPE_EXTERNAL;
-            break;
-        case medialibrary::IMedia::Type::Stream:
-            output.i_type = VLC_ML_MEDIA_TYPE_STREAM;
-            break;
         case medialibrary::IMedia::Type::Unknown:
-            vlc_assert_unreachable();
+            output.i_type = VLC_ML_MEDIA_TYPE_UNKNOWN;
+            break;
     }
     output.i_year = input->releaseDate();
     output.i_duration = input->duration();
@@ -444,7 +440,8 @@ input_item_t* MediaToInputItem( const medialibrary::IMedia* media )
                                    VLC_TICK_FROM_MS( media->duration() ),
                                    ITEM_TYPE_FILE, ITEM_NET_UNKNOWN ),
                 &input_item_Release );
-    if ( media->isThumbnailGenerated( medialibrary::ThumbnailSizeType::Thumbnail ) == true )
+    auto thumbnailStatus = media->thumbnailStatus( medialibrary::ThumbnailSizeType::Thumbnail );
+    if ( thumbnailStatus == medialibrary::ThumbnailStatus::Missing )
     {
         auto thumbnail = media->thumbnailMrl( medialibrary::ThumbnailSizeType::Thumbnail );
         if ( thumbnail.length() > 0 )
@@ -452,8 +449,6 @@ input_item_t* MediaToInputItem( const medialibrary::IMedia* media )
     }
     switch ( media->type() )
     {
-        case medialibrary::IMedia::Type::External:
-        case medialibrary::IMedia::Type::Stream:
         case medialibrary::IMedia::Type::Unknown:
             // Those types are not analyzed
             break;
diff --git a/modules/misc/medialibrary/medialib.cpp b/modules/misc/medialibrary/medialib.cpp
index d1425dd049..2102b57787 100644
--- a/modules/misc/medialibrary/medialib.cpp
+++ b/modules/misc/medialibrary/medialib.cpp
@@ -706,10 +706,12 @@ int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_l
         {
             medialibrary::Query<medialibrary::IArtist> query;
             bool includeAll = va_arg( args, int ) != 0;
+            auto artistsIncluded = includeAll ? medialibrary::ArtistIncluded::All :
+                                                medialibrary::ArtistIncluded::AlbumArtistOnly;
             if ( psz_pattern != nullptr )
-                query = m_ml->searchArtists( psz_pattern, includeAll, paramsPtr );
+                query = m_ml->searchArtists( psz_pattern, artistsIncluded, paramsPtr );
             else
-                query = m_ml->artists( includeAll, paramsPtr );
+                query = m_ml->artists( artistsIncluded, paramsPtr );
             if ( query == nullptr )
                 return VLC_EGENERIC;
             auto res = ml_convert_list<vlc_ml_artist_list_t, vlc_ml_artist_t>(
@@ -721,10 +723,12 @@ int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_l
         {
             medialibrary::Query<medialibrary::IArtist> query;
             bool includeAll = va_arg( args, int ) != 0;
+            auto artistsIncluded = includeAll ? medialibrary::ArtistIncluded::All :
+                                                medialibrary::ArtistIncluded::AlbumArtistOnly;
             if ( psz_pattern != nullptr )
-                query = m_ml->searchArtists( psz_pattern, includeAll, paramsPtr );
+                query = m_ml->searchArtists( psz_pattern, artistsIncluded, paramsPtr );
             else
-                query = m_ml->artists( includeAll, paramsPtr );
+                query = m_ml->artists( artistsIncluded, paramsPtr );
             if ( query == nullptr )
                 return VLC_EGENERIC;
             *va_arg( args, size_t* ) = query->count();
@@ -1433,7 +1437,8 @@ int MediaLibrary::listGenre( int listQuery, const medialibrary::QueryParameters*
             if ( pattern != nullptr )
                 query = genre->searchTracks( pattern, paramsPtr );
             else
-                query = genre->tracks( false, paramsPtr );
+                query = genre->tracks( medialibrary::IGenre::TracksIncluded::All,
+                                       paramsPtr );
             if ( query == nullptr )
                 return VLC_EGENERIC;
             switch ( listQuery )
diff --git a/modules/misc/medialibrary/medialibrary.h b/modules/misc/medialibrary/medialibrary.h
index 0acbe10e38..5a63e83c09 100644
--- a/modules/misc/medialibrary/medialibrary.h
+++ b/modules/misc/medialibrary/medialibrary.h
@@ -115,9 +115,9 @@ class Thumbnailer : public medialibrary::IThumbnailer
     };
 public:
     Thumbnailer(vlc_medialibrary_module_t* ml);
-    virtual bool generate( const std::string& mrl, uint32_t desiredWidth,
-                           uint32_t desiredHeight, float position,
-                           const std::string& dest ) override;
+    virtual bool generate( const medialibrary::IMedia&, const std::string& mrl,
+                           uint32_t desiredWidth, uint32_t desiredHeight,
+                           float position, const std::string& dest ) override;
     virtual void stop() override;
 
 private:



More information about the vlc-commits mailing list