Commit 64fb2cd1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Restore SD human-readable names

parent eac4e0c9
...@@ -46,7 +46,6 @@ struct services_discovery_t ...@@ -46,7 +46,6 @@ struct services_discovery_t
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 */ 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;
...@@ -86,7 +85,6 @@ VLC_EXPORT( char *, services_discovery_GetLocalizedName, ( servi ...@@ -86,7 +85,6 @@ VLC_EXPORT( char *, services_discovery_GetLocalizedName, ( servi
VLC_EXPORT( vlc_event_manager_t *, services_discovery_EventManager, ( services_discovery_t * p_this ) ); VLC_EXPORT( vlc_event_manager_t *, services_discovery_EventManager, ( services_discovery_t * p_this ) );
/* Used by services_discovery to post update about their items */ /* 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, /* 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 */ * 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_AddItem, ( services_discovery_t * p_this, input_item_t * p_item, const char * psz_category ) );
......
...@@ -282,8 +282,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -282,8 +282,6 @@ static int Open( vlc_object_t *p_this )
goto error; goto error;
} }
services_discovery_SetLocalizedName( p_sd, _("Bonjour") );
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
......
...@@ -145,8 +145,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -145,8 +145,6 @@ static int Open( vlc_object_t *p_this )
if( vlc_clone( &p_sys->thread, Run, p_this, VLC_THREAD_PRIORITY_LOW ) ) if( vlc_clone( &p_sys->thread, Run, p_this, VLC_THREAD_PRIORITY_LOW ) )
goto error; goto error;
services_discovery_SetLocalizedName( p_sd, _("Devices") );
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
dbus_error_free( &dbus_error ); dbus_error_free( &dbus_error );
......
...@@ -123,8 +123,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -123,8 +123,6 @@ static int Open( vlc_object_t *p_this )
p_sys->b_update = true; p_sys->b_update = true;
p_sd->p_sys = p_sys; p_sd->p_sys = p_sys;
/* Give us a name */
services_discovery_SetLocalizedName( p_sd, _("Podcasts") );
/* Launch the callback associated with this variable */ /* Launch the callback associated with this variable */
var_Create( p_sd, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_sd, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
......
...@@ -320,9 +320,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -320,9 +320,6 @@ static int Open( vlc_object_t *p_this )
/* Cache sap_timeshift value */ /* Cache sap_timeshift value */
p_sys->b_timeshift = var_CreateGetInteger( p_sd, "sap-timeshift" ); p_sys->b_timeshift = var_CreateGetInteger( p_sd, "sap-timeshift" );
/* Set our name */
services_discovery_SetLocalizedName( p_sd, _("SAP") );
p_sys->i_announces = 0; p_sys->i_announces = 0;
p_sys->pp_announces = NULL; p_sys->pp_announces = NULL;
/* TODO: create sockets here, and fix racy sockets table */ /* TODO: create sockets here, and fix racy sockets table */
......
...@@ -153,7 +153,6 @@ struct services_discovery_sys_t ...@@ -153,7 +153,6 @@ struct services_discovery_sys_t
static int Open( vlc_object_t *p_this, enum type_e i_type ) static int Open( vlc_object_t *p_this, enum type_e i_type )
{ {
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_SetLocalizedName( p_sd, _(p_items[i_type].psz_name) );
p_sd->p_sys = malloc (sizeof (*(p_sd->p_sys))); p_sd->p_sys = malloc (sizeof (*(p_sd->p_sys)));
if (p_sd->p_sys == NULL) if (p_sd->p_sys == NULL)
......
...@@ -125,8 +125,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -125,8 +125,6 @@ static int Open( vlc_object_t *p_this )
{ {
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_SetLocalizedName( p_sd, _("Devices") );
UPnPHandler *u = new UPnPHandler( p_sd ); UPnPHandler *u = new UPnPHandler( p_sd );
u->start( ); u->start( );
msg_Dbg( p_sd, "upnp discovery started" ); msg_Dbg( p_sd, "upnp discovery started" );
......
...@@ -90,8 +90,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -90,8 +90,6 @@ static int Open( vlc_object_t *p_this )
if(!(p_sd->p_sys = p_sys)) if(!(p_sd->p_sys = p_sys))
return VLC_ENOMEM; return VLC_ENOMEM;
services_discovery_SetLocalizedName( p_sd, _("UPnP devices") );
res = UpnpInit( 0, 0 ); res = UpnpInit( 0, 0 );
if( res != UPNP_E_SUCCESS ) if( res != UPNP_E_SUCCESS )
{ {
......
...@@ -322,7 +322,6 @@ services_discovery_EventManager ...@@ -322,7 +322,6 @@ services_discovery_EventManager
services_discovery_GetLocalizedName services_discovery_GetLocalizedName
__services_discovery_GetServicesNames __services_discovery_GetServicesNames
services_discovery_RemoveItem services_discovery_RemoveItem
services_discovery_SetLocalizedName
services_discovery_Start services_discovery_Start
services_discovery_Stop services_discovery_Stop
sout_AccessOutControl sout_AccessOutControl
......
...@@ -64,7 +64,6 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name ...@@ -64,7 +64,6 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name
if( !p_sd ) if( !p_sd )
return NULL; return NULL;
p_sd->psz_localized_name = strdup( "Unnamed service discovery" ); // FIXME: Set that back to NULL
p_sd->psz_module = strdup( psz_module_name ); p_sd->psz_module = strdup( psz_module_name );
vlc_event_manager_init( &p_sd->event_manager, p_sd, (vlc_object_t *)p_sd ); vlc_event_manager_init( &p_sd->event_manager, p_sd, (vlc_object_t *)p_sd );
...@@ -141,10 +140,7 @@ static void services_discovery_Destructor ( services_discovery_t * p_sd ) ...@@ -141,10 +140,7 @@ static void services_discovery_Destructor ( services_discovery_t * p_sd )
assert(!p_sd->p_module); /* Forgot to call Stop */ assert(!p_sd->p_module); /* Forgot to call Stop */
vlc_event_manager_fini( &p_sd->event_manager ); vlc_event_manager_fini( &p_sd->event_manager );
free( p_sd->psz_module ); free( p_sd->psz_module );
free( p_sd->psz_localized_name );
vlc_object_release( p_sd ); vlc_object_release( p_sd );
} }
...@@ -154,17 +150,7 @@ static void services_discovery_Destructor ( services_discovery_t * p_sd ) ...@@ -154,17 +150,7 @@ static void services_discovery_Destructor ( services_discovery_t * p_sd )
char * char *
services_discovery_GetLocalizedName ( services_discovery_t * p_sd ) services_discovery_GetLocalizedName ( services_discovery_t * p_sd )
{ {
return p_sd->psz_localized_name ? strdup( p_sd->psz_localized_name ) : NULL; return strdup( module_get_name( p_sd->p_module, true ) );
}
/***********************************************************************
* SetLocalizedName
***********************************************************************/
void
services_discovery_SetLocalizedName ( services_discovery_t * p_sd, const char *psz )
{
free( p_sd->psz_localized_name );
p_sd->psz_localized_name = strdup(psz);
} }
/*********************************************************************** /***********************************************************************
...@@ -308,15 +294,6 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modu ...@@ -308,15 +294,6 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modu
if( !p_sd ) if( !p_sd )
continue; continue;
/* FIXME: Thanks to previous changeset this is broken */
char * psz = services_discovery_GetLocalizedName( p_sd );
assert( psz );
PL_LOCK;
playlist_NodesPairCreate( p_playlist, psz,
&p_cat, &p_one, false );
PL_UNLOCK;
free( psz );
vlc_event_attach( services_discovery_EventManager( p_sd ), vlc_event_attach( services_discovery_EventManager( p_sd ),
vlc_ServicesDiscoveryItemAdded, vlc_ServicesDiscoveryItemAdded,
playlist_sd_item_added, playlist_sd_item_added,
...@@ -343,7 +320,15 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modu ...@@ -343,7 +320,15 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modu
vlc_object_release( p_sd ); vlc_object_release( p_sd );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
char *psz = services_discovery_GetLocalizedName( p_sd );
assert( psz );
PL_LOCK;
playlist_NodesPairCreate( p_playlist, psz,
&p_cat, &p_one, false );
PL_UNLOCK;
free( psz );
/* Free in playlist_ServicesDiscoveryRemove */ /* Free in playlist_ServicesDiscoveryRemove */
p_sds = malloc( sizeof(struct playlist_services_discovery_support_t) ); p_sds = malloc( sizeof(struct playlist_services_discovery_support_t) );
if( !p_sds ) if( !p_sds )
......
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