[vlc-devel] [PATCH 8/9] libvlc: Instantiate media library module

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Jul 13 17:07:26 CEST 2018


---
 src/libvlc.c | 11 +++++++++++
 src/libvlc.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/src/libvlc.c b/src/libvlc.c
index 169bc37a7d..5d18b69eec 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -62,6 +62,7 @@
 #include <vlc_cpu.h>
 #include <vlc_url.h>
 #include <vlc_modules.h>
+#include <vlc_media_library.h>
 
 #include "libvlc.h"
 #include "playlist/playlist_internal.h"
@@ -217,6 +218,13 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
     vlc_CPU_dump( VLC_OBJECT(p_libvlc) );
 
+    if( var_InheritBool( p_libvlc, "media-library") )
+    {
+        priv->p_media_library = vlc_ml_create( p_libvlc );
+        if ( priv->p_media_library == NULL )
+            msg_Warn( p_libvlc, "Media library initialization failed" );
+    }
+
     /*
      * Initialize hotkey handling
      */
@@ -363,6 +371,9 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     msg_Dbg( p_libvlc, "removing all interfaces" );
     intf_DestroyAll( p_libvlc );
 
+    if ( priv->p_media_library )
+        vlc_ml_release( priv->p_media_library );
+
     libvlc_InternalDialogClean( p_libvlc );
     libvlc_InternalKeystoreClean( p_libvlc );
 
diff --git a/src/libvlc.h b/src/libvlc.h
index 6d807cd8a8..b8dfb59787 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -185,6 +185,7 @@ typedef struct libvlc_priv_t
     struct playlist_t *playlist; ///< Playlist for interfaces
     struct input_preparser_t *parser; ///< Input item meta data handler
     vlc_actions_t *actions; ///< Hotkeys handler
+    struct vlc_medialibrary_t *p_media_library; ///< Media library instance
 
     /* Exit callback */
     vlc_exit_t       exit;
-- 
2.18.0



More information about the vlc-devel mailing list