Commit 3828287d authored by Rafaël Carré's avatar Rafaël Carré

services_discovery_SetLocalizedName() is now mandatory. Fix #1344

upnp_intel module still has to be rewritten (it will crash at runtime)
parent 72757e93
...@@ -124,12 +124,16 @@ static int Open( vlc_object_t *p_this, int i_type ) ...@@ -124,12 +124,16 @@ static int Open( vlc_object_t *p_this, int i_type )
switch( i_type ) switch( i_type )
{ {
case TV: case TV:
services_discovery_SetLocalizedName( p_sd, _("Shoutcast TV") );
p_sys->p_input = input_ItemNewExt( p_sd, p_sys->p_input = input_ItemNewExt( p_sd,
SHOUTCAST_TV_BASE_URL, _("Shoutcast TV"), SHOUTCAST_TV_BASE_URL, _("Shoutcast TV"),
0, NULL, -1 ); 0, NULL, -1 );
break; break;
case RADIO: case RADIO:
default: default:
services_discovery_SetLocalizedName( p_sd, _("Shoutcast Radio") );
p_sys->p_input = input_ItemNewExt( p_sd, p_sys->p_input = input_ItemNewExt( p_sd,
SHOUTCAST_BASE_URL, _("Shoutcast Radio"), SHOUTCAST_BASE_URL, _("Shoutcast Radio"),
0, NULL, -1 ); 0, NULL, -1 );
...@@ -139,15 +143,25 @@ static int Open( vlc_object_t *p_this, int i_type ) ...@@ -139,15 +143,25 @@ static int Open( vlc_object_t *p_this, int i_type )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/*****************************************************************************
* ItemAdded:
*****************************************************************************/
static void ItemAdded( const vlc_event_t * p_event, void * user_data )
{
services_discovery_t *p_sd = user_data;
services_discovery_AddItem( p_sd,
p_event->u.input_item_subitem_added.p_new_child,
NULL /* no category */ );
}
/***************************************************************************** /*****************************************************************************
* Run: * Run:
*****************************************************************************/ *****************************************************************************/
static void Run( services_discovery_t *p_sd ) static void Run( services_discovery_t *p_sd )
{ {
p_sd->p_sys->p_input->b_prefers_tree = VLC_TRUE; vlc_event_attach( &p_sd->p_sys->p_input->event_manager, vlc_InputItemSubItemAdded, ItemAdded, p_sd );
services_discovery_AddItem( p_sd, p_sd->p_sys->p_input, NULL /* no category */ ); input_Read( p_sd, p_sd->p_sys->p_input, VLC_TRUE );
vlc_event_detach( &p_sd->p_sys->p_input->event_manager, vlc_InputItemSubItemAdded, ItemAdded, p_sd );
input_Read( p_sd, p_sd->p_sys->p_input, VLC_FALSE );
} }
/***************************************************************************** /*****************************************************************************
...@@ -157,6 +171,5 @@ static void Close( vlc_object_t *p_this ) ...@@ -157,6 +171,5 @@ static void Close( 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_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
services_discovery_RemoveItem( p_sd, p_sys->p_input );
free( p_sys ); free( p_sys );
} }
...@@ -282,20 +282,10 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modu ...@@ -282,20 +282,10 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modu
continue; continue;
char * psz = services_discovery_GetLocalizedName( p_sd ); char * psz = services_discovery_GetLocalizedName( p_sd );
if( psz ) assert( psz );
{
playlist_NodesPairCreate( p_playlist, psz, playlist_NodesPairCreate( p_playlist, psz,
&p_cat, &p_one, VLC_FALSE ); &p_cat, &p_one, VLC_FALSE );
free( psz ); free( psz );
}
else
{
/* No name, just add at the top of the playlist */
PL_LOCK;
p_cat = p_playlist->p_root_category;
p_one = p_playlist->p_root_onelevel;
PL_UNLOCK;
}
vlc_event_attach( services_discovery_EventManager( p_sd ), vlc_event_attach( services_discovery_EventManager( p_sd ),
vlc_ServicesDiscoveryItemAdded, vlc_ServicesDiscoveryItemAdded,
......
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