[vlc-commits] core: playlist: expose a main playlist instance
Romain Vimont
git at videolan.org
Thu Nov 15 16:23:43 CET 2018
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Thu Sep 27 11:07:03 2018 +0200| [62e66eea1d1392b3803767dbd3b8d91721e5e1c5] | committer: Thomas Guillem
core: playlist: expose a main playlist instance
Store a main instance of the playlist in libvlc, accessible via
vlc_intf_GetMainPlaylist().
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62e66eea1d1392b3803767dbd3b8d91721e5e1c5
---
include/vlc_interface.h | 4 ++++
src/interface/interface.c | 6 ++++++
src/libvlc.c | 9 +++++++++
src/libvlc.h | 2 ++
src/libvlccore.sym | 1 +
5 files changed, 22 insertions(+)
diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index f56eae598b..c18d32b2e7 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -30,6 +30,7 @@
extern "C" {
# endif
+typedef struct vlc_playlist vlc_playlist_t;
typedef struct intf_dialog_args_t intf_dialog_args_t;
/**
@@ -96,6 +97,9 @@ static inline playlist_t *pl_Get( struct intf_thread_t *intf )
return (playlist_t *)(intf->obj.parent);
}
+VLC_API vlc_playlist_t *
+vlc_intf_GetMainPlaylist(intf_thread_t *intf);
+
/**
* Retrieves the current input thread from the playlist.
* @note The returned object must be released with vlc_object_release().
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 510516d5c4..0f47e06fd8 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -146,6 +146,12 @@ static playlist_t *intf_GetPlaylist(libvlc_int_t *libvlc)
return playlist;
}
+vlc_playlist_t *
+vlc_intf_GetMainPlaylist(intf_thread_t *intf)
+{
+ return libvlc_priv(intf->obj.libvlc)->main_playlist;
+}
+
/**
* Inserts an item in the playlist.
*
diff --git a/src/libvlc.c b/src/libvlc.c
index 6e4090efb0..7516c43b74 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -52,6 +52,7 @@
#include "config/vlc_getopt.h"
#include <vlc_playlist_legacy.h>
+#include <vlc_playlist.h>
#include <vlc_interface.h>
#include <vlc_actions.h>
@@ -94,6 +95,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
priv = libvlc_priv (p_libvlc);
priv->playlist = NULL;
+ priv->main_playlist = NULL;
priv->p_vlm = NULL;
vlc_ExitInit( &priv->exit );
@@ -281,6 +283,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
}
#endif
+ priv->main_playlist = vlc_playlist_New(VLC_OBJECT(p_libvlc));
+ if (unlikely(!priv->main_playlist))
+ goto error;
+
/*
* Load background interfaces
*/
@@ -408,6 +414,9 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
if (priv->parser != NULL)
input_preparser_Delete(priv->parser);
+ if (priv->main_playlist)
+ vlc_playlist_Delete(priv->main_playlist);
+
libvlc_InternalActionsClean( p_libvlc );
/* Save the configuration */
diff --git a/src/libvlc.h b/src/libvlc.h
index 6b585807e4..c8bd7394e3 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -183,6 +183,7 @@ void vlc_objres_remove(vlc_object_t *obj, void *data,
typedef struct vlc_dialog_provider vlc_dialog_provider;
typedef struct vlc_keystore vlc_keystore;
typedef struct vlc_actions_t vlc_actions_t;
+typedef struct vlc_playlist vlc_playlist_t;
typedef struct libvlc_priv_t
{
@@ -194,6 +195,7 @@ typedef struct libvlc_priv_t
vlc_dialog_provider *p_dialog_provider; ///< dialog provider
vlc_keystore *p_memory_keystore; ///< memory keystore
struct playlist_t *playlist; ///< Playlist for interfaces
+ vlc_playlist_t *main_playlist;
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
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 3a88031d21..41e9ac18f0 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -946,3 +946,4 @@ vlc_playlist_Stop
vlc_playlist_Pause
vlc_playlist_Resume
vlc_playlist_Preparse
+vlc_intf_GetMainPlaylist
More information about the vlc-commits
mailing list