[vlc-devel] commit: Match used SD alias rather than plugin name (fixes #2756) ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue May 19 17:04:31 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Tue May 19 17:56:22 2009 +0300| [1c8cd6b7a93e08759536d52924ad1b7d5a05edd2] | committer: Rémi Denis-Courmont 

Match used SD alias rather than plugin name (fixes #2756)

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

 src/playlist/services_discovery.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 5cc6f30..03c9f0d 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -299,18 +299,18 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modul
 }
 
 int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
-                                      const char *psz_module )
+                                      const char *psz_name )
 {
+    playlist_private_t *priv = pl_priv( p_playlist );
     struct playlist_services_discovery_support_t * p_sds = NULL;
-    int i;
 
     PL_LOCK;
-    for( i = 0 ; i< pl_priv(p_playlist)->i_sds ; i ++ )
+    for( int i = 0; i < priv->i_sds; i++ )
     {
-        if( !strcmp( psz_module, module_get_object( pl_priv(p_playlist)->pp_sds[i]->p_sd->p_module ) ) )
+        if( !strcmp( psz_name, priv->pp_sds[i]->psz_name ) )
         {
-            p_sds = pl_priv(p_playlist)->pp_sds[i];
-            REMOVE_ELEM( pl_priv(p_playlist)->pp_sds, pl_priv(p_playlist)->i_sds, i );
+            p_sds = priv->pp_sds[i];
+            REMOVE_ELEM( priv->pp_sds, priv->i_sds, i );
             break;
         }
     }
@@ -318,7 +318,7 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
 
     if( !p_sds )
     {
-        msg_Warn( p_playlist, "module %s is not loaded", psz_module );
+        msg_Warn( p_playlist, "discovery %s is not loaded", psz_name );
         return VLC_EGENERIC;
     }
 
@@ -365,26 +365,31 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
 }
 
 bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
-                                              const char *psz_module )
+                                         const char *psz_name )
 {
-    int i;
+    playlist_private_t *priv = pl_priv( p_playlist );
+    bool found = false;
     PL_LOCK;
 
-    for( i = 0 ; i< pl_priv(p_playlist)->i_sds ; i ++ )
+    for( int i = 0; i < priv->i_sds; i++ )
     {
-        if( !strcmp( psz_module, module_get_object( pl_priv(p_playlist)->pp_sds[i]->p_sd->p_module ) ) )
+        vlc_sd_internal_t *sd = priv->pp_sds[i];
+
+        if( sd->psz_name && !strcmp( psz_name, sd->psz_name ) )
         {
-            PL_UNLOCK;
-            return true;
+            found = true;
+            break;
         }
     }
     PL_UNLOCK;
-    return false;
+    return found;
 }
 
 void playlist_ServicesDiscoveryKillAll( playlist_t *p_playlist )
 {
-    while( pl_priv(p_playlist)->i_sds > 0 )
+    playlist_private_t *priv = pl_priv( p_playlist );
+
+    while( priv->i_sds > 0 )
         playlist_ServicesDiscoveryRemove( p_playlist,
-                                          module_get_object( pl_priv(p_playlist)->pp_sds[0]->p_sd->p_module ) );
+                                          priv->pp_sds[0]->psz_name );
 }




More information about the vlc-devel mailing list