Commit 66f85594 authored by Antoine Cellerier's avatar Antoine Cellerier

* rpn.c: add "services_discovery_add", "services_discovery_remove" and...

* rpn.c: add "services_discovery_add", "services_discovery_remove" and "services_discovery_is_loaded" rpn functions.
* macro.c, http.h, mvar.c: add new "object" param2 for foreach macro. It gives a list of all objects matching a capability.
parent b7e8fac1
...@@ -204,6 +204,9 @@ void E_(mvar_AppendNewVar)( mvar_t *vars, const char *name, ...@@ -204,6 +204,9 @@ void E_(mvar_AppendNewVar)( mvar_t *vars, const char *name,
* The arg parameter must be of the form "start[:stop[:step]]" */ * The arg parameter must be of the form "start[:stop[:step]]" */
mvar_t *E_(mvar_IntegerSetNew)( const char *name, const char *arg ); mvar_t *E_(mvar_IntegerSetNew)( const char *name, const char *arg );
/** This function creates a set variable with a list of VLC objects */
mvar_t *E_(mvar_ObjectSetNew)( intf_thread_t *p_intf, char *name, char *arg );
/** This function creates a set variable with the contents of the playlist */ /** This function creates a set variable with the contents of the playlist */
mvar_t *E_(mvar_PlaylistSetNew)( intf_thread_t *p_intf, char *name, mvar_t *E_(mvar_PlaylistSetNew)( intf_thread_t *p_intf, char *name,
playlist_t *p_pl ); playlist_t *p_pl );
......
...@@ -973,6 +973,12 @@ void E_(Execute)( httpd_file_sys_t *p_args, ...@@ -973,6 +973,12 @@ void E_(Execute)( httpd_file_sys_t *p_args,
index = E_(mvar_FileSetNew)( p_intf, m.param1, arg ); index = E_(mvar_FileSetNew)( p_intf, m.param1, arg );
free( arg ); free( arg );
} }
else if( !strcmp( m.param2, "object" ) )
{
char *arg = E_(SSPop)( &p_args->stack );
index = E_(mvar_ObjectSetNew)( p_intf, m.param1, arg );
free( arg );
}
else if( !strcmp( m.param2, "playlist" ) ) else if( !strcmp( m.param2, "playlist" ) )
{ {
index = E_(mvar_PlaylistSetNew)( p_intf, m.param1, index = E_(mvar_PlaylistSetNew)( p_intf, m.param1,
......
...@@ -350,6 +350,34 @@ mvar_t *E_(mvar_InfoSetNew)( intf_thread_t *p_intf, char *name, ...@@ -350,6 +350,34 @@ mvar_t *E_(mvar_InfoSetNew)( intf_thread_t *p_intf, char *name,
return s; return s;
} }
mvar_t *E_(mvar_ObjectSetNew)( intf_thread_t *p_intf, char *psz_name,
char *psz_capability )
{
mvar_t *s = E_(mvar_New)( psz_name, "set" );
int i;
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
for( i = 0; i < p_list->i_count; i++ )
{
module_t *p_parser = (module_t *)p_list->p_values[i].p_object;
if( !strcmp( p_parser->psz_capability, psz_capability ) )
{
mvar_t *sd = E_(mvar_New)( "sd", p_parser->psz_object_name );
E_(mvar_AppendNewVar)( sd, "name",
p_parser->psz_longname ? p_parser->psz_longname
: ( p_parser->psz_shortname ? p_parser->psz_shortname
: p_parser->psz_object_name ) );
E_(mvar_AppendVar)( s, sd );
}
}
vlc_list_release( p_list );
return s;
}
mvar_t *E_(mvar_InputVarSetNew)( intf_thread_t *p_intf, char *name, mvar_t *E_(mvar_InputVarSetNew)( intf_thread_t *p_intf, char *name,
input_thread_t *p_input, input_thread_t *p_input,
const char *psz_variable ) const char *psz_variable )
......
...@@ -893,10 +893,30 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -893,10 +893,30 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
int i_sort = E_(SSPopN)( st, vars ); int i_sort = E_(SSPopN)( st, vars );
i_order = i_order % 2; i_order = i_order % 2;
i_sort = i_sort % 9; i_sort = i_sort % 9;
playlist_RecursiveNodeSort ( p_sys->p_playlist, playlist_RecursiveNodeSort( p_sys->p_playlist,
p_sys->p_playlist->p_general, p_sys->p_playlist->p_general,
i_sort, i_order ); i_sort, i_order );
msg_Dbg( p_intf, "requested sort playlist by : %d in order : %d", i_sort, i_order ); msg_Dbg( p_intf, "requested sort playlist by : %d in order : %d",
i_sort, i_order );
}
else if( !strcmp( s, "services_discovery_add" ) )
{
char *psz_sd = E_(SSPop)( st );
playlist_ServicesDiscoveryAdd( p_sys->p_playlist, psz_sd );
free( psz_sd );
}
else if( !strcmp( s, "services_discovery_remove" ) )
{
char *psz_sd = E_(SSPop)( st );
playlist_ServicesDiscoveryRemove( p_sys->p_playlist, psz_sd );
free( psz_sd );
}
else if( !strcmp( s, "services_discovery_is_loaded" ) )
{
char *psz_sd = E_(SSPop)( st );
E_(SSPushN)( st,
playlist_IsServicesDiscoveryLoaded( p_sys->p_playlist, psz_sd ) );
free( psz_sd );
} }
else if( !strcmp( s, "vlc_volume_set" ) ) else if( !strcmp( s, "vlc_volume_set" ) )
{ {
...@@ -935,6 +955,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -935,6 +955,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
aout_VolumeSet( p_intf, i_value ); aout_VolumeSet( p_intf, i_value );
} }
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
free( psz_vol );
} }
else if( !strcmp( s, "vlm_command" ) || !strcmp( s, "vlm_cmd" ) ) else if( !strcmp( s, "vlm_command" ) || !strcmp( s, "vlm_cmd" ) )
{ {
......
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