]> git.sesse.net Git - vlc/blobdiff - modules/control/http/macro.c
XCB-X11: handle 32-bits visuals (ARGB)
[vlc] / modules / control / http / macro.c
index 0d5d90a6400e98675991258867b099b2b4c7449d..4262d22f56d439954db93b6b1aebc6857c032867 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 )
 {
@@ -199,10 +199,11 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         msg_Dbg( p_intf, "requested playlist play" );
                         break;
                     }
+                    //TODO: really locked here ?
                     playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
                                       true, NULL,
                                       playlist_ItemGetById( p_sys->p_playlist,
-                                      i_item, true ) );
+                                      i_item ) );
                     msg_Dbg( p_intf, "requested playlist item: %i", i_item );
                     break;
                 }
@@ -234,7 +235,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         p_vout = input_GetVout( p_sys->p_input );
                         if( p_vout )
                         {
-                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                            var_ToggleBool( p_vout, "fullscreen" );
                             vlc_object_release( p_vout );
                             msg_Dbg( p_intf, "requested fullscreen toggle" );
                         }
@@ -255,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] == '+' )
@@ -263,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) );
                         }
                     }
@@ -277,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) );
                         }
                     }
@@ -290,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 ));
                         }
                     }
@@ -299,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 ) );
                         }
                     }
@@ -352,7 +353,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
                 }
                 case MVLC_DEL:
                 {
-                    int i_item, *p_items = NULL, i_nb_items = 0;
+                    int *p_items = NULL;
+                    size_t i_nb_items = 0;
                     char item[512];
                     const char *p_parser = p_request;
 
@@ -362,24 +364,25 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     {
                         if( !*item ) continue;
 
-                        i_item = atoi( item );
+                        int i_item = atoi( item );
                         p_items = realloc( p_items, (i_nb_items + 1) *
-                                           sizeof(int) );
+                                           sizeof(*p_items) );
                         p_items[i_nb_items] = i_item;
                         i_nb_items++;
                     }
 
-                    if( i_nb_items )
+                    for( size_t i = 0; i < i_nb_items; i++ )
                     {
-                        int i;
-                        for( i = 0; i < i_nb_items; i++ )
-                        {
+                        playlist_item_t *p_item;
+
+                        msg_Dbg( p_intf, "requested playlist delete: %d",
+                                 p_items[i] );
+                        p_item = playlist_ItemGetById( p_sys->p_playlist,
+                                                       p_items[i] );
+                        if( p_item )
                             playlist_DeleteFromInput( p_sys->p_playlist,
-                                                      p_items[i], false );
-                            msg_Dbg( p_intf, "requested playlist delete: %d",
-                                     p_items[i] );
-                            p_items[i] = -1;
-                        }
+                                                      p_item->p_input,
+                                                      false );
                     }
 
                     free( p_items );
@@ -387,10 +390,10 @@ static void MacroDo( httpd_file_sys_t *p_args,
                 }
                 case MVLC_KEEP:
                 {
-                    int i_item, *p_items = NULL, i_nb_items = 0;
+                    int *p_items = NULL;
+                    size_t i_nb_items = 0, i;
                     char item[512];
                     const char *p_parser = p_request;
-                    int i,j;
 
                     /* Get the list of items to keep */
                     while( (p_parser =
@@ -398,30 +401,32 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     {
                         if( !*item ) continue;
 
-                        i_item = atoi( item );
+                        int i_item = atoi( item );
                         p_items = realloc( p_items, (i_nb_items + 1) *
-                                           sizeof(int) );
+                                           sizeof(*p_items) );
                         p_items[i_nb_items] = i_item;
                         i_nb_items++;
                     }
 
-                    for( i = p_sys->p_playlist->items.i_size - 1 ; i >= 0; i-- )
+                    size_t size = p_sys->p_playlist->items.i_size;
+                    for( i = 0; i < size; i++ )
                     {
+                        size_t j;
+
                         /* Check if the item is in the keep list */
                         for( j = 0 ; j < i_nb_items ; j++ )
                         {
                             if( p_items[j] ==
-                                 ARRAY_VAL(p_sys->p_playlist->items,i)
-                                                ->i_id)
+                                ARRAY_VAL(p_sys->p_playlist->items,i)->i_id)
                                 break;
                         }
                         if( j == i_nb_items )
                         {
+                            msg_Dbg( p_intf, "requested playlist delete: %d",
+                                   p_sys->p_playlist->items.p_elems[i]->i_id );
                             playlist_DeleteFromInput( p_sys->p_playlist,
-                                     p_sys->p_playlist->items.p_elems[i]->i_id,
+                                p_sys->p_playlist->items.p_elems[i]->p_input,
                                                       false );
-                            msg_Dbg( p_intf, "requested playlist delete: %d",
-                                     i );
                         }
                     }