[vlc-devel] commit: Restore SD human-readable names ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 10 18:15:37 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 10 19:11:31 2009 +0200| [64fb2cd16e78f0862051020f33a998626b2340bf] | committer: Rémi Denis-Courmont 

Restore SD human-readable names

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64fb2cd16e78f0862051020f33a998626b2340bf
---

 include/vlc_services_discovery.h          |    2 -
 modules/services_discovery/bonjour.c      |    2 -
 modules/services_discovery/hal.c          |    2 -
 modules/services_discovery/podcast.c      |    2 -
 modules/services_discovery/sap.c          |    3 --
 modules/services_discovery/shout.c        |    1 -
 modules/services_discovery/upnp_cc.cpp    |    2 -
 modules/services_discovery/upnp_intel.cpp |    2 -
 src/libvlccore.sym                        |    1 -
 src/playlist/services_discovery.c         |   35 ++++++++--------------------
 10 files changed, 10 insertions(+), 42 deletions(-)

diff --git a/include/vlc_services_discovery.h b/include/vlc_services_discovery.h
index e6778af..ac50559 100644
--- a/include/vlc_services_discovery.h
+++ b/include/vlc_services_discovery.h
@@ -46,7 +46,6 @@ struct services_discovery_t
     char *              psz_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;
@@ -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 ) );
 
 /* 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 ) );
diff --git a/modules/services_discovery/bonjour.c b/modules/services_discovery/bonjour.c
index 23a30e8..a22bbe8 100644
--- a/modules/services_discovery/bonjour.c
+++ b/modules/services_discovery/bonjour.c
@@ -282,8 +282,6 @@ static int Open( vlc_object_t *p_this )
         goto error;
     }
 
-    services_discovery_SetLocalizedName( p_sd, _("Bonjour") );
-
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/services_discovery/hal.c b/modules/services_discovery/hal.c
index bd4e8e1..a4ef703 100644
--- a/modules/services_discovery/hal.c
+++ b/modules/services_discovery/hal.c
@@ -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 ) )
         goto error;
 
-    services_discovery_SetLocalizedName( p_sd, _("Devices") );
-
     return VLC_SUCCESS;
 error:
     dbus_error_free( &dbus_error );
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index a59ae2e..ceaf68f 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -123,8 +123,6 @@ static int Open( vlc_object_t *p_this )
     p_sys->b_update = true;
 
     p_sd->p_sys  = p_sys;
-    /* Give us a name */
-    services_discovery_SetLocalizedName( p_sd, _("Podcasts") );
 
     /* Launch the callback associated with this variable */
     var_Create( p_sd, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 6e61f22..159a581 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -320,9 +320,6 @@ static int Open( vlc_object_t *p_this )
     /* Cache sap_timeshift value */
     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->pp_announces = NULL;
     /* TODO: create sockets here, and fix racy sockets table */
diff --git a/modules/services_discovery/shout.c b/modules/services_discovery/shout.c
index c6148ba..2e4191b 100644
--- a/modules/services_discovery/shout.c
+++ b/modules/services_discovery/shout.c
@@ -153,7 +153,6 @@ struct services_discovery_sys_t
 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_SetLocalizedName( p_sd, _(p_items[i_type].psz_name) );
 
     p_sd->p_sys = malloc (sizeof (*(p_sd->p_sys)));
     if (p_sd->p_sys == NULL)
diff --git a/modules/services_discovery/upnp_cc.cpp b/modules/services_discovery/upnp_cc.cpp
index 3ec13c1..09bce0f 100644
--- a/modules/services_discovery/upnp_cc.cpp
+++ b/modules/services_discovery/upnp_cc.cpp
@@ -125,8 +125,6 @@ static int Open( vlc_object_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 );
     u->start( );
     msg_Dbg( p_sd, "upnp discovery started" );
diff --git a/modules/services_discovery/upnp_intel.cpp b/modules/services_discovery/upnp_intel.cpp
index 3876947..45749e0 100644
--- a/modules/services_discovery/upnp_intel.cpp
+++ b/modules/services_discovery/upnp_intel.cpp
@@ -90,8 +90,6 @@ static int Open( vlc_object_t *p_this )
     if(!(p_sd->p_sys = p_sys))
         return VLC_ENOMEM;
 
-    services_discovery_SetLocalizedName( p_sd, _("UPnP devices") );
-
     res = UpnpInit( 0, 0 );
     if( res != UPNP_E_SUCCESS )
     {
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 74731fc..cccfeea 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -322,7 +322,6 @@ services_discovery_EventManager
 services_discovery_GetLocalizedName
 __services_discovery_GetServicesNames
 services_discovery_RemoveItem
-services_discovery_SetLocalizedName
 services_discovery_Start
 services_discovery_Stop
 sout_AccessOutControl
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 91d0d82..03b11ca 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -64,7 +64,6 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name
     if( !p_sd )
         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 );
 
     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 )
     assert(!p_sd->p_module); /* Forgot to call Stop */
 
     vlc_event_manager_fini( &p_sd->event_manager );
-    
     free( p_sd->psz_module );
-    free( p_sd->psz_localized_name );
-    
     vlc_object_release( p_sd );
 }
 
@@ -154,17 +150,7 @@ static void services_discovery_Destructor ( services_discovery_t * p_sd )
 char *
 services_discovery_GetLocalizedName ( services_discovery_t * p_sd )
 {
-    return p_sd->psz_localized_name ? strdup( p_sd->psz_localized_name ) : NULL;
-}
-
-/***********************************************************************
- * 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);
+    return strdup( module_get_name( p_sd->p_module, true ) );
 }
 
 /***********************************************************************
@@ -308,15 +294,6 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,  const char *psz_modu
         if( !p_sd )
             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_ServicesDiscoveryItemAdded,
                           playlist_sd_item_added,
@@ -343,7 +320,15 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,  const char *psz_modu
             vlc_object_release( p_sd );
             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 */
         p_sds = malloc( sizeof(struct playlist_services_discovery_support_t) );
         if( !p_sds )




More information about the vlc-devel mailing list