[vlc-commits] medialibrary: Add missing reload operation

Hugo Beauzée-Luyssen git at videolan.org
Mon Aug 20 11:42:14 CEST 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Aug 13 16:14:10 2018 +0200| [5c029693c9fe2b3b8b2e3a85b635dd7c3b9f0cd2] | committer: Hugo Beauzée-Luyssen

medialibrary: Add missing reload operation

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

 include/vlc_media_library.h            | 11 +++++++++++
 modules/misc/medialibrary/medialib.cpp |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index 85d9834f1c..e1e08203f0 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -401,6 +401,12 @@ 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_entrypoint_t**); arg2: nb results(size_t*), res: can fail */
+    /**
+     * Reload a specific folder, or all.
+     * arg1: mrl (const char*), NULL to reload all folders
+     * res: can't fail
+     */
+    VLC_ML_RELOAD_FOLDER,
 
     /* Pause/resume background operations, such as media discovery & media analysis */
     VLC_ML_PAUSE_BACKGROUND,        /**< no args; can't fail */
@@ -554,6 +560,11 @@ static inline int vlc_ml_list_folder( vlc_medialibrary_t* p_ml,
     return vlc_ml_control( p_ml, VLC_ML_LIST_FOLDERS, pp_entrypoints, p_nb_items );
 }
 
+static inline int vlc_ml_reload_folder( vlc_medialibrary_t* p_ml, const char* psz_mrl )
+{
+    return vlc_ml_control( p_ml, VLC_ML_RELOAD_FOLDER, psz_mrl );
+}
+
 static inline int vlc_ml_pause_background( vlc_medialibrary_t* p_ml )
 {
     return vlc_ml_control( p_ml, VLC_ML_PAUSE_BACKGROUND );
diff --git a/modules/misc/medialibrary/medialib.cpp b/modules/misc/medialibrary/medialib.cpp
index e370e8e0ad..7f4fac7eaa 100644
--- a/modules/misc/medialibrary/medialib.cpp
+++ b/modules/misc/medialibrary/medialib.cpp
@@ -309,6 +309,15 @@ int MediaLibrary::Control( int query, va_list args )
             *(va_arg( args, size_t*) ) = entryPoints.size();
             break;
         }
+        case VLC_ML_RELOAD_FOLDER:
+        {
+            auto mrl = va_arg( args, const char* );
+            if ( mrl == nullptr )
+                m_ml->reload();
+            else
+                m_ml->reload( mrl );
+            break;
+        }
         case VLC_ML_PAUSE_BACKGROUND:
             m_ml->pauseBackgroundOperations();
             break;



More information about the vlc-commits mailing list