[vlc-commits] [Git][videolan/vlc][master] 9 commits: medialibrary: rename vlc_ml_entry_point_t to vlc_ml_folder_t

Jean-Baptiste Kempf gitlab at videolan.org
Sun May 2 12:39:20 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
3cb3b1f6 by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: rename vlc_ml_entry_point_t to vlc_ml_folder_t

This better reflects the medialibrary internals while also allowing more
flexible medialibrary folder listing as vlc_ml_folder_t is now available
through a more generic name.

- - - - -
4cf84822 by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: add a vlc_ml_folder release function

- - - - -
cecd6d01 by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: expose folder id field to vlc_ml_folder

- - - - -
cc15256b by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: rename now confusing enum values

Now that the `vlc_ml_folder_list_t` replaced `vlc_ml_entry_point_list_t`
the VLC_ML_LIST_FOLDER enum value is a bit confusing and is renamed
VLC_ML_LIST_ENTRY_POINTS to better reflect its functionnality.

- - - - -
2a0894f9 by Alaric Senat at 2021-05-02T12:26:03+00:00
qt: add null check before entry points listing

- - - - -
f897f6b8 by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: use a va_arg bool to list banned entry points

- - - - -
eab292c4 by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: unify enum documentation indent

- - - - -
e4ac8d8f by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: move entry point listing calls to list

As theses ml calls actually simply list folders, moving them to the
"VLC_ML_LIST" interface makes more sense.

- - - - -
b82eb43c by Alaric Senat at 2021-05-02T12:26:03+00:00
medialibrary: add folder listing

This adds new functions to list and access the medialibrary folder
interface.

- - - - -


11 changed files:

- include/vlc_media_library.h
- modules/gui/macosx/library/VLCLibraryDataTypes.h
- modules/gui/macosx/library/VLCLibraryDataTypes.m
- modules/gui/macosx/library/VLCLibraryModel.m
- modules/gui/qt/medialibrary/mlfoldersmodel.cpp
- modules/gui/qt/medialibrary/mlfoldersmodel.hpp
- modules/misc/medialibrary/entities.cpp
- modules/misc/medialibrary/medialibrary.cpp
- modules/misc/medialibrary/medialibrary.h
- src/libvlccore.sym
- src/misc/medialibrary.c


Changes:

=====================================
include/vlc_media_library.h
=====================================
@@ -330,18 +330,19 @@ typedef struct vlc_ml_playlist_list_t
     vlc_ml_playlist_t p_items[];
 } vlc_ml_playlist_list_t;
 
-typedef struct vlc_ml_entry_point_t
+typedef struct vlc_ml_folder_t
 {
-    char* psz_mrl; /**< This entrypoint's MRL. Will be NULL if b_present is false */
-    bool b_present; /**< The presence state for this entrypoint. */
-    bool b_banned; /**< Will be true if the user required this entrypoint to be excluded */
-} vlc_ml_entry_point_t;
+    int64_t i_id; /**< This folder's MRL. Will be NULL if b_present is false */
+    char* psz_mrl; /**< This folder's MRL. Will be NULL if b_present is false */
+    bool b_present; /**< The presence state for this folder. */
+    bool b_banned; /**< Will be true if the user required this folder to be excluded */
+} vlc_ml_folder_t;
 
-typedef struct vlc_ml_entry_point_list_t
+typedef struct vlc_ml_folder_list_t
 {
     size_t i_nb_items;
-    vlc_ml_entry_point_t p_items[];
-} vlc_ml_entry_point_list_t;
+    vlc_ml_folder_t p_items[];
+} vlc_ml_folder_list_t;
 
 typedef struct vlc_ml_bookmark_t
 {
@@ -397,89 +398,100 @@ struct vlc_ml_query_params_t
 
 enum vlc_ml_get_queries
 {
-    VLC_ML_GET_MEDIA,           /**< arg1: Media    ID; ret: vlc_ml_media_t*    */
-    VLC_ML_GET_MEDIA_BY_MRL,    /**< arg1: Media   MRL; ret: vlc_ml_media_t*    */
-    VLC_ML_GET_INPUT_ITEM,      /**< arg1: Media    ID; ret: input_item_t*      */
-    VLC_ML_GET_INPUT_ITEM_BY_MRL,/**< arg1: Media  MRL; ret: input_item_t*      */
-    VLC_ML_GET_ALBUM,           /**< arg1: Album    ID; ret: vlc_ml_album_t*    */
-    VLC_ML_GET_ARTIST,          /**< arg1: Artist   ID; ret: vlc_ml_artist_t*   */
-    VLC_ML_GET_GENRE,           /**< arg1: Genre    ID; ret: vlc_ml_genre_t*    */
-    VLC_ML_GET_SHOW,            /**< arg1: Show     ID; ret: vlc_ml_show_t*     */
-    VLC_ML_GET_GROUP,           /**< arg1: Group    ID; ret: vlc_ml_group_t*    */
-    VLC_ML_GET_PLAYLIST,        /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
+    VLC_ML_GET_MEDIA,             /**< arg1: Media    ID; ret: vlc_ml_media_t*    */
+    VLC_ML_GET_MEDIA_BY_MRL,      /**< arg1: Media   MRL; ret: vlc_ml_media_t*    */
+    VLC_ML_GET_INPUT_ITEM,        /**< arg1: Media    ID; ret: input_item_t*      */
+    VLC_ML_GET_INPUT_ITEM_BY_MRL, /**< arg1: Media  MRL; ret: input_item_t*       */
+    VLC_ML_GET_ALBUM,             /**< arg1: Album    ID; ret: vlc_ml_album_t*    */
+    VLC_ML_GET_ARTIST,            /**< arg1: Artist   ID; ret: vlc_ml_artist_t*   */
+    VLC_ML_GET_GENRE,             /**< arg1: Genre    ID; ret: vlc_ml_genre_t*    */
+    VLC_ML_GET_SHOW,              /**< arg1: Show     ID; ret: vlc_ml_show_t*     */
+    VLC_ML_GET_PLAYLIST,          /**< arg1: Playlist ID; ret: vlc_ml_playlist_t* */
+    VLC_ML_GET_GROUP,             /**< arg1: Group    ID; ret: vlc_ml_group_t*    */
+    VLC_ML_GET_FOLDER,            /**< arg1: folder ID; ret: vlc_ml_folder_t*     */
 };
 
 enum vlc_ml_list_queries
 {
     /* General listing: */
 
-    VLC_ML_LIST_VIDEOS,           /**< arg1 (out): vlc_ml_media_list_t**                            */
-    VLC_ML_COUNT_VIDEOS,          /**< arg1 (out): size_t*                                          */
-    VLC_ML_LIST_AUDIOS,           /**< arg1 (out): vlc_ml_media_list_t**                            */
-    VLC_ML_COUNT_AUDIOS,          /**< arg1 (out): size_t*                                          */
-    VLC_ML_LIST_ALBUMS,           /**< arg1 (out): vlc_ml_album_list_t**                            */
-    VLC_ML_COUNT_ALBUMS,          /**< arg1 (out): size_t*                                          */
-    VLC_ML_LIST_GENRES,           /**< arg1 (out): vlc_ml_genre_list_t**                            */
-    VLC_ML_COUNT_GENRES,          /**< arg1 (out): size_t*                                          */
-    VLC_ML_LIST_ARTISTS,          /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t**     */
-    VLC_ML_COUNT_ARTISTS,         /**< arg1 bool: includeAll; arg2 (out): size_t*                   */
-    VLC_ML_LIST_SHOWS,            /**< arg1 (out): vlc_ml_show_list_t**                             */
-    VLC_ML_COUNT_SHOWS,           /**< arg1 (out): size_t*                                          */
-    VLC_ML_LIST_GROUPS,           /**< arg1 (out): vlc_ml_group_list_t**                            */
-    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_VIDEOS,           /**< arg1 (out): vlc_ml_media_list_t**                                                */
+    VLC_ML_COUNT_VIDEOS,          /**< arg1 (out): size_t*                                                              */
+    VLC_ML_LIST_AUDIOS,           /**< arg1 (out): vlc_ml_media_list_t**                                                */
+    VLC_ML_COUNT_AUDIOS,          /**< arg1 (out): size_t*                                                              */
+    VLC_ML_LIST_ALBUMS,           /**< arg1 (out): vlc_ml_album_list_t**                                                */
+    VLC_ML_COUNT_ALBUMS,          /**< arg1 (out): size_t*                                                              */
+    VLC_ML_LIST_GENRES,           /**< arg1 (out): vlc_ml_genre_list_t**                                                */
+    VLC_ML_COUNT_GENRES,          /**< arg1 (out): size_t*                                                              */
+    VLC_ML_LIST_ARTISTS,          /**< arg1 bool: includeAll; arg2 (out): vlc_ml_genre_list_t**                         */
+    VLC_ML_COUNT_ARTISTS,         /**< arg1 bool: includeAll; arg2 (out): size_t*                                       */
+    VLC_ML_LIST_SHOWS,            /**< arg1 (out): vlc_ml_show_list_t**                                                 */
+    VLC_ML_COUNT_SHOWS,           /**< arg1 (out): size_t*                                                              */
+    VLC_ML_LIST_GROUPS,           /**< arg1 (out): vlc_ml_group_list_t**                                                */
+    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_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**                                               */
+    VLC_ML_COUNT_FOLDERS,         /**< arg1 (out): size_t*                                                              */
 
     /* Album specific listings */
-    VLC_ML_LIST_ALBUM_TRACKS,     /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t**  */
-    VLC_ML_COUNT_ALBUM_TRACKS,    /**< arg1: The album id. arg2 (out): size_t*  */
-    VLC_ML_LIST_ALBUM_ARTISTS,    /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t**  */
-    VLC_ML_COUNT_ALBUM_ARTISTS,    /**< arg1: The album id. arg2 (out): size_t*  */
+    VLC_ML_LIST_ALBUM_TRACKS,     /**< arg1: The album id. arg2 (out): vlc_ml_media_list_t**                            */
+    VLC_ML_COUNT_ALBUM_TRACKS,    /**< arg1: The album id. arg2 (out): size_t*                                          */
+    VLC_ML_LIST_ALBUM_ARTISTS,    /**< arg1: The album id. arg2 (out): vlc_ml_album_list_t**                            */
+    VLC_ML_COUNT_ALBUM_ARTISTS,   /**< arg1: The album id. arg2 (out): size_t*                                          */
 
     /* Artist specific listings */
-    VLC_ML_LIST_ARTIST_ALBUMS,  /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t**    */
-    VLC_ML_COUNT_ARTIST_ALBUMS, /**< arg1: The artist id. arg2(out): size_t*              */
-    VLC_ML_LIST_ARTIST_TRACKS,  /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t**    */
-    VLC_ML_COUNT_ARTIST_TRACKS, /**< arg1: The artist id. arg2(out): size_t*              */
+    VLC_ML_LIST_ARTIST_ALBUMS,    /**< arg1: The artist id. arg2(out): vlc_ml_album_list_t**                            */
+    VLC_ML_COUNT_ARTIST_ALBUMS,   /**< arg1: The artist id. arg2(out): size_t*                                          */
+    VLC_ML_LIST_ARTIST_TRACKS,    /**< arg1: The artist id. arg2(out): vlc_ml_media_list_t**                            */
+    VLC_ML_COUNT_ARTIST_TRACKS,   /**< arg1: The artist id. arg2(out): size_t*                                          */
 
     /* Genre specific listings */
-    VLC_ML_LIST_GENRE_ARTISTS,    /**< arg1: genre id;  arg2 (out): vlc_ml_artist_list_t**  */
-    VLC_ML_COUNT_GENRE_ARTISTS,   /**< arg1: genre id;  arg2 (out): size_t*             */
-    VLC_ML_LIST_GENRE_TRACKS,     /**< arg1: genre id;  arg2 (out): vlc_ml_media_list_t**   */
-    VLC_ML_COUNT_GENRE_TRACKS,    /**< arg1: genre id;  arg2 (out): size_t*             */
-    VLC_ML_LIST_GENRE_ALBUMS,     /**< arg1: genre id;  arg2 (out): vlc_ml_album_list_t**   */
-    VLC_ML_COUNT_GENRE_ALBUMS,    /**< arg1: genre id;  arg2 (out): size_t*             */
+    VLC_ML_LIST_GENRE_ARTISTS,    /**< arg1: genre id;  arg2 (out): vlc_ml_artist_list_t**                              */
+    VLC_ML_COUNT_GENRE_ARTISTS,   /**< arg1: genre id;  arg2 (out): size_t*                                             */
+    VLC_ML_LIST_GENRE_TRACKS,     /**< arg1: genre id;  arg2 (out): vlc_ml_media_list_t**                               */
+    VLC_ML_COUNT_GENRE_TRACKS,    /**< arg1: genre id;  arg2 (out): size_t*                                             */
+    VLC_ML_LIST_GENRE_ALBUMS,     /**< arg1: genre id;  arg2 (out): vlc_ml_album_list_t**                               */
+    VLC_ML_COUNT_GENRE_ALBUMS,    /**< arg1: genre id;  arg2 (out): size_t*                                             */
 
     /* Show specific listings */
-    VLC_ML_LIST_SHOW_EPISODES,    /**< arg1: show id; arg2(out): vlc_ml_media_list_t**  */
-    VLC_ML_COUNT_SHOW_EPISODES,   /**< arg1: show id; arg2(out): size_t*                */
+    VLC_ML_LIST_SHOW_EPISODES,    /**< arg1: show id; arg2(out): vlc_ml_media_list_t**                                  */
+    VLC_ML_COUNT_SHOW_EPISODES,   /**< arg1: show id; arg2(out): size_t*                                                */
 
     /* Media specific listings */
-    VLC_ML_LIST_MEDIA_LABELS,     /**< arg1: media id;  arg2 (out): vlc_ml_label_list_t**    */
-    VLC_ML_COUNT_MEDIA_LABELS,    /**< arg1: media id;  arg2 (out): size_t*              */
-    VLC_ML_LIST_MEDIA_BOOKMARKS,  /**< arg1: media id;  arg2 (out): vlc_ml_bookmark_list_t** */
+    VLC_ML_LIST_MEDIA_LABELS,     /**< arg1: media id;  arg2 (out): vlc_ml_label_list_t**                               */
+    VLC_ML_COUNT_MEDIA_LABELS,    /**< arg1: media id;  arg2 (out): size_t*                                             */
+    VLC_ML_LIST_MEDIA_BOOKMARKS,  /**< arg1: media id;  arg2 (out): vlc_ml_bookmark_list_t**                            */
 
     /* Groups specific listings */
-    VLC_ML_LIST_GROUP_MEDIA,   /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
-    VLC_ML_COUNT_GROUP_MEDIA,  /**< arg1: playlist id; arg2 (out): size_t* */
+    VLC_ML_LIST_GROUP_MEDIA,      /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t**                             */
+    VLC_ML_COUNT_GROUP_MEDIA,     /**< arg1: playlist id; arg2 (out): size_t*                                           */
 
     /* Playlist specific listings */
-    VLC_ML_LIST_PLAYLIST_MEDIA,   /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t** */
-    VLC_ML_COUNT_PLAYLIST_MEDIA,  /**< arg1: playlist id; arg2 (out): size_t* */
+    VLC_ML_LIST_PLAYLIST_MEDIA,   /**< arg1: playlist id; arg2 (out): vlc_ml_media_list_t**                             */
+    VLC_ML_COUNT_PLAYLIST_MEDIA,  /**< arg1: playlist id; arg2 (out): size_t*                                           */
+
+    /* Folder specific listings */
+    VLC_ML_LIST_SUBFOLDERS,       /**< arg1: parent id; arg2 (out): vlc_ml_folder_list_t**                              */
+    VLC_ML_COUNT_SUBFOLDERS,      /**< arg1: parent id; arg2 (out): size_t*                                             */
+    VLC_ML_LIST_FOLDER_MEDIAS,    /**< arg1: folder id; arg2 (out): vlc_ml_media_list_t**                               */
+    VLC_ML_COUNT_FOLDER_MEDIAS,   /**< arg1: folder id; arg2 (out): size_t*                                             */
 
     /* Children entities listing */
-    VLC_ML_LIST_MEDIA_OF,         /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t** */
-    VLC_ML_COUNT_MEDIA_OF,        /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
-    VLC_ML_LIST_ARTISTS_OF,       /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t** */
-    VLC_ML_COUNT_ARTISTS_OF,      /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
-    VLC_ML_LIST_ALBUMS_OF,        /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t** */
-    VLC_ML_COUNT_ALBUMS_OF,       /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t* */
+    VLC_ML_LIST_MEDIA_OF,         /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_media_list_t**   */
+    VLC_ML_COUNT_MEDIA_OF,        /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t*             */
+    VLC_ML_LIST_ARTISTS_OF,       /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_artist_list_t**  */
+    VLC_ML_COUNT_ARTISTS_OF,      /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t*             */
+    VLC_ML_LIST_ALBUMS_OF,        /**< arg1: parent entity type; arg2: parent entity id; arg3(out): ml_album_list_t**   */
+    VLC_ML_COUNT_ALBUMS_OF,       /**< arg1: parent entity type; arg2: parent entity id; arg3(out): size_t*             */
 };
 
 enum vlc_ml_parent_type
@@ -500,8 +512,6 @@ enum vlc_ml_control
     VLC_ML_REMOVE_FOLDER,           /**< arg1: mrl (const char*)  res: can't fail */
     VLC_ML_BAN_FOLDER,              /**< arg1: mrl (const char*)  res: can't fail */
     VLC_ML_UNBAN_FOLDER,            /**< arg1: mrl (const char*)  res: can't fail */
-    VLC_ML_LIST_FOLDERS,            /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
-    VLC_ML_LIST_BANNED_FOLDERS,     /**< arg1: entrypoints (vlc_ml_entry_point_list_t**); res: can fail */
     VLC_ML_IS_INDEXED,              /**< arg1: mrl (const char*) arg2 (out): bool*;       res: can fail */
     /**
      * Reload a specific folder, or all.
@@ -876,6 +886,7 @@ VLC_API void vlc_ml_media_release( vlc_ml_media_t* p_media );
 VLC_API void vlc_ml_album_release( vlc_ml_album_t* p_album );
 VLC_API void vlc_ml_group_release( vlc_ml_group_t* p_group );
 VLC_API void vlc_ml_playlist_release( vlc_ml_playlist_t* p_playlist );
+VLC_API void vlc_ml_folder_release( vlc_ml_folder_t* p_folder );
 
 VLC_API void vlc_ml_label_list_release( vlc_ml_label_list_t* p_list );
 VLC_API void vlc_ml_file_list_release( vlc_ml_file_list_t* p_list );
@@ -886,7 +897,7 @@ VLC_API void vlc_ml_show_list_release( vlc_ml_show_list_t* p_list );
 VLC_API void vlc_ml_genre_list_release( vlc_ml_genre_list_t* p_list );
 VLC_API void vlc_ml_group_list_release( vlc_ml_group_list_t* p_list );
 VLC_API void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t* p_list );
-VLC_API void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t* p_list );
+VLC_API void vlc_ml_folder_list_release( vlc_ml_folder_list_t* p_list );
 VLC_API void vlc_ml_playback_states_all_release( vlc_ml_playback_states_all* prefs );
 VLC_API void vlc_ml_bookmark_release( vlc_ml_bookmark_t* p_bookmark );
 VLC_API void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t* p_list );
@@ -922,18 +933,6 @@ static inline int vlc_ml_unban_folder( vlc_medialibrary_t* p_ml, const char* psz
     return vlc_ml_control( p_ml, VLC_ML_UNBAN_FOLDER, psz_folder );
 }
 
-static inline int vlc_ml_list_folder( vlc_medialibrary_t* p_ml,
-                                      vlc_ml_entry_point_list_t** pp_entrypoints )
-{
-    return vlc_ml_control( p_ml, VLC_ML_LIST_FOLDERS, pp_entrypoints );
-}
-
-static inline int vlc_ml_list_banned_folder( vlc_medialibrary_t* p_ml,
-                                             vlc_ml_entry_point_list_t** pp_entrypoints )
-{
-    return vlc_ml_control( p_ml, VLC_ML_LIST_BANNED_FOLDERS, pp_entrypoints );
-}
-
 static inline int vlc_ml_is_indexed( vlc_medialibrary_t* p_ml,
                                      const char* psz_mrl, bool* p_res )
 {
@@ -1648,6 +1647,44 @@ static inline size_t vlc_ml_count_playlist_media( vlc_medialibrary_t* p_ml, cons
     return count;
 }
 
+static inline vlc_ml_folder_list_t* vlc_ml_list_entry_points( vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
+{
+    vlc_assert( p_ml != NULL );
+    vlc_ml_folder_list_t *res;
+    if ( vlc_ml_list( p_ml, VLC_ML_LIST_ENTRY_POINTS, params, (int)false, &res ) != VLC_SUCCESS )
+        return NULL;
+    return res;
+}
+
+static inline size_t vlc_ml_count_entry_points( vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
+{
+    vlc_assert( p_ml != NULL );
+    size_t res;
+    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_ENTRY_POINTS, params, (int)false, &res ) != VLC_SUCCESS )
+        return 0;
+    return res;
+}
+
+static inline vlc_ml_folder_list_t*
+vlc_ml_list_banned_entry_points( vlc_medialibrary_t* p_ml, const vlc_ml_query_params_t* params )
+{
+    vlc_assert( p_ml != NULL );
+    vlc_ml_folder_list_t* res;
+    if ( vlc_ml_list( p_ml, VLC_ML_LIST_ENTRY_POINTS, params, (int)true, &res ) != VLC_SUCCESS )
+        return NULL;
+    return res;
+}
+
+static inline size_t vlc_ml_count_banned_entry_points( vlc_medialibrary_t* p_ml,
+                                                       const vlc_ml_query_params_t* params )
+{
+    vlc_assert( p_ml != NULL );
+    size_t res;
+    if ( vlc_ml_list( p_ml, VLC_ML_COUNT_ENTRY_POINTS, params, (int)true, &res ) != VLC_SUCCESS )
+        return 0;
+    return res;
+}
+
 #ifdef __cplusplus
 }
 #endif /* C++ */
@@ -1660,6 +1697,7 @@ static inline size_t vlc_ml_count_playlist_media( vlc_medialibrary_t* p_ml, cons
     vlc_ml_genre_t*: vlc_ml_genre_release, \
     vlc_ml_media_t*: vlc_ml_media_release, \
     vlc_ml_group_t*: vlc_ml_group_release, \
+    vlc_ml_folder_t*: vlc_ml_folder_release, \
     vlc_ml_playlist_t*: vlc_ml_playlist_release, \
     vlc_ml_label_list_t*: vlc_ml_label_list_release, \
     vlc_ml_file_list_t*: vlc_ml_file_list_release, \
@@ -1670,7 +1708,7 @@ static inline size_t vlc_ml_count_playlist_media( vlc_medialibrary_t* p_ml, cons
     vlc_ml_genre_list_t*: vlc_ml_genre_list_release, \
     vlc_ml_group_list_t*: vlc_ml_group_list_release, \
     vlc_ml_playlist_list_t*: vlc_ml_playlist_list_release, \
-    vlc_ml_entry_point_list_t*: vlc_ml_entry_point_list_release, \
+    vlc_ml_folder_list_t*: vlc_ml_folder_list_release, \
     vlc_ml_playback_states_all*: vlc_ml_playback_states_all_release, \
     vlc_ml_bookmark_t*: vlc_ml_bookmark_release, \
     vlc_ml_bookmark_list_t*: vlc_ml_bookmark_list_release \
@@ -1682,6 +1720,7 @@ static inline void vlc_ml_release( vlc_ml_album_t* album ) { vlc_ml_album_releas
 static inline void vlc_ml_release( vlc_ml_genre_t* genre ) { vlc_ml_genre_release( genre ); }
 static inline void vlc_ml_release( vlc_ml_media_t* media ) { vlc_ml_media_release( media ); }
 static inline void vlc_ml_release( vlc_ml_group_t* group ) { vlc_ml_group_release( group ); }
+static inline void vlc_ml_release( vlc_ml_folder_t* folder ) { vlc_ml_folder_release( folder ); }
 static inline void vlc_ml_release( vlc_ml_playlist_t* playlist ) { vlc_ml_playlist_release( playlist ); }
 static inline void vlc_ml_release( vlc_ml_label_list_t* list ) { vlc_ml_label_list_release( list ); }
 static inline void vlc_ml_release( vlc_ml_file_list_t* list ) { vlc_ml_file_list_release( list ); }
@@ -1692,7 +1731,7 @@ static inline void vlc_ml_release( vlc_ml_show_list_t* list ) { vlc_ml_show_list
 static inline void vlc_ml_release( vlc_ml_genre_list_t* list ) { vlc_ml_genre_list_release( list ); }
 static inline void vlc_ml_release( vlc_ml_group_list_t* list ) { vlc_ml_group_list_release( list ); }
 static inline void vlc_ml_release( vlc_ml_playlist_list_t* list ) { vlc_ml_playlist_list_release( list ); }
-static inline void vlc_ml_release( vlc_ml_entry_point_list_t* list ) { vlc_ml_entry_point_list_release( list ); }
+static inline void vlc_ml_release( vlc_ml_folder_list_t* list ) { vlc_ml_folder_list_release( list ); }
 static inline void vlc_ml_release( vlc_ml_playback_states_all* prefs ) { vlc_ml_playback_states_all_release( prefs ); }
 static inline void vlc_ml_release( vlc_ml_bookmark_t* bookmark ) { vlc_ml_bookmark_release( bookmark ); }
 static inline void vlc_ml_release( vlc_ml_bookmark_list_t* list ) { vlc_ml_bookmark_list_release( list ); }


=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.h
=====================================
@@ -207,7 +207,7 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
 
 @interface VLCMediaLibraryEntryPoint : NSObject
 
-- (instancetype)initWithEntryPoint:(struct vlc_ml_entry_point_t *)p_entryPoint;
+- (instancetype)initWithEntryPoint:(struct vlc_ml_folder_t *)p_entryPoint;
 
 @property (readonly) NSString *MRL;
 @property (readonly) NSString *decodedMRL;


=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -763,7 +763,7 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
 
 @implementation VLCMediaLibraryEntryPoint
 
-- (instancetype)initWithEntryPoint:(struct vlc_ml_entry_point_t *)p_entryPoint
+- (instancetype)initWithEntryPoint:(struct vlc_ml_folder_t *)p_entryPoint
 {
     self = [super init];
     if (self && p_entryPoint != NULL) {


=====================================
modules/gui/macosx/library/VLCLibraryModel.m
=====================================
@@ -364,10 +364,9 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
 
 - (NSArray<VLCMediaLibraryEntryPoint *> *)listOfMonitoredFolders
 {
-    vlc_ml_entry_point_list_t *pp_entrypoints;
-    int ret = vlc_ml_list_folder(_p_mediaLibrary, &pp_entrypoints);
-    if (ret != VLC_SUCCESS) {
-        msg_Err(getIntf(), "failed to retrieve list of monitored library folders (%i)", ret);
+    vlc_ml_folder_list_t *pp_entrypoints = vlc_ml_list_entry_points(_p_mediaLibrary, NULL);
+    if (pp_entrypoints == NULL) {
+        msg_Err(getIntf(), "failed to retrieve list of monitored library folders");
         return @[];
     }
 
@@ -379,7 +378,7 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
         }
     }
 
-    vlc_ml_entry_point_list_release(pp_entrypoints);
+    vlc_ml_folder_list_release(pp_entrypoints);
     return [mutableArray copy];
 }
 


=====================================
modules/gui/qt/medialibrary/mlfoldersmodel.cpp
=====================================
@@ -29,7 +29,7 @@ MLFoldersBaseModel::MLFoldersBaseModel( QObject *parent )
     connect( this , &MLFoldersBaseModel::onMLEntryPointModified , this , &MLFoldersBaseModel::update );
 }
 
-MLFoldersBaseModel::EntryPoint::EntryPoint( const vlc_ml_entry_point_t& entryPoint)
+MLFoldersBaseModel::EntryPoint::EntryPoint( const vlc_ml_folder_t& entryPoint)
     : mrl(entryPoint.psz_mrl)
     , banned(entryPoint.b_banned)
 {
@@ -118,11 +118,13 @@ std::vector<MLFoldersBaseModel::EntryPoint> MLFoldersModel::entryPoints() const
 {
     std::vector<MLFoldersBaseModel::EntryPoint> r;
 
-    vlc_ml_entry_point_list_t * entrypoints = nullptr;
-    vlc_ml_list_folder( ml() , &entrypoints );
-    for ( unsigned int i=0 ; i<entrypoints->i_nb_items ; i++ )
-        r.emplace_back( entrypoints->p_items[i] );
-    vlc_ml_release(entrypoints);
+    vlc_ml_folder_list_t* entrypoints = vlc_ml_list_entry_points( ml(), nullptr );
+    if ( entrypoints != nullptr )
+    {
+        for ( unsigned int i = 0; entrypoints && i < entrypoints->i_nb_items; i++ )
+            r.emplace_back( entrypoints->p_items[i] );
+        vlc_ml_release( entrypoints );
+    }
 
     return r;
 }
@@ -159,11 +161,13 @@ std::vector<MLFoldersBaseModel::EntryPoint> MLBannedFoldersModel::entryPoints()
 {
     std::vector<MLFoldersBaseModel::EntryPoint> r;
 
-    vlc_ml_entry_point_list_t * entrypoints = nullptr;
-    vlc_ml_list_banned_folder( ml() , &entrypoints );
-    for ( unsigned int i=0 ; i<entrypoints->i_nb_items ; i++ )
-        r.emplace_back( entrypoints->p_items[i] );
-    vlc_ml_release(entrypoints);
+    vlc_ml_folder_list_t* entrypoints = vlc_ml_list_banned_entry_points( ml(), nullptr );
+    if ( entrypoints != nullptr )
+    {
+        for ( unsigned int i = 0; entrypoints && i < entrypoints->i_nb_items; i++ )
+            r.emplace_back( entrypoints->p_items[i] );
+        vlc_ml_release( entrypoints );
+    }
 
     return r;
 }


=====================================
modules/gui/qt/medialibrary/mlfoldersmodel.hpp
=====================================
@@ -69,7 +69,7 @@ signals:
 protected:
     struct EntryPoint
     {
-        EntryPoint(const vlc_ml_entry_point_t &entryPoint );
+        EntryPoint(const vlc_ml_folder_t &entryPoint );
         QString mrl;
         bool banned;
     };


=====================================
modules/misc/medialibrary/entities.cpp
=====================================
@@ -446,8 +446,10 @@ bool Convert( const medialibrary::IPlaylist* input, vlc_ml_playlist_t& output )
     return true;
 }
 
-bool Convert( const medialibrary::IFolder* input, vlc_ml_entry_point_t& output )
+bool Convert( const medialibrary::IFolder* input, vlc_ml_folder_t& output )
 {
+    output.i_id = input->id();
+    output.b_banned = input->isBanned();
     try
     {
         if ( strdup_helper( input->mrl(), output.psz_mrl ) == false )
@@ -459,7 +461,6 @@ bool Convert( const medialibrary::IFolder* input, vlc_ml_entry_point_t& output )
         output.psz_mrl = nullptr;
         output.b_present = false;
     }
-    output.b_banned = input->isBanned();
     return true;
 }
 


=====================================
modules/misc/medialibrary/medialibrary.cpp
=====================================
@@ -41,6 +41,7 @@
 #include <medialibrary/IMediaGroup.h>
 #include <medialibrary/IPlaylist.h>
 #include <medialibrary/IBookmark.h>
+#include <medialibrary/IFolder.h>
 
 #include <sstream>
 #include <initializer_list>
@@ -550,17 +551,6 @@ int MediaLibrary::Control( int query, va_list args )
             }
             break;
         }
-        case VLC_ML_LIST_FOLDERS:
-        case VLC_ML_LIST_BANNED_FOLDERS:
-        {
-            auto entryPoints = ( query == VLC_ML_LIST_FOLDERS )
-                    ? m_ml->entryPoints()->all()
-                    : m_ml->bannedEntryPoints()->all();
-            auto res = ml_convert_list<vlc_ml_entry_point_list_t,
-                                         vlc_ml_entry_point_t>( entryPoints );
-            *(va_arg( args, vlc_ml_entry_point_list_t**) ) = res;
-            break;
-        }
         case VLC_ML_IS_INDEXED:
         {
             auto mrl = va_arg( args, const char* );
@@ -999,7 +989,81 @@ int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_l
                 vlc_assert_unreachable();
             }
         }
-
+        case VLC_ML_LIST_ENTRY_POINTS:
+        {
+            const bool banned = va_arg( args, int ) != 0;
+            const auto query = banned ? m_ml->bannedEntryPoints() : m_ml->entryPoints();
+            if ( query == nullptr )
+                return VLC_EGENERIC;
+            auto* res =
+                ml_convert_list<vlc_ml_folder_list_t, vlc_ml_folder_t>( query->all() );
+            *( va_arg( args, vlc_ml_folder_list_t** ) ) = res;
+            break;
+        }
+        case VLC_ML_COUNT_ENTRY_POINTS:
+        {
+            const bool banned = va_arg( args, int ) != 0;
+            const auto query = banned ? m_ml->bannedEntryPoints() : m_ml->entryPoints();
+            *( va_arg( args, size_t* ) ) = query ? query->count() : 0;
+            break;
+        }
+        case VLC_ML_LIST_SUBFOLDERS:
+        {
+            const auto parent = m_ml->folder( va_arg( args, int64_t ) );
+            if ( parent == nullptr )
+                return VLC_EGENERIC;
+            const auto query = parent->subfolders();
+            if ( query == nullptr )
+                return VLC_EGENERIC;
+            auto* res = ml_convert_list<vlc_ml_folder_list_t, vlc_ml_folder_t>( query->all() );
+            *( va_arg( args, vlc_ml_folder_list_t** ) ) = res;
+            break;
+        }
+        case VLC_ML_COUNT_SUBFOLDERS:
+        {
+            const auto parent = m_ml->folder( va_arg( args, int64_t ) );
+            if ( parent == nullptr )
+                return VLC_EGENERIC;
+            const auto query = parent->subfolders();
+            *( va_arg( args, size_t* ) ) = query == nullptr ? 0 : query->count();
+            break;
+        }
+        case VLC_ML_LIST_FOLDERS:
+        {
+            const auto query = m_ml->folders( medialibrary::IMedia::Type::Unknown, paramsPtr );
+            if ( query == nullptr )
+                return VLC_EGENERIC;
+            auto* res = ml_convert_list<vlc_ml_folder_list_t, vlc_ml_folder_t>( query->all() );
+            *( va_arg( args, vlc_ml_folder_list_t** ) ) = res;
+            break;
+        }
+        case VLC_ML_COUNT_FOLDERS:
+        {
+            const auto query = m_ml->folders( medialibrary::IMedia::Type::Unknown, paramsPtr );
+            *( va_arg( args, size_t* ) ) = query == nullptr ? 0 : query->count();
+            break;
+        }
+        case VLC_ML_LIST_FOLDER_MEDIAS:
+        {
+            const auto folder = m_ml->folder( va_arg( args, int64_t ) );
+            if ( folder == nullptr )
+                return VLC_EGENERIC;
+            const auto query = folder->media( medialibrary::IMedia::Type::Unknown, paramsPtr );
+            if ( query == nullptr )
+                return VLC_EGENERIC;
+            auto* res = ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>( query->all() );
+            *( va_arg( args, vlc_ml_media_list_t** ) ) = res;
+            break;
+        }
+        case VLC_ML_COUNT_FOLDER_MEDIAS:
+        {
+            const auto folder = m_ml->folder( va_arg( args, int64_t ) );
+            if ( folder == nullptr )
+                return VLC_EGENERIC;
+            const auto query = folder->media( medialibrary::IMedia::Type::Unknown, paramsPtr );
+            *( va_arg( args, size_t* ) ) = query == nullptr ? 0 : query->count();
+            break;
+        }
     }
     return VLC_SUCCESS;
 }
@@ -1059,6 +1123,12 @@ void* MediaLibrary::Get( int query, va_list args )
             auto playlist = m_ml->playlist( id );
             return CreateAndConvert<vlc_ml_playlist_t>( playlist.get() );
         }
+        case VLC_ML_GET_FOLDER:
+        {
+            auto id = va_arg( args, int64_t );
+            auto folder = m_ml->folder( id );
+            return CreateAndConvert<vlc_ml_folder_t>( folder.get() );
+        }
         case VLC_ML_GET_MEDIA_BY_MRL:
         {
             auto mrl = va_arg( args, const char* );


=====================================
modules/misc/medialibrary/medialibrary.h
=====================================
@@ -228,7 +228,7 @@ bool Convert( const medialibrary::IShow* input, vlc_ml_show_t& output );
 bool Convert( const medialibrary::ILabel* input, vlc_ml_label_t& output );
 bool Convert( const medialibrary::IMediaGroup* input, vlc_ml_group_t& output );
 bool Convert( const medialibrary::IPlaylist* input, vlc_ml_playlist_t& output );
-bool Convert( const medialibrary::IFolder* input, vlc_ml_entry_point_t& output );
+bool Convert( const medialibrary::IFolder* input, vlc_ml_folder_t& output );
 bool Convert( const medialibrary::IBookmark* input, vlc_ml_bookmark_t& output );
 input_item_t* MediaToInputItem( const medialibrary::IMedia* media );
 


=====================================
src/libvlccore.sym
=====================================
@@ -584,6 +584,7 @@ vlc_ml_media_release
 vlc_ml_album_release
 vlc_ml_group_release
 vlc_ml_playlist_release
+vlc_ml_folder_release
 vlc_ml_label_list_release
 vlc_ml_file_list_release
 vlc_ml_artist_list_release
@@ -593,7 +594,7 @@ vlc_ml_show_list_release
 vlc_ml_genre_list_release
 vlc_ml_group_list_release
 vlc_ml_playlist_list_release
-vlc_ml_entry_point_list_release
+vlc_ml_folder_list_release
 vlc_ml_bookmark_release
 vlc_ml_bookmark_list_release
 vlc_poll_i11e


=====================================
src/misc/medialibrary.c
=====================================
@@ -264,7 +264,6 @@ void vlc_ml_playlist_release( vlc_ml_playlist_t* p_playlist )
     free( p_playlist );
 }
 
-/* Lists release */
 
 void vlc_ml_media_release( vlc_ml_media_t* p_media )
 {
@@ -274,6 +273,16 @@ void vlc_ml_media_release( vlc_ml_media_t* p_media )
     free( p_media );
 }
 
+void vlc_ml_folder_release( vlc_ml_folder_t* p_folder )
+{
+    if ( p_folder == NULL )
+        return;
+    free( p_folder->psz_mrl );
+    free( p_folder );
+}
+
+/* Lists release */
+
 void vlc_ml_label_list_release( vlc_ml_label_list_t* p_list )
 {
     if ( p_list == NULL )
@@ -356,7 +365,7 @@ void vlc_ml_playlist_list_release( vlc_ml_playlist_list_t* p_list )
     free( p_list );
 }
 
-void vlc_ml_entry_point_list_release( vlc_ml_entry_point_list_t* p_list )
+void vlc_ml_folder_list_release( vlc_ml_folder_list_t* p_list )
 {
     if ( p_list == NULL )
         return;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/761079335c9554cfb0a4baf6fee44025a1aa639a...b82eb43c7b43328a4ef7048cf400d9589ee570da

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




More information about the vlc-commits mailing list