]> git.sesse.net Git - vlc/blobdiff - src/playlist/services_discovery.c
Get rid of --enable-shared-libvlc on non-Microsoft platforms
[vlc] / src / playlist / services_discovery.c
index a77ed3496b34ae1ab2359f01b2114cd248565510..b27b748640a0b3e87c105328ee331771cd88f606 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * services_discovery.c : Manage playlist services_discovery modules
  *****************************************************************************
- * Copyright (C) 1999-2004 VideoLAN
- * $Id: playlist.c 9216 2004-11-07 10:43:52Z zorglub $
+ * Copyright (C) 1999-2004 the VideoLAN team
+ * $Id$
  *
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <stdio.h>                                              /* sprintf() */
@@ -80,7 +80,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,
     return VLC_SUCCESS;
 }
 
-void playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
+int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
                                        const char *psz_module )
 {
     int i;
@@ -99,20 +99,44 @@ void playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
 
     if( p_sd )
     {
+        vlc_mutex_unlock( &p_playlist->object_lock );
         p_sd->b_die = VLC_TRUE;
         vlc_thread_join( p_sd );
+        free( p_sd->psz_module );
         module_Unneed( p_sd, p_sd->p_module );
+        vlc_mutex_lock( &p_playlist->object_lock );
         vlc_object_destroy( p_sd );
     }
     else
     {
         msg_Warn( p_playlist, "module %s is not loaded", psz_module );
+        vlc_mutex_unlock( &p_playlist->object_lock );
+        return VLC_EGENERIC;
     }
 
     vlc_mutex_unlock( &p_playlist->object_lock );
-    return;
+    return VLC_SUCCESS;
 }
 
+vlc_bool_t playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
+                                              const char *psz_module )
+{
+    int i;
+    vlc_mutex_lock( &p_playlist->object_lock );
+
+    for( i = 0 ; i< p_playlist->i_sds ; i ++ )
+    {
+        if( !strcmp( psz_module, p_playlist->pp_sds[i]->psz_module ) )
+        {
+            vlc_mutex_unlock( &p_playlist->object_lock );
+            return VLC_TRUE;
+        }
+    }
+    vlc_mutex_unlock( &p_playlist->object_lock );
+    return VLC_FALSE;
+}
+
+
 /**
  * Load all service discovery modules in a string
  *
@@ -129,12 +153,12 @@ int playlist_AddSDModules( playlist_t *p_playlist, char *psz_modules )
 
         while( psz_parser && *psz_parser )
         {
-            while( *psz_parser == ' ' || *psz_parser == ',' )
+            while( *psz_parser == ' ' || *psz_parser == ':' )
             {
                 psz_parser++;
             }
 
-            if( (psz_next = strchr( psz_parser, ',' ) ) )
+            if( (psz_next = strchr( psz_parser, ':' ) ) )
             {
                 *psz_next++ = '\0';
             }