Commit 3d4efe3b authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

playlist/services_discovery.c: Improved services_discovery object, playlist...

playlist/services_discovery.c: Improved services_discovery object, playlist independant. Now, the services_discovery plugin have to be converted to use this interface.
parent 1479b918
...@@ -112,6 +112,10 @@ typedef enum vlc_event_type_t { ...@@ -112,6 +112,10 @@ typedef enum vlc_event_type_t {
/* Input item events */ /* Input item events */
vlc_InputItemMetaChanged, vlc_InputItemMetaChanged,
vlc_InputItemSubItemAdded, vlc_InputItemSubItemAdded,
/* Service Discovery event */
vlc_ServicesDiscoveryItemAdded,
vlc_ServicesDiscoveryItemRemoved
} vlc_event_type_t; } vlc_event_type_t;
/* Event definition */ /* Event definition */
...@@ -130,6 +134,18 @@ typedef struct vlc_event_t ...@@ -130,6 +134,18 @@ typedef struct vlc_event_t
{ {
input_item_t * p_new_child; input_item_t * p_new_child;
} input_item_subitem_added; } input_item_subitem_added;
/* Service discovery events */
struct vlc_services_discovery_item_added
{
input_item_t * p_new_item;
const char * psz_category;
} services_discovery_item_added;
struct vlc_services_discovery_item_removed
{
input_item_t * p_item;
} services_discovery_item_removed;
} u; } u;
} vlc_event_t; } vlc_event_t;
......
...@@ -34,6 +34,7 @@ extern "C" { ...@@ -34,6 +34,7 @@ extern "C" {
#include <assert.h> #include <assert.h>
#include <vlc_input.h> #include <vlc_input.h>
#include <vlc_events.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -161,9 +162,11 @@ typedef enum ...@@ -161,9 +162,11 @@ typedef enum
struct services_discovery_t struct services_discovery_t
{ {
VLC_COMMON_MEMBERS 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; services_discovery_sys_t *p_sys;
void (*pf_run) ( services_discovery_t *); void (*pf_run) ( services_discovery_t *);
...@@ -409,6 +412,31 @@ VLC_EXPORT( playlist_item_t *, playlist_GetNextLeaf, ( playlist_t *p_playlist, p ...@@ -409,6 +412,31 @@ VLC_EXPORT( playlist_item_t *, playlist_GetNextLeaf, ( playlist_t *p_playlist, p
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_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 ) ); VLC_EXPORT( playlist_item_t *, playlist_GetLastLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root ) );
/***********************************************************************
* Service Discovery
***********************************************************************/
/* XXX: no need to inline */
/* XXX: no need to inline */
/* Return the number of services_discovery available */
/* 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 ) );
/* Read info from discovery object */
VLC_EXPORT( const 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 * Inline functions
***********************************************************************/ ***********************************************************************/
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment