[vlc-commits] commit: SD: add a function to query a service discovery for more items. ( Rémi Duraffort )
git at videolan.org
git at videolan.org
Tue Oct 19 21:33:58 CEST 2010
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Oct 18 06:56:57 2010 +0200| [a60a86bd83d16baba3554950b4eac165ff6d775d] | committer: Rémi Duraffort
SD: add a function to query a service discovery for more items.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a60a86bd83d16baba3554950b4eac165ff6d775d
---
include/vlc_playlist.h | 2 ++
include/vlc_services_discovery.h | 16 ++++++++++++++++
src/libvlccore.sym | 1 +
src/playlist/services_discovery.c | 23 +++++++++++++++++++++++
4 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 732d943..1002886 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -323,6 +323,8 @@ VLC_EXPORT( int, playlist_ServicesDiscoveryAdd, (playlist_t *, const char *));
VLC_EXPORT( int, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *));
/** Check whether a given SD is loaded */
VLC_EXPORT( bool, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *));
+/** Query a services discovery */
+VLC_EXPORT( int, playlist_QueryServicesDiscovery, ( playlist_t *, const char *, const char * ) );
diff --git a/include/vlc_services_discovery.h b/include/vlc_services_discovery.h
index 58ff2a7..8a00dcb 100644
--- a/include/vlc_services_discovery.h
+++ b/include/vlc_services_discovery.h
@@ -51,6 +51,8 @@ struct services_discovery_t
char *psz_name;
config_chain_t *p_cfg;
+ int ( *pf_search ) ( services_discovery_t *, const char * );
+
services_discovery_sys_t *p_sys;
};
@@ -66,6 +68,20 @@ enum services_discovery_category_e
* Service Discovery
***********************************************************************/
+/**
+ * Ask for a research in the SD
+ * @param p_sd: the Service Discovery
+ * @param psz_query: the query
+ * @return VLC_SUCCESS in case of success, the error code overwise
+ */
+static inline int vlc_sd_search( services_discovery_t *p_sd, const char *psz_query )
+{
+ if( p_sd->pf_search )
+ return p_sd->pf_search( p_sd, psz_query );
+ else
+ return VLC_EGENERIC;
+}
+
/* Get the services discovery modules names to use in Create(), in a null
* terminated string array. Array and string must be freed after use. */
VLC_EXPORT( char **, vlc_sd_GetNames, ( vlc_object_t *, char ***, int ** ) LIBVLC_USED );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 5632223..b5c05f8 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -362,6 +362,7 @@ playlist_NodeDelete
playlist_NodeInsert
playlist_NodeRemoveItem
playlist_PreparseEnqueue
+playlist_QueryServicesDiscovery
playlist_RecursiveNodeSort
playlist_ServicesDiscoveryAdd
playlist_ServicesDiscoveryRemove
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 2f384e6..ca5ec49 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -440,6 +440,29 @@ bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
return found;
}
+int playlist_QueryServicesDiscovery( playlist_t *p_playlist, const char *psz_name, const char *psz_query )
+{
+ playlist_private_t *priv = pl_priv( p_playlist );
+ int i_ret = VLC_EGENERIC;
+ int i;
+
+ PL_LOCK;
+ for( i = 0; i < priv->i_sds; i++ )
+ {
+ vlc_sd_internal_t *sd = priv->pp_sds[i];
+ if( sd->psz_name && !strcmp( psz_name, sd->psz_name ) )
+ {
+ i_ret = vlc_sd_search( sd->p_sd, psz_query );
+ break;
+ }
+ }
+
+ assert( i != priv->i_sds );
+ PL_UNLOCK;
+
+ return i_ret;
+}
+
void playlist_ServicesDiscoveryKillAll( playlist_t *p_playlist )
{
playlist_private_t *priv = pl_priv( p_playlist );
More information about the vlc-commits
mailing list