Commit 07c7cdcb authored by Antoine Cellerier's avatar Antoine Cellerier

Add argument to module_GetModulesNamesForCapability (and...

Add argument to module_GetModulesNamesForCapability (and services_discovery_GetServicesNames) to also get the longnames.
parent 44de901a
...@@ -116,10 +116,11 @@ VLC_EXPORT( module_t *, __module_FindName, ( vlc_object_t *, const char * ) ); ...@@ -116,10 +116,11 @@ VLC_EXPORT( module_t *, __module_FindName, ( vlc_object_t *, const char * ) );
/* Return a NULL terminated array with the names of the modules that have a /* Return a NULL terminated array with the names of the modules that have a
* certain capability. * certain capability.
* Free after uses both the string and the table. */ * Free after uses both the string and the table. */
#define module_GetModulesNamesForCapability(a,b) \ #define module_GetModulesNamesForCapability(a,b,c) \
__module_GetModulesNamesForCapability(VLC_OBJECT(a),b) __module_GetModulesNamesForCapability(VLC_OBJECT(a),b,c)
VLC_EXPORT(char **, __module_GetModulesNamesForCapability, VLC_EXPORT(char **, __module_GetModulesNamesForCapability,
( vlc_object_t *p_this, const char * psz_capability ) ); ( vlc_object_t *p_this, const char * psz_capability,
char ***psz_longname ) );
VLC_EXPORT( module_t *, vlc_module_create, ( vlc_object_t * ) ); VLC_EXPORT( module_t *, vlc_module_create, ( vlc_object_t * ) );
VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) ); VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) );
......
...@@ -62,7 +62,7 @@ struct services_discovery_t ...@@ -62,7 +62,7 @@ struct services_discovery_t
/* 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 **, services_discovery_GetServicesNames, ( vlc_object_t * p_super ) ); VLC_EXPORT( char **, services_discovery_GetServicesNames, ( vlc_object_t * p_super, char ***pppsz_longnames ) );
/* Creation of a service_discovery object */ /* Creation of a service_discovery object */
VLC_EXPORT( services_discovery_t *, services_discovery_Create, ( vlc_object_t * p_super, const char * psz_service_name ) ); VLC_EXPORT( services_discovery_t *, services_discovery_Create, ( vlc_object_t * p_super, const char * psz_service_name ) );
......
...@@ -779,7 +779,8 @@ vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name ) ...@@ -779,7 +779,8 @@ vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name )
* Free after uses both the string and the table. * Free after uses both the string and the table.
*****************************************************************************/ *****************************************************************************/
char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this, char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this,
const char * psz_capability ) const char * psz_capability,
char ***pppsz_longname )
{ {
vlc_list_t *p_list; vlc_list_t *p_list;
int i, j, count = 0; int i, j, count = 0;
...@@ -795,6 +796,8 @@ char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this, ...@@ -795,6 +796,8 @@ char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this,
count++; count++;
} }
psz_ret = malloc( sizeof(char*) * (count+1) ); psz_ret = malloc( sizeof(char*) * (count+1) );
if( pppsz_longname )
*pppsz_longname = malloc( sizeof(char*) * (count+1) );
j = 0; j = 0;
for( i = 0 ; i < p_list->i_count; i++) for( i = 0 ; i < p_list->i_count; i++)
{ {
...@@ -810,6 +813,8 @@ char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this, ...@@ -810,6 +813,8 @@ char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this,
} }
psz_ret[j] = strdup( k>=0?p_module->pp_shortcuts[k] psz_ret[j] = strdup( k>=0?p_module->pp_shortcuts[k]
:p_module->psz_object_name ); :p_module->psz_object_name );
if( pppsz_longname )
(*pppsz_longname)[j] = strdup( module_GetName( p_module, VLC_TRUE ) );
j++; j++;
} }
} }
......
...@@ -37,9 +37,11 @@ static void RunSD( services_discovery_t *p_sd ); ...@@ -37,9 +37,11 @@ static void RunSD( services_discovery_t *p_sd );
/*********************************************************************** /***********************************************************************
* GetServicesNames * GetServicesNames
***********************************************************************/ ***********************************************************************/
char ** services_discovery_GetServicesNames( vlc_object_t * p_super ) char ** services_discovery_GetServicesNames( vlc_object_t * p_super,
char ***pppsz_longnames )
{ {
return module_GetModulesNamesForCapability( p_super, "services_discovery" ); return module_GetModulesNamesForCapability( p_super, "services_discovery",
pppsz_longnames );
} }
/*********************************************************************** /***********************************************************************
......
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