/*****************************************************************************
* Preamble
*****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h> /* malloc(), free() */
-#include <string.h>
+#include <vlc/vlc.h>
+
#include <errno.h> /* ENOMEM */
-#include <stdio.h>
#include <time.h>
#include <curses.h>
-#include <vlc/vlc.h>
#include <vlc_interface.h>
-#include <<vlc_vout.h>>
-#include <<vlc_aout.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>
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 * );
case 'q':
case 'Q':
case 0x1b: /* Esc */
- p_intf->p_libvlc->b_die = VLC_TRUE;
+ vlc_object_kill( p_intf->p_libvlc );
return 0;
/* Box switching */
vlc_value_t val_list;
/* Source */
- mvnprintw( y++, 0, COLS, " Source : %s",
- p_input->input.p_item->psz_uri );
+ char *psz_uri = input_item_GetURI( input_GetItem( p_input ) );
+ mvnprintw( y++, 0, COLS, " Source : %s", psz_uri );
+ free( psz_uri );
/* State */
var_Get( p_input, "state", &val );
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++ )
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
{
}
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;
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 );
p_sys->pp_dir_entries = NULL;
p_sys->i_dir_entries = 0;
- /* get the first directory entry */
- psz_entry = utf8_readdir( p_current_dir );
-
/* while we still have entries in the directory */
- while( psz_entry != NULL )
+ while( ( psz_entry = utf8_readdir( p_current_dir ) ) != NULL )
{
#if defined( S_ISDIR )
struct stat stat_data;
strcmp( psz_entry, ".." ) )
{
free( psz_entry );
- psz_entry = utf8_readdir( p_current_dir );
continue;
}
if( !( p_dir_entry = malloc( sizeof( struct dir_entry_t) ) ) )
{
- free( psz_uri);
- return;
+ free( psz_uri );
+ free( psz_entry );
+ continue;
}
#if defined( S_ISDIR )
- utf8_stat( psz_uri, &stat_data );
- if( S_ISDIR(stat_data.st_mode) )
+ if( !utf8_stat( psz_uri, &stat_data )
+ && S_ISDIR(stat_data.st_mode) )
/*#elif defined( DT_DIR )
if( p_dir_content->d_type & DT_DIR )*/
#else
free( psz_uri );
free( psz_entry );
- /* Read next entry */
- psz_entry = utf8_readdir( p_current_dir );
}
/* Sort */