[vlc-devel] [RFC PATCH 7/8] TMP: Instantiate media library from playlist
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Mon Jun 25 10:10:05 CEST 2018
---
include/vlc_playlist.h | 2 ++
src/playlist/engine.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 51f1d0e82b..2351ecbe82 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -156,6 +156,8 @@ struct playlist_t
/* Predefined items */
playlist_item_t root;
playlist_item_t *p_playing;
+
+ struct vlc_medialibrary_t *p_media_library;
};
/* A bit of macro magic to generate an enum out of the following list,
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 05afa2240f..91d5644233 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -35,6 +35,7 @@
#include <vlc_interface.h>
#include <vlc_http.h>
#include <vlc_renderer_discovery.h>
+#include <vlc_media_library.h>
#include "playlist_internal.h"
#include "input/resource.h"
@@ -226,6 +227,13 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
p_playlist->root.i_id = 0;
p_playlist->root.i_flags = 0;
+ if( var_InheritBool( p_parent, "media-library") )
+ {
+ p_playlist->p_media_library = vlc_ml_create( p_playlist );
+ if ( p_playlist->p_media_library == NULL )
+ abort();
+ }
+
/* Create the root, playing items nodes */
playlist_item_t *playing;
@@ -305,6 +313,9 @@ void playlist_Destroy( playlist_t *p_playlist )
if( p_sys->p_renderer )
vlc_renderer_item_release( p_sys->p_renderer );
+ if ( p_playlist->p_media_library )
+ vlc_ml_release( p_playlist->p_media_library );
+
PL_LOCK;
/* Release the current node */
set_current_status_node( p_playlist, NULL );
--
2.18.0
More information about the vlc-devel
mailing list