[vlc-commits] libvlc: Instantiate media library module

Hugo Beauzée-Luyssen git at videolan.org
Tue Jul 17 23:28:11 CEST 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jun 18 15:19:53 2018 +0200| [06b8b127c1bf2b07c1e6b8bb6e868bb335ffc515] | committer: Hugo Beauzée-Luyssen

libvlc: Instantiate media library module

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

 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..8e9eea58a9 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 = libvlc_MlCreate( 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 )
+        libvlc_MlRelease( 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;



More information about the vlc-commits mailing list