]> git.sesse.net Git - vlc/blobdiff - modules/gui/ncurses.c
* make sure that the opened media is always enqueueded, if macosx-autoplay is false
[vlc] / modules / gui / ncurses.c
index 35f82e43dde996a8e6368e6dd3f0c222a6eb8ad8..857db4fb6e082454bb273ec40e09d6a56d18d6b5 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>
@@ -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
                 {
@@ -565,13 +569,14 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                 if( p_sys->pp_plist[p_sys->i_box_plidx]->p_item->i_children
                         == -1 )
                 {
-                    playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
+                    playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
+                                      VLC_TRUE, NULL,
                         p_sys->pp_plist[p_sys->i_box_plidx]->p_item );
                 }
                 else
                 {
                     playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
-                        p_sys->i_current_view,
+                        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;
+            p_intf->p_libvlc->b_die = VLC_TRUE;
             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,6 +1218,14 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
         {
             mvnprintw( y++, 0, COLS, " State    : Playing" );
         }
+        else if( val.i_int == OPENING_S )
+        {
+            mvnprintw( y++, 0, COLS, " State    : Openning/Connecting" );
+        }
+        else if( val.i_int == BUFFERING_S )
+        {
+            mvnprintw( y++, 0, COLS, " State    : Buffering" );
+        }
         else if( val.i_int == PAUSE_S )
         {
             mvnprintw( y++, 0, COLS, " State    : Paused" );
@@ -1366,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++ )
@@ -1379,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
         {
@@ -1936,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;
             }
@@ -1973,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 );
         }