]> git.sesse.net Git - vlc/blobdiff - modules/control/http/macro.c
HTTP old: use vlc_sd_GetNames(), fix #3490
[vlc] / modules / control / http / macro.c
index 4d55c8df273deed99637f43be6ebc2f4356fa181..b4887762a55ad12620194656a056a0d1ca21079a 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "http.h"
 #include "macros.h"
-#include "vlc_url.h"
+#include <vlc_url.h>
 
 static int MacroParse( macro_t *m, char *psz_src )
 {
@@ -149,7 +149,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
     {               \
         int __i__ = *pp_dst - *pp_data; \
         *pi_data += (l);                  \
-        *pp_data = realloc( *pp_data, *pi_data );   \
+        *pp_data = xrealloc( *pp_data, *pi_data );   \
         *pp_dst = (*pp_data) + __i__;   \
     }
 #define PRINT( str ) \
@@ -230,12 +230,12 @@ static void MacroDo( httpd_file_sys_t *p_args,
                 case MVLC_FULLSCREEN:
                     if( p_sys->p_input )
                     {
-                        vout_thread_t *p_vout;
-
-                        p_vout = input_GetVout( p_sys->p_input );
+                        bool fs = var_ToggleBool( p_sys->p_playlist,
+                                                  "fullscreen" );
+                        vout_thread_t *p_vout = input_GetVout( p_sys->p_input );
                         if( p_vout )
                         {
-                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                            var_SetBool( p_vout, "fullscreen", fs );
                             vlc_object_release( p_vout );
                             msg_Dbg( p_intf, "requested fullscreen toggle" );
                         }
@@ -256,7 +256,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     int i_value;
 
                     ExtractURIValue( p_request, "value", vol, 8 );
-                    aout_VolumeGet( p_intf, &i_volume );
+                    aout_VolumeGet( p_sys->p_playlist, &i_volume );
                     decode_URI( vol );
 
                     if( vol[0] == '+' )
@@ -264,12 +264,12 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         i_value = atoi( vol + 1 );
                         if( (i_volume + i_value) > AOUT_VOLUME_MAX )
                         {
-                            aout_VolumeSet( p_intf , AOUT_VOLUME_MAX );
+                            aout_VolumeSet( p_sys->p_playlist, AOUT_VOLUME_MAX );
                             msg_Dbg( p_intf, "requested volume set: max" );
                         }
                         else
                         {
-                            aout_VolumeSet( p_intf , (i_volume + i_value) );
+                            aout_VolumeSet( p_sys->p_playlist, (i_volume + i_value) );
                             msg_Dbg( p_intf, "requested volume set: +%i", (i_volume + i_value) );
                         }
                     }
@@ -278,12 +278,12 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         i_value = atoi( vol + 1 );
                         if( (i_volume - i_value) < AOUT_VOLUME_MIN )
                         {
-                            aout_VolumeSet( p_intf , AOUT_VOLUME_MIN );
+                            aout_VolumeSet( p_sys->p_playlist, AOUT_VOLUME_MIN );
                             msg_Dbg( p_intf, "requested volume set: min" );
                         }
                         else
                         {
-                            aout_VolumeSet( p_intf , (i_volume - i_value) );
+                            aout_VolumeSet( p_sys->p_playlist, (i_volume - i_value) );
                             msg_Dbg( p_intf, "requested volume set: -%i", (i_volume - i_value) );
                         }
                     }
@@ -291,7 +291,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     {
                         i_value = atoi( vol );
                         if( (i_value <= 400) && (i_value>=0) ){
-                            aout_VolumeSet( p_intf, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);
+                            aout_VolumeSet( p_sys->p_playlist, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);
                             msg_Dbg( p_intf, "requested volume set: %i%%", atoi( vol ));
                         }
                     }
@@ -300,7 +300,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         i_value = atoi( vol );
                         if( ( i_value <= AOUT_VOLUME_MAX ) && ( i_value >= AOUT_VOLUME_MIN ) )
                         {
-                            aout_VolumeSet( p_intf , atoi( vol ) );
+                            aout_VolumeSet( p_sys->p_playlist, atoi( vol ) );
                             msg_Dbg( p_intf, "requested volume set: %i", atoi( vol ) );
                         }
                     }
@@ -365,8 +365,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         if( !*item ) continue;
 
                         int i_item = atoi( item );
-                        p_items = realloc( p_items, (i_nb_items + 1) *
-                                           sizeof(*p_items) );
+                        p_items = xrealloc( p_items,
+                                        (i_nb_items + 1) * sizeof(*p_items) );
                         p_items[i_nb_items] = i_item;
                         i_nb_items++;
                     }
@@ -402,13 +402,14 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         if( !*item ) continue;
 
                         int i_item = atoi( item );
-                        p_items = realloc( p_items, (i_nb_items + 1) *
-                                           sizeof(*p_items) );
+                        p_items = xrealloc( p_items,
+                                        (i_nb_items + 1) * sizeof(*p_items) );
                         p_items[i_nb_items] = i_item;
                         i_nb_items++;
                     }
 
-                    for( i = 0; i < p_sys->p_playlist->items.i_size; i++ )
+                    size_t size = p_sys->p_playlist->items.i_size;
+                    for( i = 0; i < size; i++ )
                     {
                         size_t j;
 
@@ -542,7 +543,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     };
                     vlm_message_t *vlm_answer;
                     char name[512];
-                    char *psz = malloc( strlen( p_request ) + 1000 );
+                    char *psz = xmalloc( strlen( p_request ) + 1000 );
                     char *p = psz;
                     char *vlm_error;
                     int i;
@@ -869,14 +870,14 @@ void Execute( httpd_file_sys_t *p_args,
                      char *p_request, int i_request,
                      char **pp_data, int *pi_data,
                      char **pp_dst,
-                     char *_src, char *_end )
+                     const char *_src, const char *_end )
 {
     intf_thread_t  *p_intf = p_args->p_intf;
 
     char *src, *dup, *end;
     char *dst = *pp_dst;
 
-    src = dup = malloc( _end - _src + 1 );
+    src = dup = xmalloc( _end - _src + 1 );
     end = src +( _end - _src );
 
     memcpy( src, _src, _end - _src );
@@ -888,7 +889,7 @@ void Execute( httpd_file_sys_t *p_args,
         char *p;
         int i_copy;
 
-        p = (char *)strstr( (char *)src, "<vlc" );
+        p = strstr( src, "<vlc" );
         if( p < end && p == src )
         {
             macro_t m;
@@ -1018,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" ) )
                         {
@@ -1117,7 +1116,7 @@ void Execute( httpd_file_sys_t *p_args,
             int i_index = dst - *pp_data;
 
             *pi_data += i_copy;
-            *pp_data = realloc( *pp_data, *pi_data );
+            *pp_data = xrealloc( *pp_data, *pi_data );
             dst = (*pp_data) + i_index;
 
             memcpy( dst, src, i_copy );