Commit 55abf4ec authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Revert "sd: Make most members private."

This reverts commit 786292c3.

Apparently, compiling libvlccore (on any platform) is too much to ask.
parent 350b1052
...@@ -44,7 +44,13 @@ extern "C" { ...@@ -44,7 +44,13 @@ extern "C" {
struct services_discovery_t struct services_discovery_t
{ {
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
struct vlc_sd_private_t *p; 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;
services_discovery_sys_t *p_sys; services_discovery_sys_t *p_sys;
}; };
......
...@@ -231,7 +231,7 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, ...@@ -231,7 +231,7 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
if( !vlc_sd_Start( p_mdis->p_sd ) ) if( !vlc_sd_Start( p_mdis->p_sd ) )
{ {
libvlc_printerr( "%s: internal module error", libvlc_printerr( "%s: internal module error",
psz_name ); p_mdis->p_sd->psz_name );
libvlc_media_list_release( p_mdis->p_mlist ); libvlc_media_list_release( p_mdis->p_mlist );
libvlc_event_manager_release( p_mdis->p_event_manager ); libvlc_event_manager_release( p_mdis->p_event_manager );
free( p_mdis ); free( p_mdis );
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "fetcher.h" #include "fetcher.h"
#include "preparser.h" #include "preparser.h"
typedef struct vlc_playlist_sd_t vlc_playlist_sd_t; typedef struct vlc_sd_internal_t vlc_sd_internal_t;
typedef struct playlist_private_t typedef struct playlist_private_t
{ {
...@@ -52,7 +52,7 @@ typedef struct playlist_private_t ...@@ -52,7 +52,7 @@ typedef struct playlist_private_t
playlist_item_array_t items_to_delete; /**< Array of items and nodes to playlist_item_array_t items_to_delete; /**< Array of items and nodes to
delete... At the very end. This sucks. */ delete... At the very end. This sucks. */
vlc_playlist_sd_t **pp_sds; vlc_sd_internal_t **pp_sds;
int i_sds; /**< Number of service discovery modules */ int i_sds; /**< Number of service discovery modules */
input_thread_t * p_input; /**< the input thread associated input_thread_t * p_input; /**< the input thread associated
* with the current item */ * with the current item */
......
...@@ -55,15 +55,6 @@ int vlc_sd_probe_Add (vlc_probe_t *probe, const char *name, ...@@ -55,15 +55,6 @@ int vlc_sd_probe_Add (vlc_probe_t *probe, const char *name,
return VLC_PROBE_CONTINUE; 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 #undef vlc_sd_GetNames
/** /**
...@@ -123,11 +114,9 @@ services_discovery_t *vlc_sd_Create( vlc_object_t *p_super, ...@@ -123,11 +114,9 @@ services_discovery_t *vlc_sd_Create( vlc_object_t *p_super,
"services discovery" ); "services discovery" );
if( !p_sd ) if( !p_sd )
return NULL; return NULL;
p_sd->p = malloc(sizeof(struct vlc_sd_private_t)); free(config_ChainCreate( &p_sd->psz_name, &p_sd->p_cfg, cfg ));
free(config_ChainCreate( &p_sd->p->psz_name, &p_sd->p->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_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_ServicesDiscoveryItemAdded);
vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemRemoved); vlc_event_manager_register_event_type(em, vlc_ServicesDiscoveryItemRemoved);
...@@ -147,9 +136,9 @@ bool vlc_sd_Start ( services_discovery_t * p_sd ) ...@@ -147,9 +136,9 @@ bool vlc_sd_Start ( services_discovery_t * p_sd )
{ {
assert(!p_sd->p_module); assert(!p_sd->p_module);
p_sd->p->p_module = module_need( p_sd, "services_discovery", p_sd->p_module = module_need( p_sd, "services_discovery",
p_sd->p->psz_name, true ); p_sd->psz_name, true );
if( p_sd->p->p_module == NULL ) if( p_sd->p_module == NULL )
{ {
msg_Err( p_sd, "no suitable services discovery module" ); msg_Err( p_sd, "no suitable services discovery module" );
return false; return false;
...@@ -158,7 +147,7 @@ bool vlc_sd_Start ( services_discovery_t * p_sd ) ...@@ -158,7 +147,7 @@ bool vlc_sd_Start ( services_discovery_t * p_sd )
vlc_event_t event = { vlc_event_t event = {
.type = vlc_ServicesDiscoveryStarted .type = vlc_ServicesDiscoveryStarted
}; };
vlc_event_send( &p_sd->p->event_manager, &event ); vlc_event_send( &p_sd->event_manager, &event );
return true; return true;
} }
...@@ -171,17 +160,16 @@ void vlc_sd_Stop ( services_discovery_t * p_sd ) ...@@ -171,17 +160,16 @@ void vlc_sd_Stop ( services_discovery_t * p_sd )
.type = vlc_ServicesDiscoveryEnded .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 ); module_unneed( p_sd, p_sd->p_module );
p_sd->p->p_module = NULL; p_sd->p_module = NULL;
} }
void vlc_sd_Destroy( services_discovery_t *p_sd ) void vlc_sd_Destroy( services_discovery_t *p_sd )
{ {
config_ChainDestroy( p_sd->p->p_cfg ); config_ChainDestroy( p_sd->p_cfg );
free( p_sd->p->psz_name ); free( p_sd->psz_name );
free( p_sd->p );
vlc_object_release( p_sd ); vlc_object_release( p_sd );
} }
...@@ -191,8 +179,8 @@ void vlc_sd_Destroy( services_discovery_t *p_sd ) ...@@ -191,8 +179,8 @@ void vlc_sd_Destroy( services_discovery_t *p_sd )
static void services_discovery_Destructor ( vlc_object_t *p_obj ) static void services_discovery_Destructor ( vlc_object_t *p_obj )
{ {
services_discovery_t * p_sd = (services_discovery_t *)p_obj; services_discovery_t * p_sd = (services_discovery_t *)p_obj;
assert(!p_sd->p->p_module); /* Forgot to call Stop */ assert(!p_sd->p_module); /* Forgot to call Stop */
vlc_event_manager_fini( &p_sd->p->event_manager ); vlc_event_manager_fini( &p_sd->event_manager );
} }
/*********************************************************************** /***********************************************************************
...@@ -201,7 +189,7 @@ static void services_discovery_Destructor ( vlc_object_t *p_obj ) ...@@ -201,7 +189,7 @@ static void services_discovery_Destructor ( vlc_object_t *p_obj )
char * char *
services_discovery_GetLocalizedName ( services_discovery_t * p_sd ) 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 ) );
} }
/*********************************************************************** /***********************************************************************
...@@ -210,7 +198,7 @@ services_discovery_GetLocalizedName ( services_discovery_t * p_sd ) ...@@ -210,7 +198,7 @@ services_discovery_GetLocalizedName ( services_discovery_t * p_sd )
vlc_event_manager_t * vlc_event_manager_t *
services_discovery_EventManager ( services_discovery_t * p_sd ) services_discovery_EventManager ( services_discovery_t * p_sd )
{ {
return &p_sd->p->event_manager; return &p_sd->event_manager;
} }
/*********************************************************************** /***********************************************************************
...@@ -225,7 +213,7 @@ services_discovery_AddItem ( services_discovery_t * p_sd, input_item_t * p_item, ...@@ -225,7 +213,7 @@ services_discovery_AddItem ( services_discovery_t * p_sd, input_item_t * p_item,
event.u.services_discovery_item_added.p_new_item = p_item; event.u.services_discovery_item_added.p_new_item = p_item;
event.u.services_discovery_item_added.psz_category = psz_category; 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 );
} }
/*********************************************************************** /***********************************************************************
...@@ -238,14 +226,14 @@ services_discovery_RemoveItem ( services_discovery_t * p_sd, input_item_t * p_it ...@@ -238,14 +226,14 @@ services_discovery_RemoveItem ( services_discovery_t * p_sd, input_item_t * p_it
event.type = vlc_ServicesDiscoveryItemRemoved; event.type = vlc_ServicesDiscoveryItemRemoved;
event.u.services_discovery_item_removed.p_item = p_item; 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 * Playlist - Services discovery bridge
*/ */
struct vlc_playlist_sd_t struct vlc_sd_internal_t
{ {
/* the playlist items for category and onelevel */ /* the playlist items for category and onelevel */
playlist_item_t *p_node; playlist_item_t *p_node;
...@@ -324,7 +312,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, ...@@ -324,7 +312,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,
return VLC_ENOMEM; return VLC_ENOMEM;
/* Free in playlist_ServicesDiscoveryRemove */ /* 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 ) if( !p_sds )
{ {
vlc_sd_Destroy( p_sd ); vlc_sd_Destroy( p_sd );
...@@ -335,9 +323,9 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, ...@@ -335,9 +323,9 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,
/* Look for configuration chain "longname" */ /* Look for configuration chain "longname" */
const char *psz_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 ) while( cfg )
{ {
if( cfg->psz_name && !strcmp( cfg->psz_name, "longname" ) ) if( cfg->psz_name && !strcmp( cfg->psz_name, "longname" ) )
...@@ -385,7 +373,7 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist, ...@@ -385,7 +373,7 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
const char *psz_name ) const char *psz_name )
{ {
playlist_private_t *priv = pl_priv( p_playlist ); playlist_private_t *priv = pl_priv( p_playlist );
vlc_playlist_sd_t * p_sds = NULL; vlc_sd_internal_t * p_sds = NULL;
PL_LOCK; PL_LOCK;
for( int i = 0; i < priv->i_sds; i++ ) for( int i = 0; i < priv->i_sds; i++ )
...@@ -441,7 +429,7 @@ bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist, ...@@ -441,7 +429,7 @@ bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
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 ) ) if( sd->psz_name && !strcmp( psz_name, sd->psz_name ) )
{ {
......
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