Commit a60a86bd authored by Rémi Duraffort's avatar Rémi Duraffort

SD: add a function to query a service discovery for more items.

parent 698853e4
...@@ -323,6 +323,8 @@ VLC_EXPORT( int, playlist_ServicesDiscoveryAdd, (playlist_t *, const char *)); ...@@ -323,6 +323,8 @@ VLC_EXPORT( int, playlist_ServicesDiscoveryAdd, (playlist_t *, const char *));
VLC_EXPORT( int, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *)); VLC_EXPORT( int, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *));
/** Check whether a given SD is loaded */ /** Check whether a given SD is loaded */
VLC_EXPORT( bool, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *)); VLC_EXPORT( bool, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *));
/** Query a services discovery */
VLC_EXPORT( int, playlist_QueryServicesDiscovery, ( playlist_t *, const char *, const char * ) );
......
...@@ -51,6 +51,8 @@ struct services_discovery_t ...@@ -51,6 +51,8 @@ struct services_discovery_t
char *psz_name; char *psz_name;
config_chain_t *p_cfg; config_chain_t *p_cfg;
int ( *pf_search ) ( services_discovery_t *, const char * );
services_discovery_sys_t *p_sys; services_discovery_sys_t *p_sys;
}; };
...@@ -66,6 +68,20 @@ enum services_discovery_category_e ...@@ -66,6 +68,20 @@ enum services_discovery_category_e
* Service Discovery * 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 /* Get the services discovery modules names to use in Create(), in a null
* terminated string array. Array and string must be freed after use. */ * terminated string array. Array and string must be freed after use. */
VLC_EXPORT( char **, vlc_sd_GetNames, ( vlc_object_t *, char ***, int ** ) LIBVLC_USED ); VLC_EXPORT( char **, vlc_sd_GetNames, ( vlc_object_t *, char ***, int ** ) LIBVLC_USED );
......
...@@ -362,6 +362,7 @@ playlist_NodeDelete ...@@ -362,6 +362,7 @@ playlist_NodeDelete
playlist_NodeInsert playlist_NodeInsert
playlist_NodeRemoveItem playlist_NodeRemoveItem
playlist_PreparseEnqueue playlist_PreparseEnqueue
playlist_QueryServicesDiscovery
playlist_RecursiveNodeSort playlist_RecursiveNodeSort
playlist_ServicesDiscoveryAdd playlist_ServicesDiscoveryAdd
playlist_ServicesDiscoveryRemove playlist_ServicesDiscoveryRemove
......
...@@ -440,6 +440,29 @@ bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist, ...@@ -440,6 +440,29 @@ bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
return found; 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 ) void playlist_ServicesDiscoveryKillAll( playlist_t *p_playlist )
{ {
playlist_private_t *priv = pl_priv( p_playlist ); playlist_private_t *priv = pl_priv( p_playlist );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment