From 2088087d898b0ac737fe4b57e4aab21970d7aeec Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Thu, 8 Apr 2010 22:55:06 +0300 Subject: [PATCH] HTTP old: use vlc_sd_GetNames(), fix #3490 --- modules/control/http/http.h | 4 ++-- modules/control/http/macro.c | 6 ++---- modules/control/http/mvar.c | 32 +++++++++++++++----------------- share/http/dialogs/playlist | 5 ++--- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/modules/control/http/http.h b/modules/control/http/http.h index 8b24acaf72..ac32dc9f55 100644 --- a/modules/control/http/http.h +++ b/modules/control/http/http.h @@ -186,8 +186,8 @@ void mvar_AppendNewVar( mvar_t *vars, const char *name, * The arg parameter must be of the form "start[:stop[:step]]" */ mvar_t *mvar_IntegerSetNew( const char *name, const char *arg ); -/** This function creates a set variable with a list of VLC objects */ -mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *name, const char *arg ); +/** This function creates a set variable with a list of SD plugins */ +mvar_t *mvar_ServicesSetNew( intf_thread_t *p_intf, char *name ); /** This function creates a set variable with the contents of the playlist */ mvar_t *mvar_PlaylistSetNew( intf_thread_t *p_intf, char *name, diff --git a/modules/control/http/macro.c b/modules/control/http/macro.c index 5217089306..b4887762a5 100644 --- a/modules/control/http/macro.c +++ b/modules/control/http/macro.c @@ -1019,11 +1019,9 @@ void Execute( httpd_file_sys_t *p_args, index = mvar_FileSetNew( p_intf, m.param1, arg ); free( arg ); } - else if( !strcmp( m.param2, "object" ) ) + else if( !strcmp( m.param2, "services" ) ) { - char *arg = SSPop( &p_args->stack ); - index = mvar_ObjectSetNew( p_intf, m.param1, arg ); - free( arg ); + index = mvar_ServicesSetNew( p_intf, m.param1 ); } else if( !strcmp( m.param2, "playlist" ) ) { diff --git a/modules/control/http/mvar.c b/modules/control/http/mvar.c index 113b10bbe4..0e723e0182 100644 --- a/modules/control/http/mvar.c +++ b/modules/control/http/mvar.c @@ -35,6 +35,7 @@ #include #endif #include +#include /* Utility function for scandir */ static int Filter( const char *foo ) @@ -337,29 +338,26 @@ mvar_t *mvar_InfoSetNew( char *name, input_thread_t *p_input ) return s; } -mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *psz_name, - const char *psz_capability ) +mvar_t *mvar_ServicesSetNew( intf_thread_t *p_intf, char *psz_name ) { - VLC_UNUSED(p_intf); mvar_t *s = mvar_New( psz_name, "set" ); - size_t i; + char **longnames; + char **names = vlc_sd_GetNames( p_intf, &longnames, NULL ); + if( names == NULL ) + goto out; - module_t **p_list = module_list_get( NULL ); - - for( i = 0; p_list[i]; i++ ) + for( size_t i = 0; names[i]; i++ ) { - module_t *p_parser = p_list[i]; - if( module_provides( p_parser, psz_capability ) ) - { - mvar_t *sd = mvar_New( "sd", module_get_object( p_parser ) ); - mvar_AppendNewVar( sd, "name", - module_get_name( p_parser, true ) ); - mvar_AppendVar( s, sd ); - } + mvar_t *sd = mvar_New( "sd", names[i] ); + mvar_AppendNewVar( sd, "name", longnames[i] ); + mvar_AppendVar( s, sd ); + free( names[i] ); + free( longnames[i] ); } - module_list_free( p_list ); - + free( longnames ); + free( names ); +out: return s; } diff --git a/share/http/dialogs/playlist b/share/http/dialogs/playlist index d714e5f168..10a6aee3e5 100644 --- a/share/http/dialogs/playlist +++ b/share/http/dialogs/playlist @@ -77,9 +77,8 @@ This dialog needs the following dialogs to be fully functional: Services Discovery -- 2.39.2