Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
670b58ec by Alaric Senat at 2024-03-30T17:41:04+00:00
meson: medialibrary: require a minimum version

The medialibrary module wouldn't compile with a medialibrary inferior to
0.12.

- - - - -
d4f6fdcf by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: rename playlist filtering types

These needs to be more explicit to match the actual medialibrary
behavior. Currently, filtering asking for video or audio playlists will
return playlists that contain exclusively the designated entity type.

The next medialibrary release introduce new filtering types allowing
finer filtering.

- - - - -
33065d57 by Alaric Senat at 2024-03-30T17:41:04+00:00
macosx: medialibrary: fix queryParameters default init

Use the API default initializer instead of zero initialization. Some
fields might be defaulted to non-zero values in the future versions of
the medialibrary.

- - - - -
6acce514 by Alaric Senat at 2024-03-30T17:41:04+00:00
qt: medialibrary: fix queryParameters default init

Use the API default initializer instead of zero initialization. Some
fields might be defaulted to non-zero values in the future versions of
the medialibrary.

- - - - -
5c55afb7 by Alaric Senat at 2024-03-30T17:41:04+00:00
lua: medialibrary: fix queryParameters default init

Use the API default initializer instead of zero initialization. Some
fields might be defaulted to non-zero values in the future versions of
the medialibrary.

- - - - -
ac5c1d17 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: add query parameter documentation

- - - - -
edd72e8f by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: fix integer comparison signedness warning

../../modules/misc/medialibrary/MetadataExtractor.cpp:139:25: warning: 
comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ 
{aka ‘long unsigned int’} [-Wsign-compare]
  139 |     for ( auto i = 0; i < inputItem->es_vec.size; ++i )
      |                       ~~^~~~~~~~~~~~~~~~~~~~~~~~

- - - - -
b5c36b75 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: update to 0.13 API changes

- - - - -
87a6c3bc by Alaric Senat at 2024-03-30T17:41:04+00:00
contrib: medialibrary: update to 0.13

This release brings a new set of features:

* Podcast and subscriptions first iteration. **The implementation is
  still unstable but the data structures and API is ready**
* Media caching
* New `duration` accessor in `IFolder`
* New private/public state for content exposing
* Playlist API refining
* Add new playlist filtering types: `Video` and `Audio`
* Implement favorites in all containers
* Implement an `favoriteOnly` QueryParameter to filter non-favorite
  items
* Implement better history accesses and cleanup methods
* Implement QueryParameter support for history access
* Notify media creation even for external media

- - - - -
ab1dd267 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: history: allow clearing via import type

This feature was added in medialibrary 0.13.

- - - - -
2d2ded73 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: history: unify stream and global wrappers

To reflect the 0.13 medialibrary public API. The network/local/global
histories can be fetched by a single call now.

- - - - -
d848ce86 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: history: rework listing by media type

To reflect the latest changes in medialibrary 0.13. There is a listing
function for both audio and video now. This avoids bad combinations of
mediatype and history type.

- - - - -
1d092818 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: propagate query parameters for history listing

QueryParameters are supported for history listing since medialibrary
0.13.

- - - - -
99b6c691 by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: folder: expose the duration field

- - - - -
bbd81d4c by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: playlist: expose new listing options

MediaLibrary 0.13 allows to list and search on playlist that contains at
least one element of a certain media type.

This is mostly useful to consider playlists with at least one audio file
to be treated as music playlists.

- - - - -
9394e7ea by Alaric Senat at 2024-03-30T17:41:04+00:00
medialibrary: expose `favorite_only` QueryParameter

Allow favorite only listing on various medialibrary objects.

- - - - -


27 changed files:

- configure.ac
- + contrib/src/medialibrary/Fix-CacheWorker.patch
- contrib/src/medialibrary/SHA512SUMS
- contrib/src/medialibrary/rules.mak
- include/vlc_media_library.h
- modules/gui/macosx/library/VLCLibraryController.m
- modules/gui/macosx/library/VLCLibraryModel.m
- modules/gui/qt/medialibrary/medialib.cpp
- modules/gui/qt/medialibrary/mlbasemodel.cpp
- modules/gui/qt/medialibrary/mlbookmarkmodel.cpp
- modules/gui/qt/medialibrary/mlcustomcover.cpp
- modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp
- modules/gui/qt/medialibrary/mlqueryparams.cpp
- modules/gui/qt/medialibrary/mlrecentsmodel.cpp
- modules/gui/qt/medialibrary/mlrecentsvideomodel.cpp
- modules/gui/qt/medialibrary/mlurlmodel.cpp
- modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp
- modules/lua/libs/medialibrary.c
- modules/misc/medialibrary/MetadataExtractor.cpp
- modules/misc/medialibrary/entities.cpp
- modules/misc/medialibrary/fs/directory.cpp
- modules/misc/medialibrary/fs/file.cpp
- modules/misc/medialibrary/fs/file.h
- modules/misc/medialibrary/medialibrary.cpp
- modules/misc/medialibrary/medialibrary.h
- modules/misc/meson.build
- share/lua/README.txt


Changes:

=====================================
configure.ac
=====================================
@@ -4556,7 +4556,7 @@ dnl Libnotify notification plugin
 dnl
 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify], [libnotify notification], 
[auto])
 
-PKG_ENABLE_MODULES_VLC([MEDIALIBRARY], [medialibrary], [medialibrary >= 
0.12.0], (medialibrary support), [auto])
+PKG_ENABLE_MODULES_VLC([MEDIALIBRARY], [medialibrary], [medialibrary >= 
0.13.0], (medialibrary support), [auto])
 
 dnl
 dnl  Endianness check


=====================================
contrib/src/medialibrary/Fix-CacheWorker.patch
=====================================
@@ -0,0 +1,87 @@
+From ab1de729b73138b1a7b6dfa5e17a6a63063dd2ab Mon Sep 17 00:00:00 2001
+From: Alaric Senat <ala...@videolabs.io>
+Date: Wed, 27 Mar 2024 11:42:57 +0100
+Subject: [PATCH] CacheWorker: Fail when the cache implementation isn't
+ provided
+
+Allow the library users not to provide an implementation for the cacher.
+---
+ src/CacheWorker.cpp | 20 ++++++++++++++------
+ src/CacheWorker.h   |  2 +-
+ 2 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/src/CacheWorker.cpp b/src/CacheWorker.cpp
+index 0b08267a..06b1dfa7 100644
+--- a/src/CacheWorker.cpp
++++ b/src/CacheWorker.cpp
+@@ -58,14 +58,22 @@ void CacheWorker::setCacher( std::shared_ptr<ICacher> 
cacher )
+     m_cacher = std::move( cacher );
+ }
+ 
+-void CacheWorker::queueTask( std::shared_ptr<Media> m, bool cache )
++bool CacheWorker::queueTask( std::shared_ptr<Media> m, bool cache )
+ {
+     std::lock_guard<compat::Mutex> lock{ m_mutex };
++
++    if ( m_cacher == nullptr )
++    {
++        LOG_WARN( "Cache implementation not provided" );
++        return false;
++    }
++
+     m_tasks.emplace( std::move( m ), cache );
+     if ( m_thread.joinable() == false )
+         m_thread = compat::Thread{ &CacheWorker::run, this };
+     else
+         m_cond.notify_all();
++    return true;
+ }
+ 
+ bool CacheWorker::cacheMedia( std::shared_ptr<Media> m )
+@@ -78,8 +86,7 @@ bool CacheWorker::cacheMedia( std::shared_ptr<Media> m )
+         LOG_DEBUG( "Media ", m->id(), " is already cached" );
+         return true;
+     }
+-    queueTask( std::move( m ), true );
+-    return true;
++    return queueTask( std::move( m ), true );
+ }
+ 
+ bool CacheWorker::removeCached( std::shared_ptr<Media> m )
+@@ -92,8 +99,7 @@ bool CacheWorker::removeCached( std::shared_ptr<Media> m )
+         LOG_DEBUG( "Media ", m->id(), " is not cached" );
+         return false;
+     }
+-    queueTask( std::move( m ), false );
+-    return true;
++    return queueTask( std::move( m ), false );
+ }
+ 
+ void CacheWorker::cacheSubscriptions()
+@@ -117,7 +123,9 @@ void CacheWorker::resume()
+ 
+ void CacheWorker::stop()
+ {
+-    m_cacher->interrupt();
++    if ( m_cacher != nullptr )
++        m_cacher->interrupt();
++
+     {
+         std::lock_guard<compat::Mutex> lock{ m_mutex };
+         if ( m_thread.joinable() == false )
+diff --git a/src/CacheWorker.h b/src/CacheWorker.h
+index 57088c92..01e33c0c 100644
+--- a/src/CacheWorker.h
++++ b/src/CacheWorker.h
+@@ -73,7 +73,7 @@ private:
+     void checkCache();
+     bool removeFromCache( const std::string& mrl );
+     bool evictIfNeeded( const File& file, Subscription* s, IFile::CacheType 
cacheType );
+-    void queueTask( std::shared_ptr<Media> m, bool cache );
++    bool queueTask( std::shared_ptr<Media> m, bool cache );
+     uint64_t availableSubscriptionCacheSize() const;
+     uint64_t availableCacheSize() const;
+ 
+-- 
+2.43.0
+


=====================================
contrib/src/medialibrary/SHA512SUMS
=====================================
@@ -1 +1 @@
-2b9e9eb5000fd8ff333d29786c3c8ed9f2e2541cd34652b7087ea0fb6b46bfb354472e20dad7c53c159dd447882427e61233ef6224ad5902bedff37756fd950a
  medialibrary-0.12.4.tar.bz2
+e2a75a1c59c899a7a8828e6b8bf7e106f50ad896e42f3888ab6a9423eddcdde75f4889120781f303a30d182421cf179698e0a5c968d8b0523d5a874274428289
  medialibrary-0.13.0.tar.bz2


=====================================
contrib/src/medialibrary/rules.mak
=====================================
@@ -1,8 +1,8 @@
-MEDIALIBRARY_VERSION := 0.12.4
+MEDIALIBRARY_VERSION := 0.13.0
 MEDIALIBRARY_URL := 
https://code.videolan.org/videolan/medialibrary/-/archive/$(MEDIALIBRARY_VERSION)/medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2
 
 PKGS += medialibrary
-ifeq ($(call need_pkg,"medialibrary >= 0.12.0"),)
+ifeq ($(call need_pkg,"medialibrary >= 0.13.0"),)
 PKGS_FOUND += medialibrary
 endif
 
@@ -15,6 +15,7 @@ $(TARBALLS)/medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2:
 
 medialibrary: medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2 .sum-medialibrary
        $(UNPACK)
+       $(APPLY) $(SRC)/medialibrary/Fix-CacheWorker.patch
        $(MOVE)
 
 .medialibrary: medialibrary crossfile.meson


=====================================
include/vlc_media_library.h
=====================================
@@ -87,15 +87,18 @@ typedef enum vlc_ml_thumbnail_status_t
 
 typedef enum vlc_ml_history_type_t
 {
-    VLC_ML_HISTORY_TYPE_MEDIA,
+    VLC_ML_HISTORY_TYPE_GLOBAL,
+    VLC_ML_HISTORY_TYPE_LOCAL,
     VLC_ML_HISTORY_TYPE_NETWORK,
 } vlc_ml_history_type_t;
 
 typedef enum vlc_ml_playlist_type_t
 {
-    VLC_ML_PLAYLIST_TYPE_ALL,
-    VLC_ML_PLAYLIST_TYPE_AUDIO,
-    VLC_ML_PLAYLIST_TYPE_VIDEO,
+    VLC_ML_PLAYLIST_TYPE_ALL,        /**< Playlist containing any kind of 
tracks */
+    VLC_ML_PLAYLIST_TYPE_AUDIO,      /**< Playlist containing at least one 
audio track */
+    VLC_ML_PLAYLIST_TYPE_VIDEO,      /**< Playlist containing at least one 
video track */
+    VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY, /**< Playlist containing audio tracks 
only */
+    VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY, /**< Playlist containing video tracks 
only */
 } vlc_ml_playlist_type_t;
 
 typedef struct vlc_ml_thumbnail_t
@@ -374,6 +377,7 @@ typedef struct vlc_ml_folder_t
     unsigned int i_nb_media; /**< The media count */
     unsigned int i_nb_video; /**< The number of video for this folder */
     unsigned int i_nb_audio; /**< The number of audio for this volder */
+    int64_t i_duration; /**< The sum of all the member durations of the folder 
in ms. */
     bool b_present; /**< The folder's presence state */
     bool b_banned; /**< Will be true if the user required this folder to be 
excluded */
 } vlc_ml_folder_t;
@@ -426,15 +430,20 @@ typedef enum vlc_ml_sorting_criteria_t
     VLC_ML_SORTING_TRACKNUMBER,
 } vlc_ml_sorting_criteria_t;
 
-typedef struct vlc_ml_query_params_t vlc_ml_query_params_t;
-struct vlc_ml_query_params_t
+/**
+ * Generic parameter set for medialibrary queries.
+ *
+ * \warning Should only be default instanciated with 
::vlc_ml_query_params_create().
+ */
+typedef struct vlc_ml_query_params_t
 {
     const char* psz_pattern;
     uint32_t i_nbResults;
     uint32_t i_offset;
     vlc_ml_sorting_criteria_t i_sort;
     bool b_desc;
-};
+    bool b_favorite_only;
+} vlc_ml_query_params_t;
 
 enum vlc_ml_get_queries
 {
@@ -471,12 +480,12 @@ enum vlc_ml_list_queries
     VLC_ML_COUNT_GROUPS,          /**< arg1 (out): size_t*                     
                                         */
     VLC_ML_LIST_PLAYLISTS,        /**< arg1 (out): vlc_ml_playlist_list_t**    
                                         */
     VLC_ML_COUNT_PLAYLISTS,       /**< arg1 (out): size_t*                     
                                         */
-    VLC_ML_LIST_HISTORY,          /**< arg1 (out): vlc_ml_media_list_t**       
                                         */
-    VLC_ML_COUNT_HISTORY,         /**< arg1 (out): size_t*                     
                                         */
-    VLC_ML_LIST_HISTORY_BY_TYPE,  /**< arg1 vlc_ml_media_type_t: the media 
type. arg2 (out): vlc_ml_media_list_t**      */
-    VLC_ML_COUNT_HISTORY_BY_TYPE, /**< arg1 vlc_ml_media_type_t: the media 
type. arg2 (out): vlc_ml_media_list_t**      */
-    VLC_ML_LIST_STREAM_HISTORY,   /**< arg1 (out): vlc_ml_media_list_t**       
                                         */
-    VLC_ML_COUNT_STREAM_HISTORY,  /**< arg1 (out): size_t*                     
                                         */
+    VLC_ML_LIST_HISTORY,          /**< arg1 vlc_ml_history_type_t; arg2 (out): 
vlc_ml_media_list_t**                    */
+    VLC_ML_COUNT_HISTORY,         /**< arg1 vlc_ml_history_type_t; arg2 (out): 
size_t*                                  */
+    VLC_ML_LIST_VIDEO_HISTORY,    /**< arg1 (out): vlc_ml_media_list_t**       
                                         */
+    VLC_ML_COUNT_VIDEO_HISTORY,   /**< arg1 (out): vlc_ml_media_list_t**       
                                         */
+    VLC_ML_LIST_AUDIO_HISTORY,    /**< arg1 (out): vlc_ml_media_list_t**       
                                         */
+    VLC_ML_COUNT_AUDIO_HISTORY,   /**< arg1 (out): vlc_ml_media_list_t**       
                                         */
     VLC_ML_LIST_ENTRY_POINTS,     /**< arg1 bool: list_banned; arg2 (out): 
vlc_ml_folder_list_t**                       */
     VLC_ML_COUNT_ENTRY_POINTS,    /**< arg1 bool: list_banned; arg2 (out): 
size_t*                                      */
     VLC_ML_LIST_FOLDERS,          /**< arg1 (out): vlc_ml_folder_list_t**      
                                         */
@@ -572,7 +581,7 @@ enum vlc_ml_control
     VLC_ML_RESUME_BACKGROUND,       /**< no args; can't fail */
 
     /* Misc operations */
-    VLC_ML_CLEAR_HISTORY,           /**< no args; can't fail */
+    VLC_ML_CLEAR_HISTORY,           /**< arg1: vlc_ml_history_type_t; can't 
fail */
 
     /* Create media */
     VLC_ML_NEW_EXTERNAL_MEDIA,      /**< arg1: const char*; arg2(out): 
vlc_ml_media_t** */
@@ -771,7 +780,7 @@ enum vlc_ml_event_type
     /**
      * Sent after the history gets changed. It can be either cleaned, or simply
      * modified because a media was recently played/removed from the history.
-     * The history type (media/network) is stored in
+     * The history type (global/local/network) is stored in
      * vlc_ml_event_t::history_changed::history_type
      */
     VLC_ML_EVENT_HISTORY_CHANGED,
@@ -1011,9 +1020,9 @@ static inline int vlc_ml_resume_background( 
vlc_medialibrary_t* p_ml )
     return vlc_ml_control( p_ml, VLC_ML_RESUME_BACKGROUND );
 }
 
-static inline int vlc_ml_clear_history( vlc_medialibrary_t* p_ml )
+static inline int vlc_ml_clear_history( vlc_medialibrary_t* p_ml, 
vlc_ml_history_type_t type )
 {
-    return vlc_ml_control( p_ml, VLC_ML_CLEAR_HISTORY );
+    return vlc_ml_control( p_ml, VLC_ML_CLEAR_HISTORY, type );
 }
 
 static inline vlc_ml_media_t* vlc_ml_new_external_media( vlc_medialibrary_t* 
p_ml, const char* psz_mrl )
@@ -1668,59 +1677,56 @@ static inline size_t vlc_ml_count_media_labels( 
vlc_medialibrary_t* p_ml, const
     return count;
 }
 
-static inline vlc_ml_media_list_t* vlc_ml_list_history( vlc_medialibrary_t* 
p_ml, const vlc_ml_query_params_t* params )
+static inline vlc_ml_media_list_t* vlc_ml_list_history( vlc_medialibrary_t* 
p_ml, const vlc_ml_query_params_t* params, vlc_ml_history_type_t type )
 {
     vlc_assert( p_ml != NULL );
     vlc_ml_media_list_t* res;
-    if ( vlc_ml_list( p_ml, VLC_ML_LIST_HISTORY, params, &res ) != VLC_SUCCESS 
)
+    if ( vlc_ml_list( p_ml, VLC_ML_LIST_HISTORY, params, (int)type, &res ) != 
VLC_SUCCESS )
         return NULL;
     return res;
 }
 
-static inline size_t vlc_ml_count_history( vlc_medialibrary_t* p_ml, const 
vlc_ml_query_params_t* params )
+static inline size_t vlc_ml_count_history( vlc_medialibrary_t* p_ml, const 
vlc_ml_query_params_t* params, vlc_ml_history_type_t type )
 {
     vlc_assert( p_ml != NULL );
     size_t count;
-    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_HISTORY, params, &count ) != 
VLC_SUCCESS )
+    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_HISTORY, params, (int)type, &count ) 
!= VLC_SUCCESS )
         return 0;
     return count;
 }
 
-
-static inline vlc_ml_media_list_t* vlc_ml_list_history_by_type( 
vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params, 
vlc_ml_media_type_t type  )
+static inline vlc_ml_media_list_t* vlc_ml_list_video_history( 
vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
 {
     vlc_assert( p_ml != NULL );
     vlc_ml_media_list_t* res;
-    if ( vlc_ml_list( p_ml, VLC_ML_LIST_HISTORY_BY_TYPE, params, (int)type, 
&res ) != VLC_SUCCESS )
+    if ( vlc_ml_list( p_ml, VLC_ML_LIST_VIDEO_HISTORY, params, &res ) != 
VLC_SUCCESS )
         return NULL;
     return res;
 }
 
-static inline size_t vlc_ml_count_history_by_type( vlc_medialibrary_t* p_ml, 
const vlc_ml_query_params_t* params, vlc_ml_media_type_t type )
+static inline size_t vlc_ml_count_video_history( vlc_medialibrary_t* p_ml, 
const vlc_ml_query_params_t* params )
 {
     vlc_assert( p_ml != NULL );
     size_t count;
-    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_HISTORY_BY_TYPE, params, (int)type, 
&count ) != VLC_SUCCESS )
+    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_VIDEO_HISTORY, params, &count ) != 
VLC_SUCCESS )
         return 0;
     return count;
 }
 
-
-
-static inline vlc_ml_media_list_t* vlc_ml_list_stream_history( 
vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
+static inline vlc_ml_media_list_t* vlc_ml_list_audio_history( 
vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
 {
     vlc_assert( p_ml != NULL );
     vlc_ml_media_list_t* res;
-    if ( vlc_ml_list( p_ml, VLC_ML_LIST_STREAM_HISTORY, params, &res ) != 
VLC_SUCCESS )
+    if ( vlc_ml_list( p_ml, VLC_ML_LIST_AUDIO_HISTORY, params, &res ) != 
VLC_SUCCESS )
         return NULL;
     return res;
 }
 
-static inline size_t vlc_ml_count_stream_history( vlc_medialibrary_t* p_ml, 
const vlc_ml_query_params_t* params )
+static inline size_t vlc_ml_count_audio_history( vlc_medialibrary_t* p_ml, 
const vlc_ml_query_params_t* params )
 {
     vlc_assert( p_ml != NULL );
     size_t count;
-    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_STREAM_HISTORY, params, &count ) != 
VLC_SUCCESS )
+    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_AUDIO_HISTORY, params, &count ) != 
VLC_SUCCESS )
         return 0;
     return count;
 }


=====================================
modules/gui/macosx/library/VLCLibraryController.m
=====================================
@@ -170,7 +170,7 @@ typedef int (*folder_action_f)(vlc_medialibrary_t*, const 
char*);
     if (!_p_libraryInstance) {
         return VLC_EACCES;
     }
-    return vlc_ml_clear_history(_p_libraryInstance);
+    return vlc_ml_clear_history(_p_libraryInstance, 
VLC_ML_HISTORY_TYPE_GLOBAL);
 }
 
 - (void)sortByCriteria:(enum vlc_ml_sorting_criteria_t)sortCriteria 
andDescending:(bool)descending


=====================================
modules/gui/macosx/library/VLCLibraryModel.m
=====================================
@@ -211,7 +211,7 @@ static void libraryCallback(void *p_data, const 
vlc_ml_event_t *p_event)
                                          object:nil];
 
         dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 
0), ^{
-            const vlc_ml_query_params_t queryParameters = {};
+            vlc_ml_query_params_t queryParameters = 
vlc_ml_query_params_create();
 
             // Preload video and audio count for gui
             self->_initialVideoCount = 
vlc_ml_count_video_media(self->_p_mediaLibrary, &queryParameters);
@@ -219,8 +219,10 @@ static void libraryCallback(void *p_data, const 
vlc_ml_event_t *p_event)
             self->_initialAlbumCount = 
vlc_ml_count_albums(self->_p_mediaLibrary, &queryParameters);
             self->_initialArtistCount = 
vlc_ml_count_artists(self->_p_mediaLibrary, &queryParameters, true);
             self->_initialGenreCount = 
vlc_ml_count_genres(self->_p_mediaLibrary, &queryParameters);
-            self->_initialRecentsCount = 
vlc_ml_count_history_by_type(self->_p_mediaLibrary, &((vlc_ml_query_params_t){ 
.i_nbResults = self->_recentMediaLimit }), VLC_ML_MEDIA_TYPE_VIDEO);
-            self->_initialRecentAudioCount = 
vlc_ml_count_history_by_type(self->_p_mediaLibrary, &((vlc_ml_query_params_t){ 
.i_nbResults = self->_recentMediaLimit }), VLC_ML_MEDIA_TYPE_AUDIO);
+
+            queryParameters.i_nbResults = self->_recentMediaLimit;
+            self->_initialRecentsCount = 
vlc_ml_count_video_history(self->_p_mediaLibrary, &queryParameters);
+            self->_initialRecentAudioCount = 
vlc_ml_count_audio_history(self->_p_mediaLibrary, &queryParameters);
         });
     }
     return self;
@@ -468,7 +470,12 @@ static void libraryCallback(void *p_data, const 
vlc_ml_event_t *p_event)
     dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
         const vlc_ml_query_params_t queryParameters = { .i_nbResults = 
countLimit };
         // we don't set the sorting criteria here as they are not applicable 
to history
-        vlc_ml_media_list_t *p_media_list = 
vlc_ml_list_history_by_type(self->_p_mediaLibrary, &queryParameters, type);
+        vlc_ml_media_list_t *p_media_list = NULL;
+        if (type == VLC_ML_MEDIA_TYPE_VIDEO)
+            p_media_list = vlc_ml_list_video_history(self->_p_mediaLibrary, 
&queryParameters);
+        else if (type == VLC_ML_MEDIA_TYPE_AUDIO)
+            p_media_list = vlc_ml_list_audio_history(self->_p_mediaLibrary, 
&queryParameters);
+
         NSArray * const mediaArray = [NSArray 
arrayFromVlcMediaList:p_media_list];
         if (mediaArray == nil) {
             return;


=====================================
modules/gui/qt/medialibrary/medialib.cpp
=====================================
@@ -84,8 +84,7 @@ static void convertMLItemToPlaylistMedias(vlc_medialibrary_t* 
ml, const MLItemId
     }
     else
     {
-        vlc_ml_query_params_t query;
-        memset(&query, 0, sizeof(vlc_ml_query_params_t));
+        vlc_ml_query_params_t query = vlc_ml_query_params_create();
         ml_unique_ptr<vlc_ml_media_list_t> media_list(vlc_ml_list_media_of( 
ml, &query, itemId.type, itemId.id));
         if (media_list == nullptr || media_list->i_nb_items == 0)
             return;
@@ -345,8 +344,7 @@ void MediaLib::mlInputItem(const QVector<MLItemId>& 
itemIdVector, QJSValue callb
             {
                 ml_unique_ptr<vlc_ml_media_list_t> list;
 
-                vlc_ml_query_params_t query;
-                memset(&query, 0, sizeof(vlc_ml_query_params_t));
+                vlc_ml_query_params_t query = vlc_ml_query_params_create();
 
                 list.reset(vlc_ml_list_media_of(ml, &query, mlId.type, 
mlId.id));
 


=====================================
modules/gui/qt/medialibrary/mlbasemodel.cpp
=====================================
@@ -606,10 +606,9 @@ MLListCacheLoader::MLOp::MLOp(MLItemId parentId, QString 
searchPattern, vlc_ml_s
 
 vlc_ml_query_params_t MLListCacheLoader::MLOp::getQueryParams(size_t offset, 
size_t limit) const
 {
-    vlc_ml_query_params_t params;
-    params.psz_pattern = m_searchPattern.isNull()
-                             ? nullptr
-                             : m_searchPattern.constData();
+    vlc_ml_query_params_t params = vlc_ml_query_params_create();
+    if (!m_searchPattern.isNull())
+        params.psz_pattern = m_searchPattern.constData();
     params.i_nbResults = limit;
     params.i_offset = offset;
     params.i_sort = m_sort;


=====================================
modules/gui/qt/medialibrary/mlbookmarkmodel.cpp
=====================================
@@ -404,7 +404,7 @@ void MLBookmarkModel::updateMediaId(uint64_t revision, 
const QString mediaUri)
             ctx.newMLid = mlMedia->i_id;
             vlc_ml_release( mlMedia );
         }
-        vlc_ml_query_params_t params{};
+        vlc_ml_query_params_t params = vlc_ml_query_params_create();
         params.i_sort = sort;
         params.b_desc = desc;
         ctx.newBookmarks.reset( vlc_ml_list_media_bookmarks( ml, &params, 
ctx.newMLid ) );
@@ -447,7 +447,7 @@ void 
MLBookmarkModel::refresh(MLBookmarkModel::RefreshOperation forceClear )
         //ML thread
         [mediaId, sort = m_sort, desc = m_desc]
         (vlc_medialibrary_t* ml, Ctx& ctx) {
-            vlc_ml_query_params_t params{};
+            vlc_ml_query_params_t params = vlc_ml_query_params_create();
             params.i_sort = sort;
             params.b_desc = desc;
             ctx.newBookmarks.reset( vlc_ml_list_media_bookmarks( ml, &params, 
mediaId ) );


=====================================
modules/gui/qt/medialibrary/mlcustomcover.cpp
=====================================
@@ -127,7 +127,7 @@ QStringList getGenreMediaThumbnails(vlc_medialibrary_t* 
p_ml, const int count, c
 {
     QStringList thumbnails;
 
-    vlc_ml_query_params_t params {};
+    vlc_ml_query_params_t params = vlc_ml_query_params_create();
 
     // NOTE: We retrieve twice the count to maximize our chances to get a 
valid thumbnail.
     params.i_nbResults = count * 2;
@@ -143,7 +143,7 @@ ThumbnailList 
extractChildMediaThumbnailsOrIDs(vlc_medialibrary_t *p_ml, const i
 {
     ThumbnailList result;
 
-    vlc_ml_query_params_t params {};
+    vlc_ml_query_params_t params = vlc_ml_query_params_create();
 
     // NOTE: We retrieve twice the count to maximize our chances to get a 
valid thumbnail.
     params.i_nbResults = count * 2;


=====================================
modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp
=====================================
@@ -48,8 +48,7 @@ const int PLAYLIST_COVERY = 2;
 
 void appendMediaIntoPlaylist(vlc_medialibrary_t* ml, int64_t playlistId, const 
std::vector<MLItemId>& itemList)
 {
-    vlc_ml_query_params_t query;
-    memset(&query, 0, sizeof(vlc_ml_query_params_t));
+    vlc_ml_query_params_t query = vlc_ml_query_params_create();
 
     for (auto itemId : itemList)
     {
@@ -463,9 +462,9 @@ static inline vlc_ml_playlist_type_t 
qmlToMLPlaylistType(MLPlaylistListModel::Pl
     case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_ALL:
         return VLC_ML_PLAYLIST_TYPE_ALL;
     case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_AUDIO:
-        return VLC_ML_PLAYLIST_TYPE_AUDIO;
+        return VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY;
     case MLPlaylistListModel::PlaylistType::PLAYLIST_TYPE_VIDEO:
-        return VLC_ML_PLAYLIST_TYPE_VIDEO;
+        return VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY;
     default:
         vlc_assert_unreachable();
     }


=====================================
modules/gui/qt/medialibrary/mlqueryparams.cpp
=====================================
@@ -2,10 +2,9 @@
 
 vlc_ml_query_params_t MLQueryParams::toCQueryParams() const
 {
-    vlc_ml_query_params_t params;
-    params.psz_pattern = searchPatternUtf8.isNull()
-                       ? nullptr
-                       : searchPatternUtf8.constData();
+    vlc_ml_query_params_t params = vlc_ml_query_params_create();
+    if (!searchPatternUtf8.isNull())
+        params.psz_pattern = searchPatternUtf8.constData();
     params.i_nbResults = nbResults;
     params.i_offset = offset;
     params.i_sort = sort;


=====================================
modules/gui/qt/medialibrary/mlrecentsmodel.cpp
=====================================
@@ -76,7 +76,7 @@ void MLRecentsModel::clearHistory()
     m_mediaLib->runOnMLThread(this,
     //ML thread
     [](vlc_medialibrary_t* ml){
-        vlc_ml_clear_history(ml);
+        vlc_ml_clear_history(ml, VLC_ML_HISTORY_TYPE_GLOBAL);
     });
 }
 
@@ -103,14 +103,14 @@ MLRecentsModel::createMLLoader() const
 
 size_t MLRecentsModel::Loader::count(vlc_medialibrary_t* ml, const 
vlc_ml_query_params_t* queryParams) const
 {
-    return vlc_ml_count_history( ml, queryParams );
+    return vlc_ml_count_history( ml, queryParams, VLC_ML_HISTORY_TYPE_GLOBAL );
 }
 
 std::vector<std::unique_ptr<MLItem>>
 MLRecentsModel::Loader::load(vlc_medialibrary_t* ml, const 
vlc_ml_query_params_t* queryParams) const
 {
     ml_unique_ptr<vlc_ml_media_list_t> media_list{ vlc_ml_list_history(
-                ml, queryParams ) };
+                ml, queryParams, VLC_ML_HISTORY_TYPE_GLOBAL ) };
     if ( media_list == nullptr )
         return {};
 


=====================================
modules/gui/qt/medialibrary/mlrecentsvideomodel.cpp
=====================================
@@ -52,14 +52,14 @@ void MLRecentsVideoModel::onVlcMlEvent(const MLEvent & 
event) /* override */
 
 size_t MLRecentsVideoModel::Loader::count(vlc_medialibrary_t* ml, const 
vlc_ml_query_params_t* queryParams) const /* override */
 {
-    return vlc_ml_count_history_by_type(ml, queryParams, 
VLC_ML_MEDIA_TYPE_VIDEO);
+    return vlc_ml_count_video_history(ml, queryParams);
 }
 
 std::vector<std::unique_ptr<MLItem>>
 MLRecentsVideoModel::Loader::load(vlc_medialibrary_t* ml, const 
vlc_ml_query_params_t* queryParams) const /* override */
 {
     ml_unique_ptr<vlc_ml_media_list_t> media_list {
-        vlc_ml_list_history_by_type(ml, queryParams, VLC_ML_MEDIA_TYPE_VIDEO)
+        vlc_ml_list_video_history(ml, queryParams)
     };
 
     if (media_list == nullptr)


=====================================
modules/gui/qt/medialibrary/mlurlmodel.cpp
=====================================
@@ -164,14 +164,14 @@ MLUrlModel::createMLLoader() const
 
 size_t MLUrlModel::Loader::count(vlc_medialibrary_t* ml, const 
vlc_ml_query_params_t* queryParams) const
 {
-    return vlc_ml_count_stream_history( ml, queryParams );
+    return vlc_ml_count_history( ml, queryParams, VLC_ML_HISTORY_TYPE_NETWORK 
);
 }
 
 std::vector<std::unique_ptr<MLItem>>
 MLUrlModel::Loader::load(vlc_medialibrary_t* ml, const vlc_ml_query_params_t* 
queryParams) const
 {
     ml_unique_ptr<vlc_ml_media_list_t> media_list;
-    media_list.reset( vlc_ml_list_stream_history(ml, queryParams) );
+    media_list.reset( vlc_ml_list_history(ml, queryParams, 
VLC_ML_HISTORY_TYPE_NETWORK) );
     if ( media_list == nullptr )
         return {};
 


=====================================
modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp
=====================================
@@ -256,9 +256,7 @@ MLVideoGroupsModel::Loader::load(vlc_medialibrary_t* ml,
         // NOTE: When it's a group of one we convert it to a MLVideo.
         if (group.i_nb_total_media == 1)
         {
-            vlc_ml_query_params_t query;
-
-            memset(&query, 0, sizeof(vlc_ml_query_params_t));
+            vlc_ml_query_params_t query = vlc_ml_query_params_create();
 
             ml_unique_ptr<vlc_ml_media_list_t> list(vlc_ml_list_group_media(ml,
                                                                             
&query, group.i_id));


=====================================
modules/lua/libs/medialibrary.c
=====================================
@@ -248,16 +248,16 @@ static int vlclua_ml_list_show( lua_State* L, 
vlc_ml_show_list_t* list )
 
 static void vlclua_ml_assign_params( lua_State *L, vlc_ml_query_params_t 
*params, uint8_t paramIndex )
 {
+    *params = vlc_ml_query_params_create();
     if (!lua_istable(L, paramIndex))
-    {
-        memset(params, 0, sizeof(*params));
         return;
-    }
+    lua_getfield(L, 1, "favorite_only" );
     lua_getfield(L, 1, "limit" );
     lua_getfield(L, 1, "offset" );
     lua_getfield(L, 1, "desc" );
     lua_getfield(L, 1, "sort" );
     lua_getfield(L, 1, "pattern" );
+    params->b_favorite_only = lua_toboolean( L, -6 );
     params->i_nbResults = lua_tointeger( L, -5 );
     params->i_offset = lua_tointeger( L, -4 );
     params->b_desc = lua_toboolean( L, -3 );


=====================================
modules/misc/medialibrary/MetadataExtractor.cpp
=====================================
@@ -136,7 +136,7 @@ void MetadataExtractor::populateItem( 
medialibrary::parser::IItem& item, input_i
 
     item.setDuration( MS_FROM_VLC_TICK(inputItem->i_duration) );
 
-    for ( auto i = 0; i < inputItem->es_vec.size; ++i )
+    for ( auto i = 0u; i < inputItem->es_vec.size; ++i )
     {
         medialibrary::parser::IItem::Track t;
         const es_format_t *p_es = &inputItem->es_vec.data[i].es;


=====================================
modules/misc/medialibrary/entities.cpp
=====================================
@@ -485,6 +485,8 @@ bool Convert( const medialibrary::IFolder* input, 
vlc_ml_folder_t& output )
     output.i_nb_audio = input->nbAudio();
     output.i_nb_video = input->nbVideo();
 
+    output.i_duration = input->duration();
+
     output.b_banned = input->isBanned();
 
     if ( strdup_helper( input->name(), output.psz_name ) == false )


=====================================
modules/misc/medialibrary/fs/directory.cpp
=====================================
@@ -238,7 +238,7 @@ void
 SDDirectory::addFile(std::string mrl, IFile::LinkedFileType fType, std::string 
linkedFile) const
 {
     time_t lastModificationDate = 0;
-    int64_t fileSize = 0;
+    uint64_t fileSize = 0;
 
     if ( m_fs.isNetworkFileSystem() == false )
     {


=====================================
modules/misc/medialibrary/fs/file.cpp
=====================================
@@ -28,7 +28,7 @@
 namespace vlc {
   namespace medialibrary {
 
-SDFile::SDFile( const std::string mrl, const int64_t size, const time_t 
lastModificationDate )
+SDFile::SDFile( const std::string mrl, const uint64_t size, const time_t 
lastModificationDate )
     : m_mrl( std::move( mrl ) )
     , m_name( utils::fileName( m_mrl ) )
     , m_extension( utils::extension( m_mrl ) )
@@ -40,7 +40,7 @@ SDFile::SDFile( const std::string mrl, const int64_t size, 
const time_t lastModi
 SDFile::SDFile( const std::string mrl,
                 const LinkedFileType fType,
                 const std::string linkedFile,
-                const int64_t size,
+                const uint64_t size,
                 const time_t lastModificationDate )
     : m_mrl( std::move( mrl ) )
     , m_name( utils::fileName( m_mrl ) )
@@ -83,7 +83,7 @@ SDFile::isNetwork() const
   return m_isNetwork;
 }
 
-int64_t
+uint64_t
 SDFile::size() const
 {
     return m_size;


=====================================
modules/misc/medialibrary/fs/file.h
=====================================
@@ -31,8 +31,8 @@ using namespace ::medialibrary::fs;
 class SDFile : public IFile
 {
 public:
-    SDFile( std::string mrl, int64_t, time_t );
-    SDFile( std::string mrl, LinkedFileType, std::string linkedFile, int64_t, 
time_t );
+    SDFile( std::string mrl, uint64_t, time_t );
+    SDFile( std::string mrl, LinkedFileType, std::string linkedFile, uint64_t, 
time_t );
 
     virtual ~SDFile() = default;
     const std::string& mrl() const override;
@@ -41,7 +41,7 @@ public:
     const std::string& linkedWith() const override;
     LinkedFileType linkedType() const override;
     bool isNetwork() const override;
-    int64_t size() const override;
+    uint64_t size() const override;
     time_t lastModificationDate() const override;
 
 private:
@@ -51,7 +51,7 @@ private:
     std::string m_linkedFile;
     LinkedFileType m_linkedType = LinkedFileType::None;
     bool m_isNetwork;
-    int64_t m_size = 0;
+    uint64_t m_size = 0;
     time_t m_lastModificationTime = 0;
 };
 


=====================================
modules/misc/medialibrary/medialibrary.cpp
=====================================
@@ -298,7 +298,7 @@ void MediaLibrary::onDiscoveryFailed( const std::string& 
entryPoint )
 }
 
 
-void MediaLibrary::onEntryPointAdded( const std::string& entryPoint, bool 
success )
+void MediaLibrary::onRootAdded( const std::string& entryPoint, bool success )
 {
     vlc_ml_event_t ev;
     ev.i_type = VLC_ML_EVENT_ENTRY_POINT_ADDED;
@@ -307,7 +307,7 @@ void MediaLibrary::onEntryPointAdded( const std::string& 
entryPoint, bool succes
     m_vlc_ml->cbs->pf_send_event( m_vlc_ml, &ev );
 }
 
-void MediaLibrary::onEntryPointRemoved( const std::string& entryPoint, bool 
success )
+void MediaLibrary::onRootRemoved( const std::string& entryPoint, bool success )
 {
     vlc_ml_event_t ev;
     ev.i_type = VLC_ML_EVENT_ENTRY_POINT_REMOVED;
@@ -316,7 +316,7 @@ void MediaLibrary::onEntryPointRemoved( const std::string& 
entryPoint, bool succ
     m_vlc_ml->cbs->pf_send_event( m_vlc_ml, &ev );
 }
 
-void MediaLibrary::onEntryPointBanned( const std::string& entryPoint, bool 
success )
+void MediaLibrary::onRootBanned( const std::string& entryPoint, bool success )
 {
     vlc_ml_event_t ev;
     ev.i_type = VLC_ML_EVENT_ENTRY_POINT_BANNED;
@@ -325,7 +325,7 @@ void MediaLibrary::onEntryPointBanned( const std::string& 
entryPoint, bool succe
     m_vlc_ml->cbs->pf_send_event( m_vlc_ml, &ev );
 }
 
-void MediaLibrary::onEntryPointUnbanned( const std::string& entryPoint, bool 
success )
+void MediaLibrary::onRootUnbanned( const std::string& entryPoint, bool success 
)
 {
     vlc_ml_event_t ev;
     ev.i_type = VLC_ML_EVENT_ENTRY_POINT_UNBANNED;
@@ -375,8 +375,11 @@ void MediaLibrary::onHistoryChanged( 
medialibrary::HistoryType historyType )
     ev.i_type = VLC_ML_EVENT_HISTORY_CHANGED;
     switch ( historyType )
     {
-        case medialibrary::HistoryType::Media:
-            ev.history_changed.history_type = VLC_ML_HISTORY_TYPE_MEDIA;
+        case medialibrary::HistoryType::Global:
+            ev.history_changed.history_type = VLC_ML_HISTORY_TYPE_GLOBAL;
+            break;
+        case medialibrary::HistoryType::Local:
+            ev.history_changed.history_type = VLC_ML_HISTORY_TYPE_LOCAL;
             break;
         case medialibrary::HistoryType::Network:
             ev.history_changed.history_type = VLC_ML_HISTORY_TYPE_NETWORK;
@@ -549,7 +552,7 @@ int MediaLibrary::Control( int query, va_list args )
                     m_ml->discover( mrl );
                     break;
                 case VLC_ML_REMOVE_FOLDER:
-                    m_ml->removeEntryPoint( mrl );
+                    m_ml->removeRoot( mrl );
                     break;
                 case VLC_ML_BAN_FOLDER:
                     m_ml->banFolder( mrl );
@@ -585,8 +588,11 @@ int MediaLibrary::Control( int query, va_list args )
             m_ml->resumeBackgroundOperations();
             break;
         case VLC_ML_CLEAR_HISTORY:
-            m_ml->clearHistory();
+        {
+            const auto type = static_cast<medialibrary::HistoryType>( 
va_arg(args, int) );
+            m_ml->clearHistory( type );
             break;
+        }
         case VLC_ML_NEW_EXTERNAL_MEDIA:
         {
             auto priorityAccess = m_ml->acquirePriorityAccess();
@@ -1049,10 +1055,10 @@ int MediaLibrary::List( int listQuery, const 
vlc_ml_query_params_t* params, va_l
             return listPlaylist( listQuery, paramsPtr, psz_pattern, nbItems, 
offset, args );
         case VLC_ML_COUNT_HISTORY:
         case VLC_ML_LIST_HISTORY:
-        case VLC_ML_COUNT_HISTORY_BY_TYPE:
-        case VLC_ML_LIST_HISTORY_BY_TYPE:
-        case VLC_ML_COUNT_STREAM_HISTORY:
-        case VLC_ML_LIST_STREAM_HISTORY:
+        case VLC_ML_COUNT_VIDEO_HISTORY:
+        case VLC_ML_LIST_VIDEO_HISTORY:
+        case VLC_ML_COUNT_AUDIO_HISTORY:
+        case VLC_ML_LIST_AUDIO_HISTORY:
         {
             medialibrary::Query<medialibrary::IMedia> query;
 
@@ -1060,18 +1066,18 @@ int MediaLibrary::List( int listQuery, const 
vlc_ml_query_params_t* params, va_l
             {
             case VLC_ML_COUNT_HISTORY:
             case VLC_ML_LIST_HISTORY:
-                query = m_ml->history();
-                break;
-            case VLC_ML_COUNT_HISTORY_BY_TYPE:
-            case VLC_ML_LIST_HISTORY_BY_TYPE:
             {
-                auto  type = va_arg(args, int);
-                query = m_ml->history(static_cast<medialibrary::IMedia::Type>( 
type ));
+                const auto type = static_cast<medialibrary::HistoryType>( 
va_arg(args, int) );
+                query = m_ml->history( type, paramsPtr );
                 break;
             }
-            case VLC_ML_COUNT_STREAM_HISTORY:
-            case VLC_ML_LIST_STREAM_HISTORY:
-                query = m_ml->streamHistory();
+            case VLC_ML_COUNT_VIDEO_HISTORY:
+            case VLC_ML_LIST_VIDEO_HISTORY:
+                query = m_ml->videoHistory( paramsPtr );
+                break;
+            case VLC_ML_COUNT_AUDIO_HISTORY:
+            case VLC_ML_LIST_AUDIO_HISTORY:
+                query = m_ml->audioHistory( paramsPtr );
                 break;
             default:
                 vlc_assert_unreachable();
@@ -1083,15 +1089,15 @@ int MediaLibrary::List( int listQuery, const 
vlc_ml_query_params_t* params, va_l
             switch ( listQuery )
             {
             case VLC_ML_LIST_HISTORY:
-            case VLC_ML_LIST_HISTORY_BY_TYPE:
-            case VLC_ML_LIST_STREAM_HISTORY:
+            case VLC_ML_LIST_VIDEO_HISTORY:
+            case VLC_ML_LIST_AUDIO_HISTORY:
                 *va_arg( args, vlc_ml_media_list_t**) =
                         ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>(
                             query->items( nbItems, offset ) );
                 return VLC_SUCCESS;
             case VLC_ML_COUNT_HISTORY:
-            case VLC_ML_COUNT_HISTORY_BY_TYPE:
-            case VLC_ML_COUNT_STREAM_HISTORY:
+            case VLC_ML_COUNT_VIDEO_HISTORY:
+            case VLC_ML_COUNT_AUDIO_HISTORY:
                 *va_arg( args, size_t* ) = query->count();
                 return VLC_SUCCESS;
             default:
@@ -1101,7 +1107,7 @@ int MediaLibrary::List( int listQuery, const 
vlc_ml_query_params_t* params, va_l
         case VLC_ML_LIST_ENTRY_POINTS:
         {
             const bool banned = va_arg( args, int ) != 0;
-            const auto query = banned ? m_ml->bannedEntryPoints() : 
m_ml->entryPoints();
+            const auto query = banned ? m_ml->bannedRoots() : m_ml->roots( 
paramsPtr );
             if ( query == nullptr )
                 return VLC_EGENERIC;
             auto* res =
@@ -1112,7 +1118,7 @@ int MediaLibrary::List( int listQuery, const 
vlc_ml_query_params_t* params, va_l
         case VLC_ML_COUNT_ENTRY_POINTS:
         {
             const bool banned = va_arg( args, int ) != 0;
-            const auto query = banned ? m_ml->bannedEntryPoints() : 
m_ml->entryPoints();
+            const auto query = banned ? m_ml->bannedRoots() : m_ml->roots( 
paramsPtr );
             *( va_arg( args, size_t* ) ) = query ? query->count() : 0;
             break;
         }
@@ -2023,9 +2029,15 @@ int MediaLibrary::listPlaylist( int listQuery, const 
medialibrary::QueryParamete
                 mlPlaylistType = medialibrary::PlaylistType::All;
                 break;
             case VLC_ML_PLAYLIST_TYPE_VIDEO:
-                mlPlaylistType = medialibrary::PlaylistType::VideoOnly;
+                mlPlaylistType = medialibrary::PlaylistType::Video;
                 break;
             case VLC_ML_PLAYLIST_TYPE_AUDIO:
+                mlPlaylistType = medialibrary::PlaylistType::Audio;
+                break;
+            case VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY:
+                mlPlaylistType = medialibrary::PlaylistType::VideoOnly;
+                break;
+            case VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY:
                 mlPlaylistType = medialibrary::PlaylistType::AudioOnly;
                 break;
             default:
@@ -2034,7 +2046,7 @@ int MediaLibrary::listPlaylist( int listQuery, const 
medialibrary::QueryParamete
 
             medialibrary::Query<medialibrary::IPlaylist> query;
             if ( pattern != nullptr )
-                query = m_ml->searchPlaylists( pattern, paramsPtr );
+                query = m_ml->searchPlaylists( pattern, mlPlaylistType, 
paramsPtr );
             else
                 query = m_ml->playlists( mlPlaylistType, paramsPtr );
             if ( query == nullptr )


=====================================
modules/misc/medialibrary/medialibrary.h
=====================================
@@ -229,10 +229,10 @@ public:
     void onDiscoveryProgress(const std::string& entryPoint) override;
     void onDiscoveryCompleted() override;
     void onDiscoveryFailed( const std::string& entryPoint ) override;
-    void onEntryPointAdded(const std::string& entryPoint, bool success) 
override;
-    void onEntryPointRemoved(const std::string& entryPoint, bool success) 
override;
-    void onEntryPointBanned(const std::string& entryPoint, bool success) 
override;
-    void onEntryPointUnbanned(const std::string& entryPoint, bool success) 
override;
+    void onRootAdded(const std::string& entryPoint, bool success) override;
+    void onRootRemoved(const std::string& entryPoint, bool success) override;
+    void onRootBanned(const std::string& entryPoint, bool success) override;
+    void onRootUnbanned(const std::string& entryPoint, bool success) override;
     void onParsingStatsUpdated(uint32_t done, uint32_t scheduled) override;
     void onBackgroundTasksIdleChanged(bool isIdle) override;
     void onMediaThumbnailReady(medialibrary::MediaPtr media,
@@ -240,6 +240,14 @@ public:
                                bool success) override;
     void onHistoryChanged( medialibrary::HistoryType historyType ) override;
     void onRescanStarted() override;
+
+    // TODO Will be exposed once subscriptions are integrated.
+    void onSubscriptionsAdded( std::vector<medialibrary::SubscriptionPtr> ) 
override {}
+    void onSubscriptionsModified( std::set<int64_t> ) override {}
+    void onSubscriptionsDeleted( std::set<int64_t> ) override {}
+    void onSubscriptionNewMedia( std::set<int64_t> ) override {}
+    void onSubscriptionCacheUpdated( int64_t ) override {}
+    void onCacheIdleChanged( bool ) override {}
 };
 
 bool Convert( const medialibrary::IMedia* input, vlc_ml_media_t& output );


=====================================
modules/misc/meson.build
=====================================
@@ -44,7 +44,7 @@ if libxml2_dep.found()
 endif
 
 # medialibrary module
-medialibrary_dep = dependency('medialibrary', required: 
get_option('medialibrary'), method: 'pkg-config')
+medialibrary_dep = dependency('medialibrary', version: '>= 0.13', required: 
get_option('medialibrary'), method: 'pkg-config')
 if medialibrary_dep.found()
     vlc_modules += {
         'name' : 'medialibrary',


=====================================
share/lua/README.txt
=====================================
@@ -431,6 +431,7 @@ query_params = {
   "desc": boolean,
   "sort": integer,
   "pattern": string,
+  "favorite_only": boolean,
 }
 
 vlc.ml.video(query_params): Get video media list



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/f2fed209e4e758e6a9aec87940481f4a4bed884f...9394e7eace4f7a343cf0a9de8ef63f2108b515ef

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/f2fed209e4e758e6a9aec87940481f4a4bed884f...9394e7eace4f7a343cf0a9de8ef63f2108b515ef
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to