#include "vlc_events.h"
#include <vlc_services_discovery.h>
#include <vlc_probe.h>
+#include <vlc_modules.h>
#include "playlist_internal.h"
#include "../libvlc.h"
return VLC_PROBE_CONTINUE;
}
-struct vlc_sd_private_t
-{
- module_t * p_module;
- vlc_event_manager_t event_manager; /* Accessed through Setters for non class function */
- char *psz_name;
- config_chain_t *p_cfg;
-
-};
-
#undef vlc_sd_GetNames
/**
"services discovery" );
if( !p_sd )
return NULL;
- p_sd->p = malloc(sizeof(struct vlc_sd_private_t));
-
- free(config_ChainCreate( &p_sd->p->psz_name, &p_sd->p->p_cfg, cfg ));
+ free(config_ChainCreate( &p_sd->psz_name, &p_sd->p_cfg, cfg ));
- vlc_event_manager_t *em = &p_sd->p->event_manager;
+ vlc_event_manager_t *em = &p_sd->event_manager;
vlc_event_manager_init( em, p_sd, (vlc_object_t *)p_sd );
vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemAdded);
vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemRemoved);
{
assert(!p_sd->p_module);
- p_sd->p->p_module = module_need( p_sd, "services_discovery",
- p_sd->p->psz_name, true );
- if( p_sd->p->p_module == NULL )
+ p_sd->p_module = module_need( p_sd, "services_discovery",
+ p_sd->psz_name, true );
+ if( p_sd->p_module == NULL )
{
msg_Err( p_sd, "no suitable services discovery module" );
return false;
vlc_event_t event = {
.type = vlc_ServicesDiscoveryStarted
};
- vlc_event_send( &p_sd->p->event_manager, &event );
+ vlc_event_send( &p_sd->event_manager, &event );
return true;
}
.type = vlc_ServicesDiscoveryEnded
};
- vlc_event_send( &p_sd->p->event_manager, &event );
+ vlc_event_send( &p_sd->event_manager, &event );
- module_unneed( p_sd, p_sd->p->p_module );
- p_sd->p->p_module = NULL;
+ module_unneed( p_sd, p_sd->p_module );
+ p_sd->p_module = NULL;
}
void vlc_sd_Destroy( services_discovery_t *p_sd )
{
- config_ChainDestroy( p_sd->p->p_cfg );
- free( p_sd->p->psz_name );
- free( p_sd->p );
+ config_ChainDestroy( p_sd->p_cfg );
+ free( p_sd->psz_name );
vlc_object_release( p_sd );
}
static void services_discovery_Destructor ( vlc_object_t *p_obj )
{
services_discovery_t * p_sd = (services_discovery_t *)p_obj;
- assert(!p_sd->p->p_module); /* Forgot to call Stop */
- vlc_event_manager_fini( &p_sd->p->event_manager );
+ assert(!p_sd->p_module); /* Forgot to call Stop */
+ vlc_event_manager_fini( &p_sd->event_manager );
}
/***********************************************************************
char *
services_discovery_GetLocalizedName ( services_discovery_t * p_sd )
{
- return strdup( module_get_name( p_sd->p->p_module, true ) );
+ return strdup( module_get_name( p_sd->p_module, true ) );
}
/***********************************************************************
vlc_event_manager_t *
services_discovery_EventManager ( services_discovery_t * p_sd )
{
- return &p_sd->p->event_manager;
+ return &p_sd->event_manager;
}
/***********************************************************************
event.u.services_discovery_item_added.p_new_item = p_item;
event.u.services_discovery_item_added.psz_category = psz_category;
- vlc_event_send( &p_sd->p->event_manager, &event );
+ vlc_event_send( &p_sd->event_manager, &event );
}
/***********************************************************************
event.type = vlc_ServicesDiscoveryItemRemoved;
event.u.services_discovery_item_removed.p_item = p_item;
- vlc_event_send( &p_sd->p->event_manager, &event );
+ vlc_event_send( &p_sd->event_manager, &event );
}
/*
* Playlist - Services discovery bridge
*/
-struct vlc_playlist_sd_t
+struct vlc_sd_internal_t
{
/* the playlist items for category and onelevel */
playlist_item_t *p_node;
if( !p_cat )
{
p_cat = playlist_NodeCreate( p_playlist, psz_cat,
- p_parent, 0, NULL );
+ p_parent, PLAYLIST_END, 0, NULL );
p_cat->i_flags &= ~PLAYLIST_SKIP_FLAG;
}
p_parent = p_cat;
return VLC_ENOMEM;
/* Free in playlist_ServicesDiscoveryRemove */
- vlc_playlist_sd_t * p_sds = malloc( sizeof(*p_sds) );
+ vlc_sd_internal_t * p_sds = malloc( sizeof(*p_sds) );
if( !p_sds )
{
vlc_sd_Destroy( p_sd );
/* Look for configuration chain "longname" */
const char *psz_longname = "?";
- if( p_sd->p->p_cfg )
+ if( p_sd->p_cfg )
{
- config_chain_t *cfg = p_sd->p->p_cfg;
+ config_chain_t *cfg = p_sd->p_cfg;
while( cfg )
{
if( cfg->psz_name && !strcmp( cfg->psz_name, "longname" ) )
PL_LOCK;
p_node = playlist_NodeCreate( p_playlist, psz_longname,
- p_playlist->p_root, 0, NULL );
+ p_playlist->p_root, PLAYLIST_END, 0, NULL );
PL_UNLOCK;
vlc_event_manager_t *em = services_discovery_EventManager( p_sd );
return VLC_EGENERIC;
}
- /* We want tree-view for service directory */
- p_node->p_input->b_prefers_tree = true;
p_sds->p_sd = p_sd;
p_sds->p_node = p_node;
p_sds->psz_name = strdup( psz_name );
const char *psz_name )
{
playlist_private_t *priv = pl_priv( p_playlist );
- vlc_playlist_sd_t * p_sds = NULL;
+ vlc_sd_internal_t * p_sds = NULL;
PL_LOCK;
for( int i = 0; i < priv->i_sds; i++ )
for( int i = 0; i < priv->i_sds; i++ )
{
- vlc_playlist_sd_t *sd = priv->pp_sds[i];
+ vlc_sd_internal_t *sd = priv->pp_sds[i];
if( sd->psz_name && !strcmp( psz_name, sd->psz_name ) )
{