[vlc-devel] [PATCH 2/5] medialibrary: Add missing reload operation
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Aug 16 17:55:11 CEST 2018
---
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;
--
2.18.0
More information about the vlc-devel
mailing list