[vlc-devel] [PATCH 09/16] medialibrary: add function to get banned entry points

Prince Gupta guptaprince8832 at gmail.com
Tue Feb 23 10:05:59 UTC 2021


---
 include/vlc_media_library.h                | 7 +++++++
 modules/misc/medialibrary/medialibrary.cpp | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index fde638692d..042e5d3d1e 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -465,6 +465,7 @@ enum vlc_ml_control
     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.
@@ -902,6 +903,12 @@ static inline int vlc_ml_list_folder( vlc_medialibrary_t* p_ml,
     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 )
 {
diff --git a/modules/misc/medialibrary/medialibrary.cpp b/modules/misc/medialibrary/medialibrary.cpp
index 6c4583f66e..b2f55d22f6 100644
--- a/modules/misc/medialibrary/medialibrary.cpp
+++ b/modules/misc/medialibrary/medialibrary.cpp
@@ -548,8 +548,11 @@ int MediaLibrary::Control( int query, va_list args )
             break;
         }
         case VLC_ML_LIST_FOLDERS:
+        case VLC_ML_LIST_BANNED_FOLDERS:
         {
-            auto entryPoints = m_ml->entryPoints()->all();
+            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;
-- 
2.25.1



More information about the vlc-devel mailing list