[vlc-commits] medialib: Only start the media library when required

Hugo Beauzée-Luyssen git at videolan.org
Mon Dec 16 11:53:38 CET 2019


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Nov 15 17:11:54 2019 +0100| [c73ada482ddcb190d2d6aa4376da78104b226216] | committer: Hugo Beauzée-Luyssen

medialib: Only start the media library when required

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

 modules/misc/medialibrary/medialib.cpp | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/modules/misc/medialibrary/medialib.cpp b/modules/misc/medialibrary/medialib.cpp
index e71b843570..09940d8e55 100644
--- a/modules/misc/medialibrary/medialib.cpp
+++ b/modules/misc/medialibrary/medialib.cpp
@@ -460,8 +460,25 @@ bool MediaLibrary::Start()
 
 int MediaLibrary::Control( int query, va_list args )
 {
-    if ( Start() == false )
-        return VLC_EGENERIC;
+    switch ( query )
+    {
+        case VLC_ML_ADD_FOLDER:
+        case VLC_ML_REMOVE_FOLDER:
+        case VLC_ML_BAN_FOLDER:
+        case VLC_ML_UNBAN_FOLDER:
+        case VLC_ML_RELOAD_FOLDER:
+        case VLC_ML_RESUME_BACKGROUND:
+        case VLC_ML_MEDIA_GENERATE_THUMBNAIL:
+        {
+            /* These operations require the media library to be started
+             * ie. that the background threads are started */
+            if ( Start() == false )
+                return VLC_EGENERIC;
+            break;
+        }
+        default:
+            break;
+    }
 
     switch ( query )
     {



More information about the vlc-commits mailing list