#include <assert.h>
#include <vlc_input.h>
+#include <vlc_events.h>
#include <stdio.h>
#include <stdlib.h>
int i_id; /**< Playlist item specific id */
uint8_t i_flags; /**< Flags */
+ playlist_t *p_playlist; /**< Parent playlist */
};
#define PLAYLIST_SAVE_FLAG 0x0001 /**< Must it be saved */
struct services_discovery_t
{
VLC_COMMON_MEMBERS
- char *psz_module;
+ char * psz_module;
+ module_t * p_module;
- module_t *p_module;
+ char * psz_localized_name; /* Accessed through Setters for non class function */
+ vlc_event_manager_t event_manager; /* Accessed through Setters for non class function */
services_discovery_sys_t *p_sys;
void (*pf_run) ( services_discovery_t *);
struct playlist_t
{
VLC_COMMON_MEMBERS
+ struct playlist_internal_t * p_internal; /**< Internal members */
+
int i_enabled; /**< How many items are enabled ? */
playlist_item_array_t items; /**< Arrays of items */
int i_last_playlist_id; /**< Last id to an item */
int i_last_input_id ; /**< Last id on an input */
- services_discovery_t **pp_sds; /**< Loaded service discovery modules */
- int i_sds; /**< Number of service discovery modules */
-
/* Predefined items */
playlist_item_t * p_root_category; /**< Root of category tree */
playlist_item_t * p_root_onelevel; /**< Root of onelevel tree */
playlist_item_t * p_local_category; /** < "Playlist" in CATEGORY view */
playlist_item_t * p_ml_category; /** < "Library" in CATEGORY view */
playlist_item_t * p_local_onelevel; /** < "Playlist" in ONELEVEL view */
- playlist_item_t * p_ml_onelevel; /** < "Library" in ONELEVEL iew */
+ playlist_item_t * p_ml_onelevel; /** < "Library" in ONELEVEL view */
vlc_bool_t b_always_tree;/**< Always display as tree */
vlc_bool_t b_never_tree;/**< Never display as tree */
- vlc_bool_t b_doing_ml; /**< Doing media library stuff, */
- /*get quicker */
+ vlc_bool_t b_doing_ml; /**< Doing media library stuff,
+ * get quicker */
vlc_bool_t b_auto_preparse;
/* Runtime */
/*************************** Item deletion **************************/
VLC_EXPORT( int, playlist_DeleteFromInput, ( playlist_t *, int, vlc_bool_t ) );
+VLC_EXPORT( int, playlist_DeleteInputInParent, ( playlist_t *, int, playlist_item_t *, vlc_bool_t ) );
/*************************** Item fields accessors **************************/
VLC_EXPORT( int, playlist_ItemSetName, (playlist_item_t *, const char * ) );
VLC_EXPORT( playlist_item_t *, playlist_GetPrevLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, vlc_bool_t b_ena, vlc_bool_t b_unplayed ) );
VLC_EXPORT( playlist_item_t *, playlist_GetLastLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root ) );
+/***********************************************************************
+ * Service Discovery
+ ***********************************************************************/
+
+/* Get the services discovery modules names to use in Create(), in a null
+ * terminated string array. Array and string must be freed after use. */
+VLC_EXPORT( char **, services_discovery_GetServicesNames, ( vlc_object_t * p_super ) );
+
+/* Creation of a service_discovery object */
+VLC_EXPORT( services_discovery_t *, services_discovery_Create, ( vlc_object_t * p_super, const char * psz_service_name ) );
+VLC_EXPORT( void, services_discovery_Destroy, ( services_discovery_t * p_this ) );
+VLC_EXPORT( int, services_discovery_Start, ( services_discovery_t * p_this ) );
+VLC_EXPORT( void, services_discovery_Stop, ( services_discovery_t * p_this ) );
+
+/* Read info from discovery object */
+VLC_EXPORT( char *, services_discovery_GetLocalizedName, ( services_discovery_t * p_this ) );
+
+/* Receive event notification (prefered way to get new items) */
+VLC_EXPORT( vlc_event_manager_t *, services_discovery_EventManager, ( services_discovery_t * p_this ) );
+
+/* Used by services_discovery to post update about their items */
+VLC_EXPORT( void, services_discovery_SetLocalizedName, ( services_discovery_t * p_this, const char * ) );
+ /* About the psz_category, it is a legacy way to add info to the item,
+ * for more options, directly set the (meta) data on the input item */
+VLC_EXPORT( void, services_discovery_AddItem, ( services_discovery_t * p_this, input_item_t * p_item, const char * psz_category ) );
+VLC_EXPORT( void, services_discovery_RemoveItem, ( services_discovery_t * p_this, input_item_t * p_item ) );
+
/***********************************************************************
* Inline functions
***********************************************************************/
/** Open a playlist file, add its content to the current playlist */
-static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file){
+static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file)
+{
char psz_uri[256+10];
input_item_t *p_input;
snprintf( psz_uri, 256+9, "file/://%s", psz_file );