/*****************************************************************************
* 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
*
* 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() */
return VLC_SUCCESS;
}
-void playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
+int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
const char *psz_module )
{
int i;
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
*
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';
}