]> git.sesse.net Git - vlc/blobdiff - modules/gui/ncurses.c
Fix a huge bunch of things in the video effects panel. Implement combo box options.
[vlc] / modules / gui / ncurses.c
index cbbab53fe10ee75e66a6bc1a91779aafcdb01636..64ba96bf17d89e8d2e80226477acb08b61ee8a95 100644 (file)
@@ -27,6 +27,7 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#define _GNU_SOURCE
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 #include <errno.h>                                                 /* ENOMEM */
 #include <curses.h>
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include <vlc/vout.h>
-#include <vlc/aout.h>
-#include "charset.h"
+#include <vlc_interface.h>
+#include <vlc_vout.h>
+#include <vlc_aout.h>
+#include <vlc_charset.h>
+#include <vlc_input.h>
+#include <vlc_playlist.h>
 
 #ifdef HAVE_SYS_STAT_H
 #   include <sys/stat.h>
@@ -79,7 +82,7 @@ static void Redraw         ( intf_thread_t *, time_t * );
 
 static playlist_item_t *PlaylistGetRoot( intf_thread_t * );
 static void PlaylistRebuild( intf_thread_t * );
-static void PlaylistAddNode( intf_thread_t *, playlist_item_t *, int, char *);
+static void PlaylistAddNode( intf_thread_t *, playlist_item_t *, int, const char *);
 static void PlaylistDestroy( intf_thread_t * );
 static int  PlaylistChanged( vlc_object_t *, const char *, vlc_value_t,
                              vlc_value_t, void * );
@@ -235,7 +238,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Set quiet mode */
     val.i_int = -1;
-    var_Set( p_intf->p_vlc, "verbose", val );
+    var_Set( p_intf->p_libvlc, "verbose", val );
 
     /* Set defaul playlist view */
     p_sys->i_current_view = VIEW_CATEGORY;
@@ -262,7 +265,7 @@ static int Open( vlc_object_t *p_this )
     }
     else
     {
-        p_sys->psz_current_dir = strdup( p_intf->p_vlc->psz_homedir );
+        p_sys->psz_current_dir = strdup( p_intf->p_libvlc->psz_homedir );
     }
 
     p_sys->i_dir_entries = 0;
@@ -336,7 +339,7 @@ static void Run( intf_thread_t *p_intf )
      */
     t_last_refresh = ( time( 0 ) - 1);
 
-    while( !p_intf->b_die )
+    while( !intf_ShouldDie( p_intf ) )
     {
         msleep( INTF_IDLE_SLEEP );
 
@@ -522,7 +525,7 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                 p_sys->i_box_plidx = 0;
                 break;
             case KEY_END:
-                p_sys->i_box_plidx = p_sys->p_playlist->i_size - 1;
+                p_sys->i_box_plidx = p_sys->p_playlist->items.i_size - 1;
                 break;
             case KEY_UP:
                 p_sys->i_box_plidx--;
@@ -547,7 +550,8 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                 p_item = p_sys->pp_plist[p_sys->i_box_plidx]->p_item;
                 if( p_item->i_children == -1 )
                 {
-                    playlist_DeleteFromItemId( p_playlist, p_item->i_id );
+                    playlist_DeleteFromInput( p_playlist,
+                                              p_item->p_input->i_id, VLC_TRUE );
                 }
                 else
                 {
@@ -566,12 +570,13 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                         == -1 )
                 {
                     playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
-                        NULL,
+                                      VLC_TRUE, NULL,
                         p_sys->pp_plist[p_sys->i_box_plidx]->p_item );
                 }
                 else
                 {
                     playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
+                        VLC_TRUE,
                         p_sys->pp_plist[p_sys->i_box_plidx]->p_item,
                         NULL );
                 }
@@ -834,7 +839,7 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
         case 'q':
         case 'Q':
         case 0x1b:  /* Esc */
-            p_intf->p_vlc->b_die = VLC_TRUE;
+            vlc_object_kill( p_intf->p_libvlc );
             return 0;
 
         /* Box switching */
@@ -1205,7 +1210,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
 
         /* Source */
         mvnprintw( y++, 0, COLS, " Source   : %s",
-                   p_input->input.p_item->psz_uri );
+                   input_GetItem(p_input)->psz_uri );
 
         /* State */
         var_Get( p_input, "state", &val );
@@ -1213,7 +1218,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
         {
             mvnprintw( y++, 0, COLS, " State    : Playing" );
         }
-        else if( val.i_int == OPENNING_S )
+        else if( val.i_int == OPENING_S )
         {
             mvnprintw( y++, 0, COLS, " State    : Openning/Connecting" );
         }
@@ -1374,10 +1379,10 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
         if( p_input )
         {
             int i,j;
-            vlc_mutex_lock( &p_input->input.p_item->lock );
-            for( i = 0; i < p_input->input.p_item->i_categories; i++ )
+            vlc_mutex_lock( &input_GetItem(p_input)->lock );
+            for( i = 0; i < input_GetItem(p_input)->i_categories; i++ )
             {
-                info_category_t *p_category = p_input->input.p_item->pp_categories[i];
+                info_category_t *p_category = input_GetItem(p_input)->pp_categories[i];
                 if( y >= y_end ) break;
                 MainBoxWrite( p_intf, l++, 1, "  [%s]", p_category->psz_name );
                 for( j = 0; j < p_category->i_infos; j++ )
@@ -1387,7 +1392,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
                     MainBoxWrite( p_intf, l++, 1, "      %s: %s", p_info->psz_name, p_info->psz_value );
                 }
             }
-            vlc_mutex_unlock( &p_input->input.p_item->lock );
+            vlc_mutex_unlock( &input_GetItem(p_input)->lock );
         }
         else
         {
@@ -1661,7 +1666,7 @@ static void PlaylistRebuild( intf_thread_t *p_intf )
 }
 
 static void PlaylistAddNode( intf_thread_t *p_intf, playlist_item_t *p_node,
-                             int i, char *c )
+                             int i, const char *c )
 {
     intf_sys_t *p_sys = p_intf->p_sys;
     playlist_item_t *p_child;
@@ -1898,7 +1903,7 @@ static void ReadDir( intf_thread_t *p_intf )
 
     if( p_sys->psz_current_dir && *p_sys->psz_current_dir )
     {
-        const char *psz_entry;
+        char *psz_entry;
 
         /* Open the dir */
         p_current_dir = utf8_opendir( p_sys->psz_current_dir );
@@ -1944,7 +1949,7 @@ static void ReadDir( intf_thread_t *p_intf )
                 ( strlen( psz_entry ) && psz_entry[0] == '.' ) &&
                 strcmp( psz_entry, ".." ) )
             {
-                LocaleFree( psz_entry );
+                free( psz_entry );
                 psz_entry = utf8_readdir( p_current_dir );
                 continue;
             }
@@ -1981,7 +1986,7 @@ static void ReadDir( intf_thread_t *p_intf )
             }
 
             free( psz_uri );
-            LocaleFree( psz_entry );
+            free( psz_entry );
             /* Read next entry */
             psz_entry = utf8_readdir( p_current_dir );
         }