Merge back branch 0.8.6-playlist-vlm to trunk.
authorClément Stenac <zorglub@videolan.org>
Sun, 14 May 2006 18:29:00 +0000 (18:29 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 14 May 2006 18:29:00 +0000 (18:29 +0000)
What is currently broken:
 * Some playlist demuxers (shout, dvb and pls)
 * DAAP
 * BeOS playlist
 * GPE playlist, I suppose

What has some trouble:
 * Meta handling in several demuxers (most notably TS)
 * Skins2 playlist (doesn't refresh correctly)
 * OS X playlist (see bigben's latest commits)

104 files changed:
configure.ac
include/vlc/vlc.h
include/vlc_common.h
include/vlc_config.h
include/vlc_input.h
include/vlc_messages.h
include/vlc_meta.h
include/vlc_objects.h
include/vlc_playlist.h
include/vlc_symbols.h
modules/access/cdda.c
modules/access/cdda/cdda.c
modules/access/directory.c
modules/access/dvdnav.c
modules/access/http.c
modules/access/mms/mmsh.c
modules/codec/cmml/intf.c
modules/control/hotkeys.c
modules/control/http/http.h
modules/control/http/macro.c
modules/control/http/mvar.c
modules/control/http/rpn.c
modules/control/http/util.c
modules/control/rc.c
modules/demux/asf/asf.c
modules/demux/avi/avi.c
modules/demux/flac.c
modules/demux/m3u.c
modules/demux/mkv.cpp
modules/demux/mp4/mp4.c
modules/demux/mpeg/mpga.c
modules/demux/playlist/b4s.c
modules/demux/playlist/dvb.c
modules/demux/playlist/m3u.c
modules/demux/playlist/old.c
modules/demux/playlist/playlist.c
modules/demux/playlist/playlist.h
modules/demux/playlist/pls.c
modules/demux/playlist/podcast.c
modules/demux/playlist/shoutcast.c
modules/demux/playlist/xspf.c
modules/demux/sgimb.c
modules/demux/ts.c
modules/demux/util/id3tag.c
modules/gui/macosx/applescript.m
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m
modules/gui/macosx/playlistinfo.m
modules/gui/macosx/wizard.m
modules/gui/skins2/Modules.am
modules/gui/skins2/commands/cmd_add_item.cpp
modules/gui/skins2/commands/cmd_playlist.cpp
modules/gui/skins2/commands/cmd_playtree.cpp
modules/gui/skins2/commands/cmd_vars.cpp
modules/gui/skins2/parser/interpreter.cpp
modules/gui/skins2/parser/skin_parser.cpp
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.hpp
modules/gui/skins2/vars/playlist.cpp [deleted file]
modules/gui/skins2/vars/playlist.hpp [deleted file]
modules/gui/skins2/vars/playtree.cpp
modules/gui/wxwidgets/dialogs.cpp
modules/gui/wxwidgets/dialogs/infopanels.cpp
modules/gui/wxwidgets/dialogs/iteminfo.cpp
modules/gui/wxwidgets/dialogs/open.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/dialogs/playlist.hpp
modules/gui/wxwidgets/dialogs/wizard.cpp
modules/gui/wxwidgets/input_manager.cpp
modules/gui/wxwidgets/interface.cpp
modules/gui/wxwidgets/playlist_manager.cpp
modules/misc/growl.c
modules/misc/msn.c
modules/misc/playlist/m3u.c
modules/misc/playlist/old.c
modules/misc/playlist/xspf.c
modules/mux/mp4.c
modules/services_discovery/daap.c
modules/services_discovery/hal.c
modules/services_discovery/podcast.c
modules/services_discovery/sap.c
modules/visualization/xosd.c
src/Makefile.am
src/control/mediacontrol_core.c
src/control/playlist.c
src/input/es_out.c
src/input/input.c
src/input/item.c [new file with mode: 0644]
src/libvlc.c
src/playlist/control.c [new file with mode: 0644]
src/playlist/engine.c [new file with mode: 0644]
src/playlist/item-ext.c [deleted file]
src/playlist/item.c
src/playlist/loadsave.c
src/playlist/playlist.c [deleted file]
src/playlist/search.c [new file with mode: 0644]
src/playlist/sort.c
src/playlist/thread.c [new file with mode: 0644]
src/playlist/tree.c [new file with mode: 0644]
src/playlist/view.c [deleted file]
test/NativeGcTest.py [new file with mode: 0644]
test/native/gc.c [new file with mode: 0644]

index abbc0c5..5086009 100644 (file)
@@ -1121,7 +1121,7 @@ VLC_ADD_PLUGINS([deinterlace invert adjust transform distort motionblur rv32])
 VLC_ADD_PLUGINS([fixed32tos16 s16tofixed32 u8tofixed32])
 VLC_ADD_PLUGINS([trivial_resampler ugly_resampler])
 VLC_ADD_PLUGINS([trivial_channel_mixer trivial_mixer])
-VLC_ADD_PLUGINS([playlist export sgimb m3u nsc xtag])
+VLC_ADD_PLUGINS([playlist export sgimb nsc xtag])
 VLC_ADD_PLUGINS([i420_rgb rawvideo blend scale image logo magnify])
 VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv])
 VLC_ADD_PLUGINS([access_directory access_file access_udp access_tcp])
index a6afd1d..f85164b 100644 (file)
@@ -138,11 +138,9 @@ struct vlc_list_t
 
 /* Used by VLC_AddTarget() */
 #define PLAYLIST_INSERT          0x0001
-#define PLAYLIST_REPLACE         0x0002
-#define PLAYLIST_APPEND          0x0004
-#define PLAYLIST_GO              0x0008
-#define PLAYLIST_CHECK_INSERT    0x0010
-#define PLAYLIST_PREPARSE        0x0020
+#define PLAYLIST_APPEND          0x0002
+#define PLAYLIST_GO              0x0004
+#define PLAYLIST_PREPARSE        0x0008
 
 #define PLAYLIST_END           -666
 
index 75bafe9..7c8dbb2 100644 (file)
@@ -24,6 +24,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+
 /**
  * \file
  * This file is a collection of common definitions and types
@@ -203,6 +204,7 @@ typedef struct vlc_t vlc_t;
 typedef struct variable_t variable_t;
 typedef struct date_t date_t;
 typedef struct hashtable_entry_t hashtable_entry_t;
+typedef struct gc_object_t gc_object_t ;
 
 /* Messages */
 typedef struct msg_bank_t msg_bank_t;
@@ -525,6 +527,44 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
 #define VLC_OBJECT( x ) \
     ((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct
 
+#define VLC_GC_MEMBERS                                                       \
+/** \name VLC_GC_MEMBERS                                                     \
+ * these members are common to all objects that wish to be garbage-collected \
+ */                                                                          \
+/**@{*/                                                                      \
+    int i_gc_refcount;                                                       \
+    void (*pf_destructor) ( gc_object_t * );                                 \
+    void *p_destructor_arg;                                                  \
+/**@}*/
+
+struct gc_object_t
+{
+            VLC_GC_MEMBERS
+};
+
+static inline void __vlc_gc_incref( gc_object_t * p_gc )
+{
+    p_gc->i_gc_refcount ++;
+};
+
+static inline void __vlc_gc_decref( gc_object_t *p_gc )
+{
+    p_gc->i_gc_refcount -- ;
+
+    if( p_gc->i_gc_refcount == 0 )
+    {
+        p_gc->pf_destructor( p_gc );
+        /* Do not use the p_gc pointer from now on ! */
+     }
+}
+
+#define vlc_gc_incref( a ) __vlc_gc_incref( (gc_object_t *)a )
+#define vlc_gc_decref( a ) __vlc_gc_decref( (gc_object_t *)a )
+#define vlc_gc_init( a,b,c ) {  ((gc_object_t *)a)->i_gc_refcount = 0; \
+                              ((gc_object_t *)a)->pf_destructor = b; \
+                              ((gc_object_t *)a)->p_destructor_arg = c; }
+
+
 /*****************************************************************************
  * Macros and inline functions
  *****************************************************************************/
index 966b151..5c17718 100644 (file)
  * Input thread configuration
  *****************************************************************************/
 
+#define DEFAULT_INPUT_ACTIVITY 1
+#define DIRECTORY_ACTIVITY 100
+#define TRANSCODE_ACTIVITY 10
+
 /* Used in ErrorThread */
 #define INPUT_IDLE_SLEEP                ((mtime_t)(0.100*CLOCK_FREQ))
 
index fed2610..9b9dc6a 100644 (file)
 #ifndef _VLC__INPUT_H
 #define _VLC__INPUT_H 1
 
+#include <vlc_playlist.h>
+#include <vlc_meta.h>
+
+struct vlc_meta_t;
+
 /*****************************************************************************
  * input_item_t: Describes an input and is used to spawn input_thread_t objects
  *****************************************************************************/
@@ -44,29 +49,32 @@ struct info_category_t
 
 struct input_item_t
 {
+    VLC_GC_MEMBERS
+    int        i_id;                 /**< Identifier of the item */
+
     char       *psz_name;            /**< text describing this item */
     char       *psz_uri;             /**< mrl of this item */
+    vlc_bool_t  b_fixed_name;        /**< Can the interface change the name ?*/
 
     int        i_options;            /**< Number of input options */
     char       **ppsz_options;       /**< Array of input options */
 
-    mtime_t    i_duration;           /**< A hint about the duration of this
-                                      * item, in milliseconds*/
+    mtime_t    i_duration;           /**< Duration in milliseconds*/
 
-    int        i_id;                 /**< Identifier of the item */
     uint8_t    i_type;               /**< Type (file, disc, ...) */
 
     int        i_categories;         /**< Number of info categories */
     info_category_t **pp_categories; /**< Pointer to the first info category */
 
     int         i_es;                /**< Number of es format descriptions */
-    es_format_t **es;                /**< Pointer to an array of es formats */
-
-    vlc_bool_t  b_fixed_name;        /**< Can the interface change the name ?*/
+    es_format_t **es;                /**< Es formats */
 
     input_stats_t *p_stats;          /**< Statistics */
+    int           i_nb_played;       /**< Number of times played */
+
+    vlc_meta_t *p_meta;
 
-    vlc_mutex_t lock;                /**< Item cannot be changed without this lock */
+    vlc_mutex_t lock;                /**< Lock for the item */
 };
 
 #define ITEM_TYPE_UNKNOWN       0
@@ -83,18 +91,19 @@ struct input_item_t
 static inline void vlc_input_item_Init( vlc_object_t *p_o, input_item_t *p_i )
 {
     memset( p_i, 0, sizeof(input_item_t) );
-    p_i->i_options  = 0;
-    p_i->i_es = 0;
-    p_i->i_categories = 0 ;
     p_i->psz_name = 0;
     p_i->psz_uri = 0;
+    p_i->i_es = 0;
+    p_i->es = 0;
+    p_i->i_options  = 0;
     p_i->ppsz_options = 0;
+    p_i->i_categories = 0 ;
     p_i->pp_categories = 0;
-    p_i->es = 0;
     p_i->i_type = ITEM_TYPE_UNKNOWN;
     p_i->b_fixed_name = VLC_TRUE;
 
     p_i->p_stats = (input_stats_t*) malloc( sizeof( input_stats_t ) );
+    p_i->p_meta = NULL;
     vlc_mutex_init( p_o, &p_i->p_stats->lock );
 
     vlc_mutex_init( p_o, &p_i->lock );
@@ -115,6 +124,8 @@ static inline void vlc_input_item_CopyOptions( input_item_t *p_parent,
     }
 }
 
+VLC_EXPORT( void, vlc_input_item_AddOption, ( input_item_t *p_input, const char *psz_option ) );
+
 static inline void vlc_input_item_Clean( input_item_t *p_i )
 {
     if( p_i->psz_name ) free( p_i->psz_name );
@@ -123,6 +134,8 @@ static inline void vlc_input_item_Clean( input_item_t *p_i )
     p_i->psz_name = 0;
     p_i->psz_uri = 0;
 
+    if( p_i->p_meta ) vlc_meta_Delete( p_i->p_meta );
+
     while( p_i->i_options )
     {
         p_i->i_options--;
@@ -168,6 +181,14 @@ static inline void vlc_input_item_Clean( input_item_t *p_i )
 VLC_EXPORT( char *, vlc_input_item_GetInfo, ( input_item_t *p_i, const char *psz_cat,const char *psz_name ) );
 VLC_EXPORT(int, vlc_input_item_AddInfo, ( input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format, ... ) );
 
+#define input_ItemNew( a,b,c ) input_ItemNewExt( a, b, c, 0, NULL, -1 )
+#define input_ItemNewExt(a,b,c,d,e,f) __input_ItemNewExt( VLC_OBJECT(a),b,c,d,e,f)
+VLC_EXPORT( input_item_t *, __input_ItemNewExt, (vlc_object_t *, const char *, const char*, int, const char **, int)  );
+VLC_EXPORT( input_item_t *, input_ItemNewWithType, ( vlc_object_t *, const char *, const char *e, int, const char **, int, int ) );
+
+VLC_EXPORT( input_item_t *, input_ItemGetById, (playlist_t *, int ) );
+
+
 /*****************************************************************************
  * Seek point: (generalisation of chapters)
  *****************************************************************************/
index f3b46a0..578f4cb 100644 (file)
@@ -301,9 +301,8 @@ static inline int __stats_GetInteger( vlc_object_t *p_obj, int i_id,
 static inline int __stats_GetFloat( vlc_object_t *p_obj, int i_id,
                                     unsigned int i_counter, float *value )
 {
-    int i_ret;
     vlc_value_t val;val.f_float = 0.0;
-    i_ret = __stats_Get( p_obj, i_id, i_counter, &val );
+    int i_ret = __stats_Get( p_obj, i_id, i_counter, &val );
     *value = val.f_float;
     return i_ret;
 }
index 5041fbf..2b427be 100644 (file)
 #define VLC_META_NOW_PLAYING        N_("Now Playing")
 #define VLC_META_PUBLISHER          N_("Publisher")
 
-#define VLC_META_CDDB_ARTIST        N_("CDDB Artist")
-#define VLC_META_CDDB_CATEGORY      N_("CDDB Category")
-#define VLC_META_CDDB_DISCID        N_("CDDB Disc ID")
-#define VLC_META_CDDB_EXT_DATA      N_("CDDB Extended Data")
-#define VLC_META_CDDB_GENRE         N_("CDDB Genre")
-#define VLC_META_CDDB_YEAR          N_("CDDB Year")
-#define VLC_META_CDDB_TITLE         N_("CDDB Title")
-
-#define VLC_META_CDTEXT_ARRANGER    N_("CD-Text Arranger")
-#define VLC_META_CDTEXT_COMPOSER    N_("CD-Text Composer")
-#define VLC_META_CDTEXT_DISCID      N_("CD-Text Disc ID")
-#define VLC_META_CDTEXT_GENRE       N_("CD-Text Genre")
-#define VLC_META_CDTEXT_MESSAGE     N_("CD-Text Message")
-#define VLC_META_CDTEXT_SONGWRITER  N_("CD-Text Songwriter")
-#define VLC_META_CDTEXT_PERFORMER   N_("CD-Text Performer")
-#define VLC_META_CDTEXT_TITLE       N_("CD-Text Title")
-
-#define VLC_META_ISO_APPLICATION_ID N_("ISO-9660 Application ID")
-#define VLC_META_ISO_PREPARER       N_("ISO-9660 Preparer")
-#define VLC_META_ISO_PUBLISHER      N_("ISO-9660 Publisher")
-#define VLC_META_ISO_VOLUME         N_("ISO-9660 Volume")
-#define VLC_META_ISO_VOLUMESET      N_("ISO-9660 Volume Set")
-
 #define VLC_META_CODEC_NAME         N_("Codec Name")
 #define VLC_META_CODEC_DESCRIPTION  N_("Codec Description")
 
 struct vlc_meta_t
 {
-    /* meta name/value pairs */
-    int     i_meta;
-    char    **name;
-    char    **value;
-
+    char *psz_title;
+    char *psz_author;
+    char *psz_artist;
+    char *psz_genre;
+    char *psz_copyright;
+    char *psz_album;
+    char *psz_tracknum;
+    char *psz_description;
+    char *psz_rating;
+    char *psz_date;
+    char *psz_setting;
+    char *psz_url;
+    char *psz_language;
+    char *psz_nowplaying;
+    char *psz_publisher;
+#if 0
     /* track meta information */
     int         i_track;
     vlc_meta_t  **track;
+#endif
 };
 
+#define vlc_meta_Set( meta,var,val ) { \
+    if( meta->psz_##var ) free( meta->psz_##var ); \
+    meta->psz_##var = strdup( val ); }
+
+#define vlc_meta_SetTitle( meta, b ) vlc_meta_Set( meta, title, b );
+#define vlc_meta_SetArtist( meta, b ) vlc_meta_Set( meta, artist, b );
+#define vlc_meta_SetAuthor( meta, b ) vlc_meta_Set( meta, author, b );
+#define vlc_meta_SetGenre( meta, b ) vlc_meta_Set( meta, genre, b );
+#define vlc_meta_SetCopyright( meta, b ) vlc_meta_Set( meta, copyright, b );
+#define vlc_meta_SetAlbum( meta, b ) vlc_meta_Set( meta, album, b );
+#define vlc_meta_SetTracknum( meta, b ) vlc_meta_Set( meta, tracknum, b );
+#define vlc_meta_SetDescription( meta, b ) vlc_meta_Set( meta, description, b );
+#define vlc_meta_SetRating( meta, b ) vlc_meta_Set( meta, rating, b );
+#define vlc_meta_SetDate( meta, b ) vlc_meta_Set( meta, date, b );
+#define vlc_meta_SetSetting( meta, b ) vlc_meta_Set( meta, setting, b );
+#define vlc_meta_SetURL( meta, b ) vlc_meta_Set( meta, url, b );
+#define vlc_meta_SetLanguage( meta, b ) vlc_meta_Set( meta, language, b );
+#define vlc_meta_SetNowPlaying( meta, b ) vlc_meta_Set( meta, nowplaying, b );
+#define vlc_meta_SetPublisher( meta, b ) vlc_meta_Set( meta, publisher, b );
+
 static inline vlc_meta_t *vlc_meta_New( void )
 {
     vlc_meta_t *m = (vlc_meta_t*)malloc( sizeof( vlc_meta_t ) );
-
-    m->i_meta = 0;
-    m->name   = NULL;
-    m->value  = NULL;
-
-    m->i_track= 0;
-    m->track  = NULL;
-
+    if( !m ) return NULL;
+    m->psz_title = NULL;
+    m->psz_author = NULL;
+    m->psz_artist = NULL;
+    m->psz_genre = NULL;
+    m->psz_copyright = NULL;
+    m->psz_album = NULL;
+    m->psz_tracknum = NULL;
+    m->psz_description = NULL;
+    m->psz_rating = NULL;
+    m->psz_date = NULL;
+    m->psz_setting = NULL;
+    m->psz_url = NULL;
+    m->psz_language = NULL;
+    m->psz_nowplaying = NULL;
+    m->psz_publisher = NULL;
     return m;
 }
 
 static inline void vlc_meta_Delete( vlc_meta_t *m )
 {
-    int i;
-    for( i = 0; i < m->i_meta; i++ )
-    {
-        free( m->name[i] );
-        free( m->value[i] );
-    }
-    if( m->name ) free( m->name );
-    if( m->value ) free( m->value );
+    free( m->psz_title );
+    free( m->psz_author );
+    free( m->psz_artist );
+    free( m->psz_genre );
+    free( m->psz_copyright );
+    free( m->psz_album );
+    free( m->psz_tracknum );
+    free( m->psz_description );
+    free( m->psz_rating );
+    free( m->psz_date );
+    free( m->psz_setting );
+    free( m->psz_url );
+    free( m->psz_language );
+    free( m->psz_nowplaying );
+    free( m->psz_publisher );
 
-    for( i = 0; i < m->i_track; i++ )
-    {
-        vlc_meta_Delete( m->track[i] );
-    }
-    if( m->track ) free( m->track );
     free( m );
 }
 
-static inline void vlc_meta_Add( vlc_meta_t *m,
-                                 const char *name, const char *value )
-{
-    m->name  = (char**)realloc( m->name, sizeof(char*) * ( m->i_meta + 1 ) );
-    m->name[m->i_meta] = strdup( name );
-
-    m->value = (char**)realloc( m->value, sizeof(char*) * ( m->i_meta + 1 ) );
-    m->value[m->i_meta] = strdup( value );
-
-    m->i_meta++;
-}
-
-static inline vlc_meta_t *vlc_meta_Duplicate( vlc_meta_t *src )
-{
-    vlc_meta_t *dst = vlc_meta_New();
-    int i;
-    for( i = 0; i < src->i_meta; i++ )
-    {
-        vlc_meta_Add( dst, src->name[i], src->value[i] );
-    }
-    for( i = 0; i < src->i_track; i++ )
-    {
-        vlc_meta_t *tk = vlc_meta_Duplicate( src->track[i] );
-
-        dst->track = (vlc_meta_t**)realloc( dst->track, sizeof( vlc_meta_t* ) * (dst->i_track+1) );
-        dst->track[dst->i_track++] = tk;
-    }
-    return dst;
-}
-
 static inline void vlc_meta_Merge( vlc_meta_t *dst, vlc_meta_t *src )
 {
-    int i, j;
-    for( i = 0; i < src->i_meta; i++ )
-    {
-        /* Check if dst contains the entry */
-        for( j = 0; j < dst->i_meta; j++ )
-        {
-            if( !strcmp( src->name[i], dst->name[j] ) ) break;
-        }
-        if( j < dst->i_meta )
-        {
-            if( dst->value[j] ) free( dst->value[j] );
-            dst->value[j] = strdup( src->value[i] );
-        }
-        else vlc_meta_Add( dst, src->name[i], src->value[i] );
-    }
-}
-
-static inline char *vlc_meta_GetValue( vlc_meta_t *m, const char *name )
-{
-    int i;
-
-    for( i = 0; i < m->i_meta; i++ )
-    {
-        if( !strcmp( m->name[i], name ) )
-        {
-            char *value = NULL;
-            if( m->value[i] ) value = strdup( m->value[i] );
-            return value;
-        }
+    if( !dst || !src ) return;
+#define COPY_FIELD( a ) \
+    if( src->psz_ ## a ) { \
+        if( dst->psz_ ## a ) free( dst->psz_## a ); \
+        dst->psz_##a = strdup( src->psz_##a ); \
     }
-    return NULL;
+    COPY_FIELD( title );
+    COPY_FIELD( author );
+    COPY_FIELD( artist );
+    COPY_FIELD( genre );
+    COPY_FIELD( copyright );
+    COPY_FIELD( album );
+    COPY_FIELD( tracknum );
+    COPY_FIELD( description );
+    COPY_FIELD( rating );
+    COPY_FIELD( date );
+    COPY_FIELD( setting );
+    COPY_FIELD( url );
+    COPY_FIELD( language );
+    COPY_FIELD( nowplaying );
+    COPY_FIELD( publisher );
 }
+    /** \todo Track meta */
 
 #endif
index 009b9f5..6f8af17 100644 (file)
@@ -23,7 +23,7 @@
 
 /**
  * \file
- * This file defines the vlc_object_t structure and object types
+ * This file defines the vlc_object_t structure and object types.
  */
 
 /**
@@ -100,6 +100,7 @@ VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
 VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
 VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
 VLC_EXPORT( vlc_t *, vlc_current_object, ( int ) );
+
 /*}@*/
 
 #define vlc_object_create(a,b) \
@@ -129,4 +130,3 @@ VLC_EXPORT( vlc_t *, vlc_current_object, ( int ) );
 
 #define vlc_list_find(a,b,c) \
     __vlc_list_find( VLC_OBJECT(a),b,c)
-
index bb45870..d701fbd 100644 (file)
@@ -21,6 +21,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifndef _VLC_PLAYLIST_H_
+#define _VLC_PLAYLIST_H_
+
 /**
  *  \file
  *  This file contain structures and function prototypes related
@@ -40,12 +43,7 @@ struct playlist_export_t
 {
     char *psz_filename;
     FILE *p_file;
-};
-
-struct item_parent_t
-{
-    int i_view;
-    playlist_item_t *p_parent;
+    playlist_item_t *p_root;
 };
 
 /**
@@ -54,70 +52,31 @@ struct item_parent_t
  */
 struct playlist_item_t
 {
-    input_item_t           input;       /**< input item descriptor */
+    input_item_t           *p_input;    /**< input item descriptor */
 
     /* Tree specific fields */
     int                    i_children;  /**< Number of children
                                              -1 if not a node */
     playlist_item_t      **pp_children; /**< Children nodes/items */
-    int                    i_parents;   /**< Number of parents */
-    struct item_parent_t **pp_parents;  /**< Parents */
-    int                    i_serial;    /**< Has this node been updated ? */
-
-    uint8_t                i_flags;     /**< Flags */
-
+    playlist_item_t       *p_parent;    /**< Item parent */
 
-    int        i_nb_played;       /**< How many times was this item played ? */
+    int                    i_id;        /**< Playlist item specific id */
 
-    /* LEGACY FIELDS */
-    vlc_bool_t b_autodeletion;    /**< Indicates whther this item is to
-                                   * be deleted after playback. True mean
-                                   * that this item is to be deleted
-                                   * after playback, false otherwise */
-    vlc_bool_t b_enabled;         /**< Indicates whether this item is to be
-                                   * played or skipped */
-    /* END LEGACY FIELDS */
+    uint8_t                i_flags;     /**< Flags */
 };
 
-#define PLAYLIST_SAVE_FLAG      0x01     /**< Must it be saved */
-#define PLAYLIST_SKIP_FLAG      0x02     /**< Must playlist skip after it ? */
-#define PLAYLIST_ENA_FLAG       0x04     /**< Is it enabled ? */
-#define PLAYLIST_DEL_FLAG       0x08     /**< Autodelete ? */
+#define PLAYLIST_SAVE_FLAG      0x01    /**< Must it be saved */
+#define PLAYLIST_SKIP_FLAG      0x02    /**< Must playlist skip after it ? */
+#define PLAYLIST_DBL_FLAG       0x04    /**< Is it disabled ? */
 #define PLAYLIST_RO_FLAG        0x10    /**< Write-enabled ? */
 #define PLAYLIST_REMOVE_FLAG    0x20    /**< Remove this item at the end */
-
-/**
- * playlist view
- * \see playlist_t
-*/
-struct playlist_view_t
-{
-    char            *   psz_name;        /**< View name */
-    int                 i_id;            /**< Identifier for the view */
-    playlist_item_t *   p_root;          /**< Root node */
-};
-
-
-/**
- * predefined views
- *
- */
-#define VIEW_CATEGORY 1
-#define VIEW_SIMPLE   2
-#define VIEW_ALL      3
-#define VIEW_FIRST_SORTED  4
-#define VIEW_S_AUTHOR 4
-#define VIEW_S_GENRE 5
-#define VIEW_S_ALBUM  6
-
-#define VIEW_LAST_SORTED  10
-
-#define VIEW_FIRST_CUSTOM 100
+#define PLAYLIST_EXPANDED_FLAG  0x40    /**< Expanded node */
 
 /**
  * Playlist status
  */
-typedef enum { PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_status_t;
+typedef enum
+{ PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_status_t;
 
 
 struct services_discovery_t
@@ -136,7 +95,7 @@ struct playlist_preparse_t
     VLC_COMMON_MEMBERS
     vlc_mutex_t     lock;
     int             i_waiting;
-    int            *pi_waiting;
+    input_item_t  **pp_waiting;
 };
 
 
@@ -151,7 +110,6 @@ struct playlist_t
    These members are uniq to playlist_t
 */
 /*@{*/
-    int                   i_index;  /**< current index into the playlist */
     int                   i_enabled; /**< How many items are enabled ? */
 
     int                   i_size;   /**< total size of the list */
@@ -160,65 +118,59 @@ struct playlist_t
     int                   i_all_size; /**< size of list of items and nodes */
     playlist_item_t **    pp_all_items; /**< array of pointers to the
                                          * playlist items and nodes */
+    int                   i_last_playlist_id; /**< Last id to an item */
 
-    int                   i_views; /**< Number of views */
-    playlist_view_t **    pp_views; /**< array of pointers to the
-                                     * playlist views */
+    int                   i_input_items;
+    input_item_t **    pp_input_items;
 
-    input_thread_t *      p_input;  /**< the input thread ascosiated
-                                     * with the current item */
+    int                  i_last_input_id ;
 
-    mtime_t               request_date; /**< Used for profiling */
+    input_thread_t *      p_input;  /**< the input thread associated
+                                     * with the current item */
 
-    int                   i_last_id; /**< Last id to an item */
     int                   i_sort; /**< Last sorting applied to the playlist */
     int                   i_order; /**< Last ordering applied to the playlist */
 
-    playlist_item_t *    p_general; /**< Keep a pointer on the "general"
-                                        category */
+    playlist_item_t *     p_root_category;
+    playlist_item_t *     p_root_onelevel;
+
+    playlist_item_t *     p_local_category; /** < "Playlist" in CATEGORY view */
+    playlist_item_t *     p_ml_category; /** < "Library" in CATEGORY view */
+    playlist_item_t *     p_local_onelevel; /** < "Playlist" in ONELEVEL view */
+    playlist_item_t *     p_ml_onelevel; /** < "Library" in ONELEVEL iew */
 
     services_discovery_t **pp_sds;
     int                   i_sds;
 
-    vlc_bool_t          b_go_next; /*< Go further than the parent node ? */
-
     struct {
-        /* Current status */
+        /* Current status. These fields are readonly, only the playlist
+         * main loop can touch it*/
         playlist_status_t   i_status;  /**< Current status of playlist */
-
-        /* R/O fields, don't touch if you aren't the playlist thread */
-        /* Use a request */
         playlist_item_t *   p_item; /**< Currently playing/active item */
-        playlist_item_t *   p_node;   /**< Current node to play from */
-        int                 i_view;    /**< Current view */
+        playlist_item_t *   p_node; /**< Current node to play from */
     } status;
 
     struct {
-        /* Request */
-        /* Playlist thread uses this info to calculate the next position */
-        int                 i_view;   /**< requested view id */
+        /* Request. Use this to give orders to the playlist main loop  */
+        int                 i_status; /**< requested playlist status */
         playlist_item_t *   p_node;   /**< requested node to play from */
         playlist_item_t *   p_item;   /**< requested item to play in the node */
 
         int                 i_skip;   /**< Number of items to skip */
-        int                 i_goto;   /**< Direct index to go to (non-view)*/
 
-        vlc_bool_t          b_request; /**< Set to true by the requester
-                                            The playlist sets it back to false
-                                            when processing the request */
-        vlc_mutex_t         lock;      /**< Lock to protect request */
+        vlc_bool_t          b_request;/**< Set to true by the requester
+                                           The playlist sets it back to false
+                                           when processing the request */
+        vlc_mutex_t         lock;     /**< Lock to protect request */
     } request;
 
-    playlist_preparse_t     *p_preparse;
+    playlist_preparse_t     *p_preparse; /**< Preparser object */
 
     vlc_mutex_t gc_lock;         /**< Lock to protect the garbage collection */
 
-    // The following members are about user interaction
-    // The playlist manages the user interaction to avoid creating another
-    // thread
-    interaction_t *p_interaction;
-
-    global_stats_t *p_stats;
+    // Playlist-unrelated fields
+    interaction_t *p_interaction;       /**< Interaction manager */
+    global_stats_t *p_stats;            /**< Global statistics */
 
     /*@}*/
 };
@@ -249,10 +201,27 @@ struct playlist_add_t
  * Prototypes
  *****************************************************************************/
 
+/* Global thread */
+#define playlist_ThreadCreate(a) __playlist_ThreadCreate(VLC_OBJECT(a))
+playlist_t *__playlist_ThreadCreate   ( vlc_object_t * );
+int           playlist_ThreadDestroy  ( playlist_t * );
+
+/* Helpers */
+#define PL_LOCK vlc_mutex_lock( &p_playlist->object_lock );
+#define PL_UNLOCK vlc_mutex_unlock( &p_playlist->object_lock );
+
 /* Creation/Deletion */
-#define playlist_Create(a) __playlist_Create(VLC_OBJECT(a))
-playlist_t * __playlist_Create   ( vlc_object_t * );
-int            playlist_Destroy  ( playlist_t * );
+playlist_t *playlist_Create   ( vlc_object_t * );
+void        playlist_Destroy  ( playlist_t * );
+
+/* Engine */
+void playlist_MainLoop( playlist_t * );
+void playlist_LastLoop( playlist_t * );
+void playlist_PreparseLoop( playlist_preparse_t * );
+
+/* Control */
+playlist_item_t * playlist_NextItem  ( playlist_t * );
+int playlist_PlayItem  ( playlist_t *, playlist_item_t * );
 
 /* Playlist control */
 #define playlist_Play(p) playlist_LockControl(p,PLAYLIST_PLAY )
@@ -261,13 +230,12 @@ int            playlist_Destroy  ( playlist_t * );
 #define playlist_Next(p) playlist_LockControl(p,PLAYLIST_SKIP, 1)
 #define playlist_Prev(p) playlist_LockControl(p,PLAYLIST_SKIP, -1)
 #define playlist_Skip(p,i) playlist_LockControl(p,PLAYLIST_SKIP, i)
-#define playlist_Goto(p,i) playlist_LockControl(p,PLAYLIST_GOTO, i)
 
 VLC_EXPORT( int, playlist_Control, ( playlist_t *, int, ...  ) );
 VLC_EXPORT( int, playlist_LockControl, ( playlist_t *, int, ...  ) );
 
-VLC_EXPORT( int,  playlist_Clear, ( playlist_t * ) );
-VLC_EXPORT( int,  playlist_LockClear, ( playlist_t * ) );
+VLC_EXPORT( void,  playlist_Clear, ( playlist_t * ) );
+VLC_EXPORT( void,  playlist_LockClear, ( playlist_t * ) );
 
 VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *) );
 VLC_EXPORT( int, playlist_PreparseEnqueueItem, (playlist_t *, playlist_item_t *) );
@@ -281,80 +249,99 @@ VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const
 
 
 /* Item management functions (act on items) */
-#define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
 #define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
 #define playlist_ItemCopy( a, b ) __playlist_ItemCopy(VLC_OBJECT(a), b )
 VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
 VLC_EXPORT( playlist_item_t* , __playlist_ItemCopy, ( vlc_object_t *,playlist_item_t* ) );
-VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int ) );
+VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int , const char **, int, int) );
+#define playlist_ItemNewFromInput(a,b) __playlist_ItemNewFromInput(VLC_OBJECT(a),b)
+VLC_EXPORT( playlist_item_t *, __playlist_ItemNewFromInput, ( vlc_object_t *p_obj,input_item_t *p_input ) );
+
+
 VLC_EXPORT( int, playlist_ItemDelete, ( playlist_item_t * ) );
-VLC_EXPORT( int, playlist_ItemAddParent, ( playlist_item_t *, int,playlist_item_t *) );
-VLC_EXPORT( int, playlist_CopyParents, ( playlist_item_t *,playlist_item_t *) );
+
 /* Item informations accessors */
 VLC_EXPORT( int, playlist_ItemSetName, (playlist_item_t *,  char * ) );
 VLC_EXPORT( int, playlist_ItemSetDuration, (playlist_item_t *, mtime_t ) );
 
+VLC_EXPORT( void, playlist_ItemAddOption, (playlist_item_t *, const char *) );
 
-/* View management functions */
-VLC_EXPORT( int, playlist_ViewInsert, (playlist_t *, int, char * ) );
-VLC_EXPORT( int, playlist_ViewDelete, (playlist_t *,playlist_view_t* ) );
-VLC_EXPORT( playlist_view_t *, playlist_ViewFind, (playlist_t *, int ) );
-VLC_EXPORT( int, playlist_ViewUpdate, (playlist_t *, int ) );
-VLC_EXPORT( int, playlist_ViewDump, (playlist_t *, playlist_view_t * ) );
-VLC_EXPORT( int, playlist_ViewEmpty, (playlist_t *, int, vlc_bool_t ) );
+VLC_EXPORT(void, playlist_NodeDump, ( playlist_t *p_playlist, playlist_item_t *p_item, int i_level ) );
+
+/** Counts the items of a view */
+VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
 
 /* Node management */
-VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *,int,char *, playlist_item_t * p_parent ) );
-VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,int,playlist_item_t*,playlist_item_t *) );
-VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,int,playlist_item_t*,playlist_item_t *, int) );
+VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, char *, playlist_item_t * p_parent ) );
+VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) );
+VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_item_t *, int) );
 VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
-VLC_EXPORT( int, playlist_NodeRemoveParent, (playlist_t *,playlist_item_t*,playlist_item_t *) );
-VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
 VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
 VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
 VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
 
-/* Tree walking */
-playlist_item_t *playlist_FindNextFromParent( playlist_t *p_playlist,
-                int i_view,
-                playlist_item_t *p_root,
-                playlist_item_t *p_node,
-                playlist_item_t *p_item );
-playlist_item_t *playlist_FindPrevFromParent( playlist_t *p_playlist,
-                int i_view,
-                playlist_item_t *p_root,
-                playlist_item_t *p_node,
-                playlist_item_t *p_item );
+/* Tree walking - These functions are only for playlist, not plugins */
+playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
+                                       playlist_item_t *p_root,
+                                       playlist_item_t *p_item );
+playlist_item_t *playlist_GetNextEnabledLeaf( playlist_t *p_playlist,
+                                              playlist_item_t *p_root,
+                                              playlist_item_t *p_item );
+playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
+                                       playlist_item_t *p_root,
+                                       playlist_item_t *p_item );
+playlist_item_t *playlist_GetLastLeaf( playlist_t *p_playlist,
+                                       playlist_item_t *p_root );
 
 
 /* Simple add/remove functions */
-/* These functions add the item to the "simple" view (+all & category )*/
-VLC_EXPORT( int,  playlist_Add,    ( playlist_t *, const char *, const char *, int, int ) );
-VLC_EXPORT( int,  playlist_AddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int ) );
-VLC_EXPORT( int,  playlist_ItemAdd, ( playlist_t *, playlist_item_t *, int, int ) );
-VLC_EXPORT(int, playlist_NodeAddItem, ( playlist_t *, playlist_item_t *,int,playlist_item_t *,int , int ) );
+VLC_EXPORT( int,  playlist_PlaylistAdd,    ( playlist_t *, const char *, const char *, int, int ) );
+VLC_EXPORT( int,  playlist_PlaylistAddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int ) );
+VLC_EXPORT( int, playlist_PlaylistAddInput, ( playlist_t *, input_item_t *,int , int ) );
+VLC_EXPORT( playlist_item_t *, playlist_NodeAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int ) );
+VLC_EXPORT( void, playlist_NodeAddItem, ( playlist_t *, playlist_item_t *, playlist_item_t *,int , int ) );
+VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int ) );
+VLC_EXPORT( void, playlist_AddWhereverNeeded, (playlist_t* , input_item_t*, playlist_item_t*,playlist_item_t*,vlc_bool_t, int ) );
+
+void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id, int i_node_id );
 
 /* Misc item operations (act on item+playlist) */
-VLC_EXPORT( int,  playlist_Delete, ( playlist_t *, int ) );
+VLC_EXPORT( int,  playlist_DeleteAllFromInput, ( playlist_t *, int ) );
+VLC_EXPORT( int,  playlist_DeleteFromInput, ( playlist_t *, int, playlist_item_t *, vlc_bool_t ) );
+VLC_EXPORT( int,  playlist_DeleteFromItemId, ( playlist_t *, int ) );
 VLC_EXPORT( int,  playlist_LockDelete, ( playlist_t *, int ) );
-VLC_EXPORT( int,  playlist_Disable, ( playlist_t *, playlist_item_t * ) );
-VLC_EXPORT( int,  playlist_Enable, ( playlist_t *, playlist_item_t * ) );
-VLC_EXPORT( int, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
-VLC_EXPORT( int, playlist_LockItemToNode, (playlist_t *,playlist_item_t *) );
-VLC_EXPORT( int, playlist_Replace, (playlist_t *,playlist_item_t *, input_item_t*) );
-VLC_EXPORT( int, playlist_LockReplace, (playlist_t *,playlist_item_t *, input_item_t*) );
+VLC_EXPORT( int,  playlist_LockDeleteAllFromInput, ( playlist_t *, int ) );
+VLC_EXPORT( playlist_item_t*, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
+VLC_EXPORT( playlist_item_t*, playlist_LockItemToNode, (playlist_t *,playlist_item_t *) );
 
+playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
+                                   int i_input_id, playlist_item_t *p_root );
 
 /* Item search functions */
 VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int) );
-VLC_EXPORT( playlist_item_t *, playlist_LockItemGetById, (playlist_t *, int) );
-VLC_EXPORT( playlist_item_t *, playlist_ItemGetByPos, (playlist_t *, int) );
-VLC_EXPORT( playlist_item_t *, playlist_LockItemGetByPos, (playlist_t *, int) );
 VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) );
-VLC_EXPORT( playlist_item_t *, playlist_LockItemGetByInput, (playlist_t *,input_item_t * ) );
-VLC_EXPORT( int, playlist_GetPositionById, (playlist_t *,int ) );
 
-VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
+static inline playlist_item_t *playlist_LockItemGetById( playlist_t *p_playlist,
+                                                         int i_id)
+{
+    playlist_item_t *p_ret;
+    vlc_mutex_lock( &p_playlist->object_lock );
+    p_ret = playlist_ItemGetById( p_playlist, i_id );
+    vlc_mutex_unlock( &p_playlist->object_lock );
+    return p_ret;
+}
+
+static inline playlist_item_t *playlist_LockItemGetByInput(
+                                playlist_t *p_playlist, input_item_t *p_item )
+{
+    playlist_item_t *p_ret;
+    vlc_mutex_lock( &p_playlist->object_lock );
+    p_ret = playlist_ItemGetByInput( p_playlist, p_item );
+    vlc_mutex_unlock( &p_playlist->object_lock );
+    return p_ret;
+}
+
+VLC_EXPORT( int, playlist_LiveSearchUpdate, (playlist_t *, playlist_item_t *, const char *) );
 
 /* Playlist sorting */
 #define playlist_SortID(p, i) playlist_Sort( p, SORT_ID, i)
@@ -362,56 +349,41 @@ VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
 #define playlist_SortAuthor(p, i) playlist_Sort( p, SORT_AUTHOR, i)
 #define playlist_SortAlbum(p, i) playlist_Sort( p, SORT_ALBUM, i)
 #define playlist_SortGroup(p, i) playlist_Sort( p, SORT_GROUP, i)
-VLC_EXPORT( int,  playlist_Sort, ( playlist_t *, int, int) );
-VLC_EXPORT( int,  playlist_Move, ( playlist_t *, int, int ) );
-VLC_EXPORT( int,  playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int, int ) );
-VLC_EXPORT( int,  playlist_NodeGroup, ( playlist_t *, int,playlist_item_t *,playlist_item_t **,int, int, int ) );
+VLC_EXPORT( int,  playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) );
+VLC_EXPORT( int,  playlist_NodeGroup, ( playlist_t *, playlist_item_t *,playlist_item_t **,int, int, int ) );
 VLC_EXPORT( int,  playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
 VLC_EXPORT( int,  playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
 
 /* Load/Save */
 VLC_EXPORT( int,  playlist_Import, ( playlist_t *, const char * ) );
-VLC_EXPORT( int,  playlist_Export, ( playlist_t *, const char *, const char * ) );
+VLC_EXPORT( int,  playlist_Export, ( playlist_t *, const char *, playlist_item_t *, const char * ) );
 
 /***********************************************************************
  * Inline functions
  ***********************************************************************/
 
-
-/**
- *  tell if a playlist is currently playing.
- *  \param p_playlist the playlist to check
- *  \return true if playlist is playing, false otherwise
- */
+/** Tell if the playlist is currently running */
 static inline vlc_bool_t playlist_IsPlaying( playlist_t * p_playlist )
 {
     vlc_bool_t b_playing;
-
     vlc_mutex_lock( &p_playlist->object_lock );
     b_playing = p_playlist->status.i_status == PLAYLIST_RUNNING;
     vlc_mutex_unlock( &p_playlist->object_lock );
-
     return( b_playing );
 }
 
-/**
- *  tell if a playlist is currently empty
- *  \param p_playlist the playlist to check
- *  \return true if the playlist is empty, false otherwise
- */
+/** Tell if the playlist is empty */
 static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist )
 {
     vlc_bool_t b_empty;
-
     vlc_mutex_lock( &p_playlist->object_lock );
     b_empty = p_playlist->i_size == 0;
     vlc_mutex_unlock( &p_playlist->object_lock );
-
     return( b_empty );
 }
 
-
-
 /**
  * @}
  */
+
+#endif
index 5bff63c..52622d8 100644 (file)
@@ -258,8 +258,8 @@ struct module_symbols_t
     void (*vlc_list_release_inner) (vlc_list_t *);
     int (*playlist_Control_inner) (playlist_t *, int, ...);
     int (*playlist_LockControl_inner) (playlist_t *, int, ...);
-    int (*playlist_Clear_inner) (playlist_t *);
-    int (*playlist_LockClear_inner) (playlist_t *);
+    void (*playlist_Clear_inner) (playlist_t *);
+    void (*playlist_LockClear_inner) (playlist_t *);
     int (*playlist_PreparseEnqueue_inner) (playlist_t *, input_item_t *);
     int (*playlist_ServicesDiscoveryAdd_inner) (playlist_t *, const char *);
     int (*playlist_ServicesDiscoveryRemove_inner) (playlist_t *, const char *);
@@ -267,53 +267,53 @@ struct module_symbols_t
     vlc_bool_t (*playlist_IsServicesDiscoveryLoaded_inner) (playlist_t *,const char *);
     playlist_item_t* (*__playlist_ItemNew_inner) (vlc_object_t *,const char *,const char *);
     playlist_item_t* (*__playlist_ItemCopy_inner) (vlc_object_t *,playlist_item_t*);
-    playlist_item_t* (*playlist_ItemNewWithType_inner) (vlc_object_t *,const char *,const char *, int);
+    playlist_item_t* (*playlist_ItemNewWithType_inner) (vlc_object_t *,const char *,const char *, int , const char **, int, int);
     int (*playlist_ItemDelete_inner) (playlist_item_t *);
-    int (*playlist_ItemAddParent_inner) (playlist_item_t *, int,playlist_item_t *);
-    int (*playlist_CopyParents_inner) (playlist_item_t *,playlist_item_t *);
+    void *playlist_ItemAddParent_deprecated;
+    void *playlist_CopyParents_deprecated;
     int (*playlist_ItemSetName_inner) (playlist_item_t *,  char *);
     int (*playlist_ItemSetDuration_inner) (playlist_item_t *, mtime_t);
-    int (*playlist_ViewInsert_inner) (playlist_t *, int, char *);
-    int (*playlist_ViewDelete_inner) (playlist_t *,playlist_view_t*);
-    playlist_view_t * (*playlist_ViewFind_inner) (playlist_t *, int);
-    int (*playlist_ViewUpdate_inner) (playlist_t *, int);
-    int (*playlist_ViewDump_inner) (playlist_t *, playlist_view_t *);
-    int (*playlist_ViewEmpty_inner) (playlist_t *, int, vlc_bool_t);
-    playlist_item_t * (*playlist_NodeCreate_inner) (playlist_t *,int,char *, playlist_item_t * p_parent);
-    int (*playlist_NodeAppend_inner) (playlist_t *,int,playlist_item_t*,playlist_item_t *);
-    int (*playlist_NodeInsert_inner) (playlist_t *,int,playlist_item_t*,playlist_item_t *, int);
+    void *playlist_ViewInsert_deprecated;
+    void *playlist_ViewDelete_deprecated;
+    void *playlist_ViewFind_deprecated;
+    void *playlist_ViewUpdate_deprecated;
+    void *playlist_ViewDump_deprecated;
+    void *playlist_ViewEmpty_deprecated;
+    playlist_item_t * (*playlist_NodeCreate_inner) (playlist_t *, char *, playlist_item_t * p_parent);
+    int (*playlist_NodeAppend_inner) (playlist_t *,playlist_item_t*,playlist_item_t *);
+    int (*playlist_NodeInsert_inner) (playlist_t *,playlist_item_t*,playlist_item_t *, int);
     int (*playlist_NodeRemoveItem_inner) (playlist_t *,playlist_item_t*,playlist_item_t *);
     int (*playlist_NodeChildrenCount_inner) (playlist_t *,playlist_item_t*);
     playlist_item_t * (*playlist_ChildSearchName_inner) (playlist_item_t*, const char*);
     int (*playlist_NodeDelete_inner) (playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t);
     int (*playlist_NodeEmpty_inner) (playlist_t *, playlist_item_t *, vlc_bool_t);
-    int (*playlist_Add_inner) (playlist_t *, const char *, const char *, int, int);
-    int (*playlist_AddExt_inner) (playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int);
-    int (*playlist_ItemAdd_inner) (playlist_t *, playlist_item_t *, int, int);
-    int (*playlist_NodeAddItem_inner) (playlist_t *, playlist_item_t *,int,playlist_item_t *,int , int);
-    int (*playlist_Delete_inner) (playlist_t *, int);
+    void *playlist_Add_deprecated;
+    void *playlist_AddExt_deprecated;
+    void *playlist_ItemAdd_deprecated;
+    void (*playlist_NodeAddItem_inner) (playlist_t *, playlist_item_t *, playlist_item_t *,int , int);
+    void *playlist_Delete_deprecated;
     int (*playlist_LockDelete_inner) (playlist_t *, int);
-    int (*playlist_Disable_inner) (playlist_t *, playlist_item_t *);
-    int (*playlist_Enable_inner) (playlist_t *, playlist_item_t *);
-    int (*playlist_ItemToNode_inner) (playlist_t *,playlist_item_t *);
-    int (*playlist_LockItemToNode_inner) (playlist_t *,playlist_item_t *);
-    int (*playlist_Replace_inner) (playlist_t *,playlist_item_t *, input_item_t*);
-    int (*playlist_LockReplace_inner) (playlist_t *,playlist_item_t *, input_item_t*);
+    void *playlist_Disable_deprecated;
+    void *playlist_Enable_deprecated;
+    playlist_item_t* (*playlist_ItemToNode_inner) (playlist_t *,playlist_item_t *);
+    playlist_item_t* (*playlist_LockItemToNode_inner) (playlist_t *,playlist_item_t *);
+    void *playlist_Replace_deprecated;
+    void *playlist_LockReplace_deprecated;
     playlist_item_t * (*playlist_ItemGetById_inner) (playlist_t *, int);
-    playlist_item_t * (*playlist_LockItemGetById_inner) (playlist_t *, int);
-    playlist_item_t * (*playlist_ItemGetByPos_inner) (playlist_t *, int);
-    playlist_item_t * (*playlist_LockItemGetByPos_inner) (playlist_t *, int);
+    void *playlist_LockItemGetById_deprecated;
+    void *playlist_ItemGetByPos_deprecated;
+    void *playlist_LockItemGetByPos_deprecated;
     playlist_item_t * (*playlist_ItemGetByInput_inner) (playlist_t *,input_item_t *);
-    playlist_item_t * (*playlist_LockItemGetByInput_inner) (playlist_t *,input_item_t *);
-    int (*playlist_GetPositionById_inner) (playlist_t *,int);
-    int (*playlist_ItemAddOption_inner) (playlist_item_t *, const char *);
-    int (*playlist_Sort_inner) (playlist_t *, int, int);
-    int (*playlist_Move_inner) (playlist_t *, int, int);
-    int (*playlist_NodeGroup_inner) (playlist_t *, int,playlist_item_t *,playlist_item_t **,int, int, int);
+    void *playlist_LockItemGetByInput_deprecated;
+    void *playlist_GetPositionById_deprecated;
+    void (*playlist_ItemAddOption_inner) (playlist_item_t *, const char *);
+    void *playlist_Sort_deprecated;
+    void *playlist_Move_deprecated;
+    int (*playlist_NodeGroup_inner) (playlist_t *, playlist_item_t *,playlist_item_t **,int, int, int);
     int (*playlist_NodeSort_inner) (playlist_t *, playlist_item_t *,int, int);
     int (*playlist_RecursiveNodeSort_inner) (playlist_t *, playlist_item_t *,int, int);
     int (*playlist_Import_inner) (playlist_t *, const char *);
-    int (*playlist_Export_inner) (playlist_t *, const char *, const char *);
+    int (*playlist_Export_inner) (playlist_t *, const char *, playlist_item_t *, const char *);
     spu_t * (*__spu_Create_inner) (vlc_object_t *);
     int (*spu_Init_inner) (spu_t *);
     void (*spu_Destroy_inner) (spu_t *);
@@ -379,7 +379,7 @@ struct module_symbols_t
     void (*net_ListenClose_inner) (int *fd);
     void (*DigestMD5_inner) (struct md5_s *, uint32_t *);
     int (*ACL_Check_inner) (vlc_acl_t *p_acl, const char *psz_ip);
-    int (*playlist_NodeRemoveParent_inner) (playlist_t *,playlist_item_t*,playlist_item_t *);
+    void *playlist_NodeRemoveParent_deprecated;
     vlc_acl_t * (*__ACL_Duplicate_inner) (vlc_object_t *p_this, const vlc_acl_t *p_acl);
     vlc_acl_t * (*__ACL_Create_inner) (vlc_object_t *p_this, vlc_bool_t b_allow);
     int (*ACL_LoadFile_inner) (vlc_acl_t *p_acl, const char *path);
@@ -475,7 +475,7 @@ struct module_symbols_t
     char * (*FromLocaleDup_inner) (const char *);
     int (*utf8_mkdir_inner) (const char *filename);
     vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *);
-    int (*playlist_TreeMove_inner) (playlist_t *, playlist_item_t *, playlist_item_t *, int, int);
+    int (*playlist_TreeMove_inner) (playlist_t *, playlist_item_t *, playlist_item_t *, int);
     const char * (*config_GetDataDir_inner) (const vlc_object_t *);
     double (*us_atof_inner) (const char *);
     double (*us_strtod_inner) (const char *, char **);
@@ -492,6 +492,26 @@ struct module_symbols_t
     void (*decode_URI_inner) (char *psz);
     char * (*encode_URI_component_inner) (const char *psz);
     size_t (*vlc_strlcpy_inner) (char *, const char *, size_t);
+    void *playlist_ItemNewFromInput_deprecated;
+    input_item_t * (*__input_ItemNewExt_inner) (vlc_object_t *, const char *, const char*, int, const char **, int);
+    input_item_t * (*input_ItemNewWithType_inner) (vlc_object_t *, const char *, const char *e, int, const char **, int, int);
+    playlist_item_t * (*playlist_NodeAddInput_inner) (playlist_t *, input_item_t *,playlist_item_t *,int , int);
+    int (*playlist_PlaylistAdd_inner) (playlist_t *, const char *, const char *, int, int);
+    int (*playlist_PlaylistAddExt_inner) (playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int);
+    int (*playlist_PlaylistAddInput_inner) (playlist_t *, input_item_t *,int , int);
+    int (*playlist_BothAddInput_inner) (playlist_t *, input_item_t *,playlist_item_t *,int , int);
+    playlist_item_t * (*__playlist_ItemNewFromInput_inner) (vlc_object_t *p_obj,input_item_t *p_input);
+    input_item_t * (*input_ItemGetById_inner) (playlist_t *, int);
+    int (*playlist_LiveSearchUpdate_inner) (playlist_t *, playlist_item_t *, const char *);
+    void (*vlc_input_item_AddOption_inner) (input_item_t *p_input, const char *psz_option);
+    int (*playlist_DeleteFromInput_inner) (playlist_t *, int, playlist_item_t *, vlc_bool_t);
+    int (*playlist_DeleteAllFromInput_inner) (playlist_t *, int);
+    int (*playlist_LockDeleteAllFromInput_inner) (playlist_t *, int);
+    void (*playlist_AddWhereverNeeded_inner) (playlist_t* , input_item_t*, playlist_item_t*,playlist_item_t*,vlc_bool_t, int);
+    int (*playlist_DeleteFromItemId_inner) (playlist_t *, int);
+    void (*playlist_NodeDump_inner) (playlist_t *p_playlist, playlist_item_t *p_item, int i_level);
+    int (*__intf_UserOkayCancel_inner) (vlc_object_t*, const char*, const char*);
+    int (*__intf_UserStringInput_inner) (vlc_object_t*, const char*, const char*, char **);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -743,16 +763,8 @@ struct module_symbols_t
 #  define __playlist_ItemCopy (p_symbols)->__playlist_ItemCopy_inner
 #  define playlist_ItemNewWithType (p_symbols)->playlist_ItemNewWithType_inner
 #  define playlist_ItemDelete (p_symbols)->playlist_ItemDelete_inner
-#  define playlist_ItemAddParent (p_symbols)->playlist_ItemAddParent_inner
-#  define playlist_CopyParents (p_symbols)->playlist_CopyParents_inner
 #  define playlist_ItemSetName (p_symbols)->playlist_ItemSetName_inner
 #  define playlist_ItemSetDuration (p_symbols)->playlist_ItemSetDuration_inner
-#  define playlist_ViewInsert (p_symbols)->playlist_ViewInsert_inner
-#  define playlist_ViewDelete (p_symbols)->playlist_ViewDelete_inner
-#  define playlist_ViewFind (p_symbols)->playlist_ViewFind_inner
-#  define playlist_ViewUpdate (p_symbols)->playlist_ViewUpdate_inner
-#  define playlist_ViewDump (p_symbols)->playlist_ViewDump_inner
-#  define playlist_ViewEmpty (p_symbols)->playlist_ViewEmpty_inner
 #  define playlist_NodeCreate (p_symbols)->playlist_NodeCreate_inner
 #  define playlist_NodeAppend (p_symbols)->playlist_NodeAppend_inner
 #  define playlist_NodeInsert (p_symbols)->playlist_NodeInsert_inner
@@ -761,28 +773,13 @@ struct module_symbols_t
 #  define playlist_ChildSearchName (p_symbols)->playlist_ChildSearchName_inner
 #  define playlist_NodeDelete (p_symbols)->playlist_NodeDelete_inner
 #  define playlist_NodeEmpty (p_symbols)->playlist_NodeEmpty_inner
-#  define playlist_Add (p_symbols)->playlist_Add_inner
-#  define playlist_AddExt (p_symbols)->playlist_AddExt_inner
-#  define playlist_ItemAdd (p_symbols)->playlist_ItemAdd_inner
 #  define playlist_NodeAddItem (p_symbols)->playlist_NodeAddItem_inner
-#  define playlist_Delete (p_symbols)->playlist_Delete_inner
 #  define playlist_LockDelete (p_symbols)->playlist_LockDelete_inner
-#  define playlist_Disable (p_symbols)->playlist_Disable_inner
-#  define playlist_Enable (p_symbols)->playlist_Enable_inner
 #  define playlist_ItemToNode (p_symbols)->playlist_ItemToNode_inner
 #  define playlist_LockItemToNode (p_symbols)->playlist_LockItemToNode_inner
-#  define playlist_Replace (p_symbols)->playlist_Replace_inner
-#  define playlist_LockReplace (p_symbols)->playlist_LockReplace_inner
 #  define playlist_ItemGetById (p_symbols)->playlist_ItemGetById_inner
-#  define playlist_LockItemGetById (p_symbols)->playlist_LockItemGetById_inner
-#  define playlist_ItemGetByPos (p_symbols)->playlist_ItemGetByPos_inner
-#  define playlist_LockItemGetByPos (p_symbols)->playlist_LockItemGetByPos_inner
 #  define playlist_ItemGetByInput (p_symbols)->playlist_ItemGetByInput_inner
-#  define playlist_LockItemGetByInput (p_symbols)->playlist_LockItemGetByInput_inner
-#  define playlist_GetPositionById (p_symbols)->playlist_GetPositionById_inner
 #  define playlist_ItemAddOption (p_symbols)->playlist_ItemAddOption_inner
-#  define playlist_Sort (p_symbols)->playlist_Sort_inner
-#  define playlist_Move (p_symbols)->playlist_Move_inner
 #  define playlist_NodeGroup (p_symbols)->playlist_NodeGroup_inner
 #  define playlist_NodeSort (p_symbols)->playlist_NodeSort_inner
 #  define playlist_RecursiveNodeSort (p_symbols)->playlist_RecursiveNodeSort_inner
@@ -853,7 +850,6 @@ struct module_symbols_t
 #  define net_ListenClose (p_symbols)->net_ListenClose_inner
 #  define DigestMD5 (p_symbols)->DigestMD5_inner
 #  define ACL_Check (p_symbols)->ACL_Check_inner
-#  define playlist_NodeRemoveParent (p_symbols)->playlist_NodeRemoveParent_inner
 #  define __ACL_Duplicate (p_symbols)->__ACL_Duplicate_inner
 #  define __ACL_Create (p_symbols)->__ACL_Create_inner
 #  define ACL_LoadFile (p_symbols)->ACL_LoadFile_inner
@@ -964,6 +960,25 @@ struct module_symbols_t
 #  define decode_URI (p_symbols)->decode_URI_inner
 #  define encode_URI_component (p_symbols)->encode_URI_component_inner
 #  define vlc_strlcpy (p_symbols)->vlc_strlcpy_inner
+#  define __input_ItemNewExt (p_symbols)->__input_ItemNewExt_inner
+#  define input_ItemNewWithType (p_symbols)->input_ItemNewWithType_inner
+#  define playlist_NodeAddInput (p_symbols)->playlist_NodeAddInput_inner
+#  define playlist_PlaylistAdd (p_symbols)->playlist_PlaylistAdd_inner
+#  define playlist_PlaylistAddExt (p_symbols)->playlist_PlaylistAddExt_inner
+#  define playlist_PlaylistAddInput (p_symbols)->playlist_PlaylistAddInput_inner
+#  define playlist_BothAddInput (p_symbols)->playlist_BothAddInput_inner
+#  define __playlist_ItemNewFromInput (p_symbols)->__playlist_ItemNewFromInput_inner
+#  define input_ItemGetById (p_symbols)->input_ItemGetById_inner
+#  define playlist_LiveSearchUpdate (p_symbols)->playlist_LiveSearchUpdate_inner
+#  define vlc_input_item_AddOption (p_symbols)->vlc_input_item_AddOption_inner
+#  define playlist_DeleteFromInput (p_symbols)->playlist_DeleteFromInput_inner
+#  define playlist_DeleteAllFromInput (p_symbols)->playlist_DeleteAllFromInput_inner
+#  define playlist_LockDeleteAllFromInput (p_symbols)->playlist_LockDeleteAllFromInput_inner
+#  define playlist_AddWhereverNeeded (p_symbols)->playlist_AddWhereverNeeded_inner
+#  define playlist_DeleteFromItemId (p_symbols)->playlist_DeleteFromItemId_inner
+#  define playlist_NodeDump (p_symbols)->playlist_NodeDump_inner
+#  define __intf_UserOkayCancel (p_symbols)->__intf_UserOkayCancel_inner
+#  define __intf_UserStringInput (p_symbols)->__intf_UserStringInput_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1218,16 +1233,8 @@ struct module_symbols_t
     ((p_symbols)->__playlist_ItemCopy_inner) = __playlist_ItemCopy; \
     ((p_symbols)->playlist_ItemNewWithType_inner) = playlist_ItemNewWithType; \
     ((p_symbols)->playlist_ItemDelete_inner) = playlist_ItemDelete; \
-    ((p_symbols)->playlist_ItemAddParent_inner) = playlist_ItemAddParent; \
-    ((p_symbols)->playlist_CopyParents_inner) = playlist_CopyParents; \
     ((p_symbols)->playlist_ItemSetName_inner) = playlist_ItemSetName; \
     ((p_symbols)->playlist_ItemSetDuration_inner) = playlist_ItemSetDuration; \
-    ((p_symbols)->playlist_ViewInsert_inner) = playlist_ViewInsert; \
-    ((p_symbols)->playlist_ViewDelete_inner) = playlist_ViewDelete; \
-    ((p_symbols)->playlist_ViewFind_inner) = playlist_ViewFind; \
-    ((p_symbols)->playlist_ViewUpdate_inner) = playlist_ViewUpdate; \
-    ((p_symbols)->playlist_ViewDump_inner) = playlist_ViewDump; \
-    ((p_symbols)->playlist_ViewEmpty_inner) = playlist_ViewEmpty; \
     ((p_symbols)->playlist_NodeCreate_inner) = playlist_NodeCreate; \
     ((p_symbols)->playlist_NodeAppend_inner) = playlist_NodeAppend; \
     ((p_symbols)->playlist_NodeInsert_inner) = playlist_NodeInsert; \
@@ -1236,28 +1243,13 @@ struct module_symbols_t
     ((p_symbols)->playlist_ChildSearchName_inner) = playlist_ChildSearchName; \
     ((p_symbols)->playlist_NodeDelete_inner) = playlist_NodeDelete; \
     ((p_symbols)->playlist_NodeEmpty_inner) = playlist_NodeEmpty; \
-    ((p_symbols)->playlist_Add_inner) = playlist_Add; \
-    ((p_symbols)->playlist_AddExt_inner) = playlist_AddExt; \
-    ((p_symbols)->playlist_ItemAdd_inner) = playlist_ItemAdd; \
     ((p_symbols)->playlist_NodeAddItem_inner) = playlist_NodeAddItem; \
-    ((p_symbols)->playlist_Delete_inner) = playlist_Delete; \
     ((p_symbols)->playlist_LockDelete_inner) = playlist_LockDelete; \
-    ((p_symbols)->playlist_Disable_inner) = playlist_Disable; \
-    ((p_symbols)->playlist_Enable_inner) = playlist_Enable; \
     ((p_symbols)->playlist_ItemToNode_inner) = playlist_ItemToNode; \
     ((p_symbols)->playlist_LockItemToNode_inner) = playlist_LockItemToNode; \
-    ((p_symbols)->playlist_Replace_inner) = playlist_Replace; \
-    ((p_symbols)->playlist_LockReplace_inner) = playlist_LockReplace; \
     ((p_symbols)->playlist_ItemGetById_inner) = playlist_ItemGetById; \
-    ((p_symbols)->playlist_LockItemGetById_inner) = playlist_LockItemGetById; \
-    ((p_symbols)->playlist_ItemGetByPos_inner) = playlist_ItemGetByPos; \
-    ((p_symbols)->playlist_LockItemGetByPos_inner) = playlist_LockItemGetByPos; \
     ((p_symbols)->playlist_ItemGetByInput_inner) = playlist_ItemGetByInput; \
-    ((p_symbols)->playlist_LockItemGetByInput_inner) = playlist_LockItemGetByInput; \
-    ((p_symbols)->playlist_GetPositionById_inner) = playlist_GetPositionById; \
     ((p_symbols)->playlist_ItemAddOption_inner) = playlist_ItemAddOption; \
-    ((p_symbols)->playlist_Sort_inner) = playlist_Sort; \
-    ((p_symbols)->playlist_Move_inner) = playlist_Move; \
     ((p_symbols)->playlist_NodeGroup_inner) = playlist_NodeGroup; \
     ((p_symbols)->playlist_NodeSort_inner) = playlist_NodeSort; \
     ((p_symbols)->playlist_RecursiveNodeSort_inner) = playlist_RecursiveNodeSort; \
@@ -1328,7 +1320,6 @@ struct module_symbols_t
     ((p_symbols)->net_ListenClose_inner) = net_ListenClose; \
     ((p_symbols)->DigestMD5_inner) = DigestMD5; \
     ((p_symbols)->ACL_Check_inner) = ACL_Check; \
-    ((p_symbols)->playlist_NodeRemoveParent_inner) = playlist_NodeRemoveParent; \
     ((p_symbols)->__ACL_Duplicate_inner) = __ACL_Duplicate; \
     ((p_symbols)->__ACL_Create_inner) = __ACL_Create; \
     ((p_symbols)->ACL_LoadFile_inner) = ACL_LoadFile; \
@@ -1439,9 +1430,53 @@ struct module_symbols_t
     ((p_symbols)->decode_URI_inner) = decode_URI; \
     ((p_symbols)->encode_URI_component_inner) = encode_URI_component; \
     ((p_symbols)->vlc_strlcpy_inner) = vlc_strlcpy; \
+    ((p_symbols)->__input_ItemNewExt_inner) = __input_ItemNewExt; \
+    ((p_symbols)->input_ItemNewWithType_inner) = input_ItemNewWithType; \
+    ((p_symbols)->playlist_NodeAddInput_inner) = playlist_NodeAddInput; \
+    ((p_symbols)->playlist_PlaylistAdd_inner) = playlist_PlaylistAdd; \
+    ((p_symbols)->playlist_PlaylistAddExt_inner) = playlist_PlaylistAddExt; \
+    ((p_symbols)->playlist_PlaylistAddInput_inner) = playlist_PlaylistAddInput; \
+    ((p_symbols)->playlist_BothAddInput_inner) = playlist_BothAddInput; \
+    ((p_symbols)->__playlist_ItemNewFromInput_inner) = __playlist_ItemNewFromInput; \
+    ((p_symbols)->input_ItemGetById_inner) = input_ItemGetById; \
+    ((p_symbols)->playlist_LiveSearchUpdate_inner) = playlist_LiveSearchUpdate; \
+    ((p_symbols)->vlc_input_item_AddOption_inner) = vlc_input_item_AddOption; \
+    ((p_symbols)->playlist_DeleteFromInput_inner) = playlist_DeleteFromInput; \
+    ((p_symbols)->playlist_DeleteAllFromInput_inner) = playlist_DeleteAllFromInput; \
+    ((p_symbols)->playlist_LockDeleteAllFromInput_inner) = playlist_LockDeleteAllFromInput; \
+    ((p_symbols)->playlist_AddWhereverNeeded_inner) = playlist_AddWhereverNeeded; \
+    ((p_symbols)->playlist_DeleteFromItemId_inner) = playlist_DeleteFromItemId; \
+    ((p_symbols)->playlist_NodeDump_inner) = playlist_NodeDump; \
+    ((p_symbols)->__intf_UserOkayCancel_inner) = __intf_UserOkayCancel; \
+    ((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
+    (p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
+    (p_symbols)->playlist_CopyParents_deprecated = NULL; \
+    (p_symbols)->playlist_ViewInsert_deprecated = NULL; \
+    (p_symbols)->playlist_ViewDelete_deprecated = NULL; \
+    (p_symbols)->playlist_ViewFind_deprecated = NULL; \
+    (p_symbols)->playlist_ViewUpdate_deprecated = NULL; \
+    (p_symbols)->playlist_ViewDump_deprecated = NULL; \
+    (p_symbols)->playlist_ViewEmpty_deprecated = NULL; \
+    (p_symbols)->playlist_Add_deprecated = NULL; \
+    (p_symbols)->playlist_AddExt_deprecated = NULL; \
+    (p_symbols)->playlist_ItemAdd_deprecated = NULL; \
+    (p_symbols)->playlist_Delete_deprecated = NULL; \
+    (p_symbols)->playlist_Disable_deprecated = NULL; \
+    (p_symbols)->playlist_Enable_deprecated = NULL; \
+    (p_symbols)->playlist_Replace_deprecated = NULL; \
+    (p_symbols)->playlist_LockReplace_deprecated = NULL; \
+    (p_symbols)->playlist_LockItemGetById_deprecated = NULL; \
+    (p_symbols)->playlist_ItemGetByPos_deprecated = NULL; \
+    (p_symbols)->playlist_LockItemGetByPos_deprecated = NULL; \
+    (p_symbols)->playlist_LockItemGetByInput_deprecated = NULL; \
+    (p_symbols)->playlist_GetPositionById_deprecated = NULL; \
+    (p_symbols)->playlist_Sort_deprecated = NULL; \
+    (p_symbols)->playlist_Move_deprecated = NULL; \
+    (p_symbols)->playlist_NodeRemoveParent_deprecated = NULL; \
     (p_symbols)->__stats_CounterGet_deprecated = NULL; \
     (p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
+    (p_symbols)->playlist_ItemNewFromInput_deprecated = NULL; \
 
 # endif /* __PLUGIN__ */
 #endif /* __VLC_SYMBOLS_H */
index 5b3dbf1..db98607 100644 (file)
@@ -216,7 +216,7 @@ static int Open( vlc_object_t *p_this )
         if( !p_playlist ) return VLC_EGENERIC;
 
         /* Let's check if we need to play */
-        if( &p_playlist->status.p_item->input ==
+        if( p_playlist->status.p_item->p_input ==
              ((input_thread_t *)p_access->p_parent)->input.p_item )
         {
             p_item = p_playlist->status.p_item;
@@ -290,8 +290,7 @@ static int Open( vlc_object_t *p_this )
     if( b_play )
     {
         playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                          p_playlist->status.i_view, p_playlist->status.p_item,
-                          NULL );
+                          p_playlist->status.p_item, NULL );
     }
 
     if( p_playlist ) vlc_object_release( p_playlist );
@@ -445,7 +444,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
     input_title_t ***ppp_title;
     int i;
     char         *psz_title;
-    vlc_meta_t  **pp_meta;
+    vlc_meta_t  *p_meta;
 
     switch( i_query )
     {
@@ -511,9 +510,8 @@ static int Control( access_t *p_access, int i_query, va_list args )
              psz_title = malloc( strlen( _("Audio CD - Track ") ) + 5 );
              snprintf( psz_title, 100, _("Audio CD - Track %i" ),
                                         p_access->info.i_title+1 );
-             pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-             *pp_meta = vlc_meta_New();
-             vlc_meta_Add( *pp_meta, _(VLC_META_TITLE), psz_title );
+             p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
+             vlc_meta_SetTitle( p_meta, psz_title );
              free( psz_title );
              break;
 
@@ -534,7 +532,7 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
 {
     access_sys_t *p_sys = p_access->p_sys;
     int i;
-    playlist_item_t *p_item;
+    input_item_t *p_input_item;
     char *psz_name;
     p_sys->i_titles = ioctl_GetTracksMap( VLC_OBJECT(p_access),
                                           p_sys->vcddev, &p_sys->p_sectors );
@@ -560,7 +558,7 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
         playlist_ItemSetName( p_parent, psz_name );
         vlc_mutex_unlock( &p_playlist->object_lock );
         var_SetInteger( p_playlist, "item-change",
-                        p_parent->input.i_id );
+                        p_parent->p_input->i_id );
         free( psz_name );
 
 #ifdef HAVE_LIBCDDB
@@ -575,7 +573,7 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
                 playlist_ItemSetName( p_parent, psz_name );
                 vlc_mutex_unlock( &p_playlist->object_lock );
                 var_SetInteger( p_playlist, "item-change",
-                                p_parent->input.i_id );
+                                p_parent->p_input->i_id );
                 free( psz_name );
             }
         }
@@ -615,9 +613,10 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
             sprintf( psz_name, _("Audio CD - Track %i"), (i+1) );
 
             /* Create playlist items */
-            p_item = playlist_ItemNewWithType( VLC_OBJECT( p_playlist ),
-                                 psz_uri, psz_name, ITEM_TYPE_DISC );
-            playlist_ItemAddOption( p_item, psz_opt );
+            p_input_item = input_ItemNewWithType( VLC_OBJECT( p_playlist ),
+                                psz_uri, psz_name, 0, NULL, -1,
+                                ITEM_TYPE_DISC );
+            vlc_input_item_AddOption( p_input_item, psz_opt );
 #ifdef HAVE_LIBCDDB
             /* If we have CDDB info, change the name */
             if( p_sys->p_disc )
@@ -628,28 +627,27 @@ static int GetTracks( access_t *p_access, vlc_bool_t b_separate,
                 {
                     if( cddb_track_get_title( t )  != NULL )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input_item,
                                             _(VLC_META_INFO_CAT),
                                             _(VLC_META_TITLE),
                                             cddb_track_get_title( t ) );
-                        if( p_item->input.psz_name )
-                            free( p_item->input.psz_name );
-                        asprintf( &p_item->input.psz_name, "%s",
+                        if( p_input_item->psz_name )
+                            free( p_input_item->psz_name );
+                        asprintf( &p_input_item->psz_name, "%s",
                                   cddb_track_get_title( t ) );
                     }
                     psz_result = cddb_track_get_artist( t );
                     if( psz_result )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input_item,
                                             _(VLC_META_INFO_CAT),
                                             _(VLC_META_ARTIST), psz_result );
                     }
                 }
             }
 #endif
-            playlist_NodeAddItem( p_playlist, p_item,
-                                  p_parent->pp_parents[0]->i_view,
-                                  p_parent, PLAYLIST_APPEND, PLAYLIST_END );
+            playlist_BothAddInput( p_playlist, p_input_item, p_parent,
+                                   PLAYLIST_APPEND, PLAYLIST_END );
             free( psz_uri ); free( psz_opt ); free( psz_name );
         }
     }
index a890350..227f76c 100644 (file)
@@ -40,7 +40,7 @@
 #if LIBCDIO_VERSION_NUM >= 72
 static char *psz_paranoia_list[] = { "none", "overlap", "full" };
 static char *psz_paranoia_list_text[] = { N_("none"), N_("overlap"),
-                                         N_("full") };
+                                          N_("full") };
 #endif
 
 #define DEBUG_LONGTEXT N_( \
index 5d27320..4ebb1a0 100644 (file)
@@ -124,7 +124,7 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args );
 
 
 static int ReadDir( playlist_t *, const char *psz_name, int i_mode,
-                    playlist_item_t * );
+                    playlist_item_t *, playlist_item_t * );
 
 /*****************************************************************************
  * Open: open the directory
@@ -198,9 +198,9 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
 {
     char *psz_name = NULL;
     char *psz;
-    int  i_mode, i_pos;
+    int  i_mode, i_activity;
 
-    playlist_item_t *p_item;
+    playlist_item_t *p_item, *p_root_category;
     vlc_bool_t b_play = VLC_FALSE;
 
     playlist_t *p_playlist =
@@ -212,54 +212,41 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
         msg_Err( p_access, "can't find playlist" );
         goto end;
     }
-    else
-    {
-        char *ptr;
 
-        psz_name = ToLocale( p_access->psz_path );
-        ptr = strdup( psz_name );
-        LocaleFree( psz_name );
-        if( ptr == NULL )
-            goto end;
+    char *ptr;
+    psz_name = ToLocale( p_access->psz_path );
+    ptr = strdup( psz_name );
+    LocaleFree( psz_name );
+    if( ptr == NULL )
+        goto end;
 
-        psz_name = ptr;
+    psz_name = ptr;
 
-        /* Remove the ending '/' char */
-        ptr += strlen( ptr );
-        if( ( ptr > psz_name ) )
+    /* Remove the ending '/' char */
+    ptr += strlen( ptr );
+    if( ( ptr > psz_name ) )
+    {
+        switch( *--ptr )
         {
-            switch( *--ptr )
-            {
-                case '/':
-                case '\\':
-                    *ptr = '\0';
-            }
+            case '/':
+            case '\\':
+                *ptr = '\0';
         }
     }
 
-    /* Initialize structure */
+    /* Handle mode */
     psz = var_CreateGetString( p_access, "recursive" );
     if( *psz == '\0' || !strncmp( psz, "none" , 4 )  )
-    {
         i_mode = MODE_NONE;
-    }
     else if( !strncmp( psz, "collapse", 8 )  )
-    {
         i_mode = MODE_COLLAPSE;
-    }
     else
-    {
         i_mode = MODE_EXPAND;
-    }
     free( psz );
 
-    /* Make sure we are deleted when we are done */
-    /* The playlist position we will use for the add */
-    i_pos = p_playlist->i_index + 1;
-
     msg_Dbg( p_access, "opening directory `%s'", p_access->psz_path );
 
-    if( &p_playlist->status.p_item->input ==
+    if( p_playlist->status.p_item->p_input ==
         ((input_thread_t *)p_access->p_parent)->input.p_item )
     {
         p_item = p_playlist->status.p_item;
@@ -279,19 +266,29 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
         }
         b_play = VLC_FALSE;
     }
+    p_item->p_input->i_type = ITEM_TYPE_DIRECTORY;
 
-    p_item->input.i_type = ITEM_TYPE_DIRECTORY;
-    if( ReadDir( p_playlist, psz_name , i_mode, p_item ) != VLC_SUCCESS )
-    {
-    }
+    p_root_category = playlist_LockItemToNode( p_playlist, p_item );
+
+    i_activity = var_GetInteger( p_playlist, "activity" );
+    var_SetInteger( p_playlist, "activity", i_activity +
+                    DIRECTORY_ACTIVITY );
+
+    ReadDir( p_playlist, psz_name , i_mode, p_item, p_root_category );
+
+    i_activity = var_GetInteger( p_playlist, "activity" );
+    var_SetInteger( p_playlist, "activity", i_activity -
+                    DIRECTORY_ACTIVITY );
 end:
 
     /* Begin to read the directory */
     if( b_play )
     {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                          p_playlist->status.i_view,
+#if 0
+       /// \bug we can start playing an already deleted item. Fix ?*/
+       playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242,
                           p_playlist->status.p_item, NULL );
+#endif
     }
     if( psz_name ) free( psz_name );
     vlc_object_release( p_playlist );
@@ -387,7 +384,8 @@ static int Filter( const struct dirent *foo )
  * ReadDir: read a directory and add its content to the list
  *****************************************************************************/
 static int ReadDir( playlist_t *p_playlist, const char *psz_name,
-                    int i_mode, playlist_item_t *p_parent )
+                    int i_mode, playlist_item_t *p_parent,
+                    playlist_item_t *p_parent_category )
 {
     struct dirent   **pp_dir_content;
     int             i_dir_content, i;
@@ -424,12 +422,6 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
         }
     }
 
-    /* Change the item to a node */
-    if( p_parent->i_children == -1 )
-    {
-        playlist_LockItemToNode( p_playlist,p_parent );
-    }
-
     /* get the first directory entry */
     i_dir_content = scandir( psz_name, &pp_dir_content, Filter, alphasort );
     if( i_dir_content == -1 )
@@ -498,16 +490,22 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
                                                 p_playlist, psz_tmp );
                     LocaleFree( psz_tmp );
 
-                    p_node = playlist_NodeCreate( p_playlist,
-                                       p_parent->pp_parents[0]->i_view,
-                                       psz_newname, p_parent );
-
-                    playlist_CopyParents(  p_parent, p_node );
-
-                    p_node->input.i_type = ITEM_TYPE_DIRECTORY;
+                    if( p_parent_category )
+                    {
+                        p_node = playlist_NodeCreate( p_playlist, psz_newname,
+                                                      p_parent_category );
+                    }
+                    else
+                    {
+                        p_node = playlist_NodeCreate( p_playlist, psz_newname,
+                                                      p_parent_category );
+                    }
 
+                    /* If we had the parent in category, the it is now node.
+                     * Else, we still don't have  */
                     if( ReadDir( p_playlist, psz_uri , MODE_EXPAND,
-                                 p_node ) != VLC_SUCCESS )
+                                 p_node, p_parent_category ? p_node : NULL )
+                          != VLC_SUCCESS )
                     {
                         return VLC_EGENERIC;
                     }
@@ -518,7 +516,7 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
             }
             else
             {
-                playlist_item_t *p_item;
+                input_item_t *p_input;
                 char *psz_tmp1, *psz_tmp2, *psz_loc;
 
                 if( i_extensions > 0 )
@@ -551,15 +549,13 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
                                                     psz_loc );
                 LocaleFree( psz_loc );
 
-                p_item = playlist_ItemNewWithType( VLC_OBJECT(p_playlist),
-                        psz_tmp1, psz_tmp2, ITEM_TYPE_VFILE );
-                playlist_NodeAddItem( p_playlist,p_item,
-                                      p_parent->pp_parents[0]->i_view,
-                                      p_parent,
-                                      PLAYLIST_APPEND | PLAYLIST_PREPARSE,
-                                      PLAYLIST_END );
+                p_input = input_ItemNewWithType( VLC_OBJECT(p_playlist),
+                                                 psz_tmp1, psz_tmp2, 0, NULL,
+                                                 -1, ITEM_TYPE_VFILE );
 
-                playlist_CopyParents( p_parent, p_item );
+                playlist_AddWhereverNeeded( p_playlist, p_input, p_parent,
+                                            p_parent_category, VLC_FALSE,
+                                            PLAYLIST_APPEND|PLAYLIST_PREPARSE);
             }
         }
         free( psz_uri );
index 387b327..f362e3e 100644 (file)
@@ -543,10 +543,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             dvdnav_get_title_string(p_sys->dvdnav, &title_name);
             if( (NULL != title_name) && ('\0' != title_name[0]) )
             {
-                vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-                vlc_meta_t *meta;
-                *pp_meta = meta = vlc_meta_New();
-                vlc_meta_Add( meta, VLC_META_TITLE, title_name );
+                vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
+                vlc_meta_SetTitle( p_meta, title_name );
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
index 2905d59..2bc6052 100644 (file)
@@ -337,9 +337,9 @@ connect:
             goto error;
         }
 
-        /* Change the uri */
+        /* Change the URI */
         vlc_mutex_lock( &p_playlist->object_lock );
-        p_input_item = &p_playlist->status.p_item->input;
+        p_input_item = p_playlist->status.p_item->p_input;
         vlc_mutex_lock( &p_input_item->lock );
         free( p_input_item->psz_uri );
         free( p_access->psz_path );
@@ -696,7 +696,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
     vlc_bool_t   *pb_bool;
     int          *pi_int;
     int64_t      *pi_64;
-    vlc_meta_t **pp_meta;
+    vlc_meta_t   *p_meta;
 
     switch( i_query )
     {
@@ -736,18 +736,14 @@ static int Control( access_t *p_access, int i_query, va_list args )
             break;
 
         case ACCESS_GET_META:
-            pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-            *pp_meta = vlc_meta_New();
+            p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
 
             if( p_sys->psz_icy_name )
-                vlc_meta_Add( *pp_meta, VLC_META_TITLE,
-                              p_sys->psz_icy_name );
+                vlc_meta_SetTitle( p_meta, p_sys->psz_icy_name );
             if( p_sys->psz_icy_genre )
-                vlc_meta_Add( *pp_meta, VLC_META_GENRE,
-                              p_sys->psz_icy_genre );
+                vlc_meta_SetGenre( p_meta, p_sys->psz_icy_genre );
             if( p_sys->psz_icy_title )
-                vlc_meta_Add( *pp_meta, VLC_META_NOW_PLAYING,
-                              p_sys->psz_icy_title );
+                vlc_meta_SetNowPlaying( p_meta, p_sys->psz_icy_title );
             break;
 
         case ACCESS_GET_TITLE_INFO:
index 4d32bd1..6786972 100644 (file)
@@ -118,10 +118,9 @@ int E_(MMSHOpen)( access_t *p_access )
             free( psz_location );
             return VLC_EGENERIC;
         }
-        p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
-        playlist_Add( p_playlist, psz_location, psz_location,
-                      PLAYLIST_INSERT | PLAYLIST_GO,
-                      p_playlist->i_index + 1 );
+        /** \bug we do not autodelete here */
+        playlist_PlaylistAdd( p_playlist, psz_location, psz_location,
+                              PLAYLIST_INSERT | PLAYLIST_GO, PLAYLIST_END );
         vlc_object_release( p_playlist );
 
         free( psz_location );
index b8a71fd..7c633b5 100644 (file)
@@ -13,7 +13,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -192,7 +192,7 @@ static void RunIntf( intf_thread_t *p_intf )
     /* Main loop */
     while( !p_intf->b_die )
     {
-        
+
         /* find a video output if we currently don't have one */
         if( p_vout == NULL )
         {
@@ -412,7 +412,7 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
     vlc_mutex_lock( &p_intf->change_lock );
 
     p_intf->p_sys->b_key_pressed = VLC_TRUE;
-    
+
     vlc_mutex_unlock( &p_intf->change_lock );
 
     return VLC_SUCCESS;
@@ -451,7 +451,7 @@ static void FollowAnchor ( intf_thread_t *p_intf )
         mtime_t i_seconds;
         vlc_value_t time;
 
-        p_playlist = (playlist_t *) vlc_object_find( p_intf, 
+        p_playlist = (playlist_t *) vlc_object_find( p_intf,
                 VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
         if ( !p_playlist )
         {
@@ -460,13 +460,13 @@ static void FollowAnchor ( intf_thread_t *p_intf )
         }
 
         /* Get new URL */
-        p_current_item = p_playlist->pp_items[p_playlist->i_index];
+        p_current_item = p_playlist->status.p_item;
 #ifdef CMML_INTF_DEBUG
         msg_Dbg( p_intf, "Current playlist item URL is \"%s\"",
                 p_current_item->input.psz_uri );
 #endif
 
-        psz_uri_to_load = XURL_Concat( p_current_item->input.psz_uri,
+        psz_uri_to_load = XURL_Concat( p_current_item->p_input->psz_uri,
                                        psz_url );
 
 #ifdef CMML_INTF_DEBUG
@@ -550,7 +550,7 @@ char *GetTimedURLFromPlaylistItem( intf_thread_t *p_intf,
     char *psz_return_value = NULL;
     char *psz_seconds = NULL;
     int i_seconds;
-    
+
     psz_url = XURL_GetWithoutFragment( p_current_item->input->psz_uri );
 
     /* Get current time as a string */
@@ -577,7 +577,7 @@ char *GetTimedURLFromPlaylistItem( intf_thread_t *p_intf,
     p = GetTimedURIFragmentForTime; /* unused */
     p = GetCurrentTimeInSeconds;    /* unused */
 
-    return strdup( p_current_item->input.psz_uri );
+    return strdup( p_current_item->p_input->psz_uri );
 #endif
 }
 
@@ -653,7 +653,7 @@ void GoBack( intf_thread_t *p_intf )
 #endif
 
     /* Find the playlist */
-    p_playlist = (playlist_t *) vlc_object_find( p_intf, 
+    p_playlist = (playlist_t *) vlc_object_find( p_intf,
             VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if ( !p_playlist )
     {
@@ -686,7 +686,7 @@ void GoBack( intf_thread_t *p_intf )
         return;
     }
 
-    p_current_item = p_playlist->pp_items[p_playlist->i_index];
+    p_current_item = p_playlist->status.p_item;
 
     /* Save the currently-playing media in a new history item */
     psz_timed_url = GetTimedURLFromPlaylistItem( p_intf, p_current_item );
@@ -731,7 +731,7 @@ void GoForward( intf_thread_t *p_intf )
 #endif
 
     /* Find the playlist */
-    p_playlist = (playlist_t *) vlc_object_find( p_intf, 
+    p_playlist = (playlist_t *) vlc_object_find( p_intf,
             VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if ( !p_playlist )
     {
@@ -774,8 +774,8 @@ void GoForward( intf_thread_t *p_intf )
         vlc_object_release( p_playlist );
         return;
     }
-    p_current_item = p_playlist->pp_items[p_playlist->i_index];
-    p_new_history_item->psz_uri = GetTimedURLFromPlaylistItem( p_intf, 
+    p_current_item = p_playlist->status.p_item;
+    p_new_history_item->psz_uri = GetTimedURLFromPlaylistItem( p_intf,
             p_current_item );
     p_new_history_item->psz_name = p_new_history_item->psz_uri;
 
@@ -796,9 +796,8 @@ void GoForward( intf_thread_t *p_intf )
 static void ReplacePlaylistItem( playlist_t *p_playlist, char *psz_uri )
 {
     playlist_Stop( p_playlist );
-    (void) playlist_Add( p_playlist, psz_uri, psz_uri,
-                         PLAYLIST_REPLACE, p_playlist->i_index );
-    playlist_Goto( p_playlist, p_playlist->i_index );
+    (void) playlist_PlaylistAdd( p_playlist, psz_uri, psz_uri,
+                         PLAYLIST_INSERT /* FIXME: used to be PLAYLIST_REPLACE */, PLAYLIST_END|PLAYLIST_GO /* FIXME: p_playlist->status.i_index */ );
 }
 
 /****************************************************************************
index faee64c..9b1c321 100644 (file)
@@ -900,7 +900,7 @@ static int ActionKeyCB( vlc_object_t *p_this, char const *psz_var,
 static void PlayBookmark( intf_thread_t *p_intf, int i_num )
 {
     vlc_value_t val;
-    int i_position;
+    int i;
     char psz_bookmark_name[11];
     playlist_t *p_playlist =
         vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
@@ -912,12 +912,13 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
     if( p_playlist )
     {
         char *psz_bookmark = strdup( val.psz_string );
-        for( i_position = 0; i_position < p_playlist->i_size; i_position++)
+        for( i = 0; i < p_playlist->pp_all_items; i++)
         {
             if( !strcmp( psz_bookmark,
-                         p_playlist->pp_items[i_position]->input.psz_uri ) )
+                         p_playlist->pp_items[i]->p_input->psz_uri ) )
             {
-                playlist_Goto( p_playlist, i_position );
+                playlist_LockControl( p_playlist, PLAYLIST_ITEMPLAY,
+                                      p_playlist->pp_items[i] );
                 break;
             }
         }
@@ -938,9 +939,9 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
         if( p_playlist->status.p_item )
         {
             config_PutPsz( p_intf, psz_bookmark_name,
-                           p_playlist->status.p_item->input.psz_uri);
+                           p_playlist->status.p_item->p_input->psz_uri);
             msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num,
-                           p_playlist->status.p_item->input.psz_uri);
+                           p_playlist->status.p_item->p_input->psz_uri);
             config_SaveConfigFile( p_intf, "hotkeys" );
         }
         vlc_object_release( p_playlist );
index b08f558..4d274c7 100644 (file)
@@ -130,7 +130,7 @@ char *E_(ExtractURIValue)( char *psz_uri, const char *psz_name,
 int E_(TestURIParam)( char *psz_uri, const char *psz_name );
 
 /** This function parses a MRL */
-playlist_item_t *E_(MRLParse)( intf_thread_t *, char *psz, char *psz_name );
+input_item_t *E_(MRLParse)( intf_thread_t *, char *psz, char *psz_name );
 
 /** Return the first word from a string (works in-place) */
 char *E_(FirstWord)( char *psz, char *new );
index 60c5454..34795bb 100644 (file)
@@ -303,7 +303,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                 {
                     char mrl[1024], psz_name[1024], tmp[1024];
                     char *p, *str;
-                    playlist_item_t *p_item;
+                    input_item_t *p_input;
 
                     E_(ExtractURIValue)( p_request, "mrl", tmp, 1024 );
                     decode_URI( tmp );
@@ -327,16 +327,16 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                     }
                     *p = '\0';
 
-                    p_item = E_(MRLParse)( p_intf, mrl, psz_name );
+                    p_input = E_(MRLParse)( p_intf, mrl, psz_name );
 
-                    if( !p_item || !p_item->input.psz_uri ||
-                        !*p_item->input.psz_uri )
+                    if( !p_input || p_input->psz_uri ||
+                        !*p_input->psz_uri )
                     {
                         msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
                     }
                     else
                     {
-                        playlist_AddItem( p_sys->p_playlist, p_item,
+                        playlist_PlaylistAddInput( p_sys->p_playlist, p_input,
                                           PLAYLIST_APPEND, PLAYLIST_END );
                         msg_Dbg( p_intf, "requested mrl add: %s", mrl );
                     }
@@ -401,11 +401,13 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                         for( j = 0 ; j < i_nb_items ; j++ )
                         {
                             if( p_items[j] ==
-                                p_sys->p_playlist->pp_items[i]->input.i_id ) break;
+                                p_sys->p_playlist->pp_items[i]->p_input->i_id )
+                                break;
                         }
                         if( j == i_nb_items )
                         {
-                            playlist_LockDelete( p_sys->p_playlist, p_sys->p_playlist->pp_items[i]->input.i_id );
+                            playlist_LockDelete( p_sys->p_playlist,
+                            p_sys->p_playlist->pp_items[i]->p_input->i_id );
                             msg_Dbg( p_intf, "requested playlist delete: %d",
                                      i );
                         }
@@ -439,7 +441,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                     if( !strcmp( type , "title" ) )
                     {
                         playlist_RecursiveNodeSort( p_sys->p_playlist, /*playlist_ItemGetById( p_sys->p_playlist, i_item ),*/
-                                                    p_sys->p_playlist->pp_views[0]->p_root,
+                                                    /* Ugly hack,but not worse than before ... */
+                                                    p_sys->p_playlist->p_root_onelevel,
                                                     SORT_TITLE_NODES_FIRST,
                                                     ( i_order == 0 ) ? ORDER_NORMAL : ORDER_REVERSE );
                         msg_Dbg( p_intf, "requested playlist sort by title (%d)" , i_order );
@@ -447,7 +450,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                     else if( !strcmp( type , "author" ) )
                     {
                         playlist_RecursiveNodeSort( p_sys->p_playlist, /*playlist_ItemGetById( p_sys->p_playlist, i_item ),*/
-                                                    p_sys->p_playlist->pp_views[0]->p_root,
+                                                    p_sys->p_playlist->p_root_onelevel,
                                                     SORT_AUTHOR,
                                                     ( i_order == 0 ) ? ORDER_NORMAL : ORDER_REVERSE );
                         msg_Dbg( p_intf, "requested playlist sort by author (%d)" , i_order );
@@ -455,7 +458,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                     else if( !strcmp( type , "shuffle" ) )
                     {
                         playlist_RecursiveNodeSort( p_sys->p_playlist, /*playlist_ItemGetById( p_sys->p_playlist, i_item ),*/
-                                                    p_sys->p_playlist->pp_views[0]->p_root,
+                                                    p_sys->p_playlist->p_root_onelevel,
                                                     SORT_RANDOM,
                                                     ( i_order == 0 ) ? ORDER_NORMAL : ORDER_REVERSE );
                         msg_Dbg( p_intf, "requested playlist shuffle");
@@ -473,6 +476,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                     E_(ExtractURIValue)( p_request, "psz_newpos", psz_newpos, 6 );
                     i_pos = atoi( psz_pos );
                     i_newpos = atoi( psz_newpos );
+                    /* FIXME FIXME TODO TODO XXX XXX
+                    ( duplicate from rpn.c )
                     if ( i_pos < i_newpos )
                     {
                         playlist_Move( p_sys->p_playlist, i_pos, i_newpos + 1 );
@@ -482,6 +487,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                         playlist_Move( p_sys->p_playlist, i_pos, i_newpos );
                     }
                     msg_Dbg( p_intf, "requested move playlist item %d to %d", i_pos, i_newpos);
+                    FIXME FIXME TODO TODO XXX XXX */
                     break;
                 }
 
index e3d262b..bbad22d 100644 (file)
@@ -279,19 +279,10 @@ mvar_t *E_(mvar_IntegerSetNew)( const char *name, const char *arg )
 mvar_t *E_(mvar_PlaylistSetNew)( intf_thread_t *p_intf, char *name,
                                  playlist_t *p_pl )
 {
-    playlist_view_t *p_view;
     mvar_t *s = E_(mvar_New)( name, "set" );
-
-
     vlc_mutex_lock( &p_pl->object_lock );
-
-    p_view = playlist_ViewFind( p_pl, VIEW_CATEGORY ); /* FIXME */
-
-    if( p_view != NULL )
-        E_(PlaylistListNode)( p_intf, p_pl, p_view->p_root, name, s, 0 );
-
+    E_(PlaylistListNode)( p_intf, p_pl, p_pl->p_root_category , name, s, 0 );
     vlc_mutex_unlock( &p_pl->object_lock );
-
     return s;
 }
 
index 09b072f..14c1516 100644 (file)
@@ -830,7 +830,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
             char *psz_name = E_(SSPop)( st );
             char *mrl = E_(SSPop)( st );
             char *tmp;
-            playlist_item_t *p_item;
+            input_item_t *p_input;
             int i_id;
 
             tmp = E_(ToUTF8)( p_intf, psz_name );
@@ -842,22 +842,21 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
 
             if( !*psz_name )
             {
-                p_item = E_(MRLParse)( p_intf, mrl, mrl );
+                p_input = E_(MRLParse)( p_intf, mrl, mrl );
             }
             else
             {
-                p_item = E_(MRLParse)( p_intf, mrl, psz_name );
+                p_input = E_(MRLParse)( p_intf, mrl, psz_name );
             }
 
-            if( p_item == NULL || p_item->input.psz_uri == NULL ||
-                 !*p_item->input.psz_uri )
+            if( !p_input || !p_input->psz_uri || !*p_input->psz_uri )
             {
                 i_id = VLC_EGENERIC;
                 msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
             }
             else
             {
-                i_id = playlist_AddItem( p_sys->p_playlist, p_item,
+                i_id = playlist_PlaylistAddInput( p_sys->p_playlist, p_input,
                                          PLAYLIST_APPEND, PLAYLIST_END );
                 msg_Dbg( p_intf, "requested mrl add: %s", mrl );
             }
@@ -879,8 +878,10 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
         }
         else if( !strcmp( s, "playlist_move" ) )
         {
-            int i_newpos = E_(SSPopN)( st, vars );
-            int i_pos = E_(SSPopN)( st, vars );
+            /*int i_newpos =*/ E_(SSPopN)( st, vars );
+            /*int i_pos =*/ E_(SSPopN)( st, vars );
+            /* FIXME FIXME TODO TODO XXX XXX
+            do not release before fixing this
             if ( i_pos < i_newpos )
             {
                 playlist_Move( p_sys->p_playlist, i_pos, i_newpos + 1 );
@@ -891,6 +892,8 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
             }
             msg_Dbg( p_intf, "requested to move playlist item %d to %d",
                      i_pos, i_newpos);
+               FIXME FIXME TODO TODO XXX XXX */
+            msg_Err( p_intf, "moving using indexes is obsolete. We need to update this function" );
         }
         else if( !strcmp( s, "playlist_sort" ) )
         {
@@ -898,11 +901,15 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
             int i_sort = E_(SSPopN)( st, vars );
             i_order = i_order % 2;
             i_sort = i_sort % 9;
+            /* FIXME FIXME TODO TODO XXX XXX
+            do not release before fixing this
             playlist_RecursiveNodeSort(  p_sys->p_playlist,
                                          p_sys->p_playlist->p_general,
                                          i_sort, i_order );
             msg_Dbg( p_intf, "requested sort playlist by : %d in order : %d",
                      i_sort, i_order );
+               FIXME FIXME TODO TODO XXX XXX */
+            msg_Err( p_intf, "this needs to be fixed to use the new playlist framework" );
         }
         else if( !strcmp( s, "services_discovery_add" ) )
         {
index ae29a2c..6f2a32f 100644 (file)
@@ -428,14 +428,14 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
             sprintf( value, "%d", ( p_pl->status.p_item == p_node )? 1 : 0 );
             E_(mvar_AppendNewVar)( itm, "current", value );
 
-            sprintf( value, "%d", p_node->input.i_id );
+            sprintf( value, "%d", p_node->p_input->i_id );
             E_(mvar_AppendNewVar)( itm, "index", value );
 
-            psz = E_(FromUTF8)( p_intf, p_node->input.psz_name );
+            psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_name );
             E_(mvar_AppendNewVar)( itm, "name", psz );
             free( psz );
 
-            psz = E_(FromUTF8)( p_intf, p_node->input.psz_uri );
+            psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_uri );
             E_(mvar_AppendNewVar)( itm, "uri", psz );
             free( psz );
 
@@ -454,7 +454,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
                 E_(mvar_AppendNewVar)( itm, "ro", "rw" );
             }
 
-            sprintf( value, "%ld", (long)p_node->input.i_duration );
+            sprintf( value, "%ld", (long)p_node->p_input->i_duration );
             E_(mvar_AppendNewVar)( itm, "duration", value );
 
             E_(mvar_AppendVar)( s, itm );
@@ -466,7 +466,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
             int i_child;
             mvar_t *itm = E_(mvar_New)( name, "set" );
 
-            psz = E_(FromUTF8)( p_intf, p_node->input.psz_name );
+            psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_name );
             E_(mvar_AppendNewVar)( itm, "name", psz );
             E_(mvar_AppendNewVar)( itm, "uri", psz );
             free( psz );
@@ -474,7 +474,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
             sprintf( value, "Node" );
             E_(mvar_AppendNewVar)( itm, "type", value );
 
-            sprintf( value, "%d", p_node->input.i_id );
+            sprintf( value, "%d", p_node->p_input->i_id );
             E_(mvar_AppendNewVar)( itm, "index", value );
 
             sprintf( value, "%d", p_node->i_children);
@@ -864,13 +864,13 @@ static char *FirstOption( char *psz, char *new )
         return NULL;
 }
 
-playlist_item_t *E_(MRLParse)( intf_thread_t *p_intf, char *_psz,
-                               char *psz_name )
+input_item_t *E_(MRLParse)( intf_thread_t *p_intf, char *_psz,
+                                   char *psz_name )
 {
     char *psz = strdup( _psz );
     char *s_mrl = psz;
     char *s_temp;
-    playlist_item_t * p_item = NULL;
+    input_item_t * p_input = NULL;
 
     /* extract the mrl */
     s_temp = FirstOption( s_mrl, s_mrl );
@@ -879,7 +879,7 @@ playlist_item_t *E_(MRLParse)( intf_thread_t *p_intf, char *_psz,
         s_temp = s_mrl + strlen( s_mrl );
     }
 
-    p_item = playlist_ItemNew( p_intf, s_mrl, psz_name );
+    p_input = input_ItemNew( p_intf, s_mrl, psz_name );
     s_mrl = s_temp;
 
     /* now we can take care of the options */
@@ -892,13 +892,12 @@ playlist_item_t *E_(MRLParse)( intf_thread_t *p_intf, char *_psz,
         {
             s_temp = s_mrl + strlen( s_mrl );
         }
-        playlist_ItemAddOption( p_item, s_mrl );
+        vlc_input_item_AddOption( p_input, s_mrl );
         s_mrl = s_temp;
     }
 
     free( psz );
-
-    return p_item;
+    return p_input;
 }
 
 /**********************************************************************
index 05c104b..897b8e2 100644 (file)
@@ -201,7 +201,6 @@ vlc_module_end();
 static int Activate( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
-    playlist_t *p_playlist;
     char *psz_host, *psz_unix_path;
     int  *pi_socket = NULL;
 
@@ -321,17 +320,6 @@ static int Activate( vlc_object_t *p_this )
     CONSOLE_INTRO_MSG;
 #endif
 
-    /* Force "no-view" mode */
-    p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                 FIND_ANYWHERE );
-    if( p_playlist )
-    {
-        vlc_mutex_lock( &p_playlist->object_lock );
-        p_playlist->status.i_view = -1;
-        vlc_mutex_unlock( &p_playlist->object_lock );
-        vlc_object_release( p_playlist );
-    }
-
     msg_rc( _("Remote control interface initialized. Type `help' for help.") );
     return VLC_SUCCESS;
 }
@@ -1234,6 +1222,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
                                            FIND_ANYWHERE );
     if( !p_playlist )
     {
+        msg_Err( p_this, "no playlist" );
         return VLC_ENOOBJ;
     }
 
@@ -1241,7 +1230,8 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     {
         vlc_value_t val;
         var_Get( p_playlist->p_input, "state", &val );
-        if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )        {
+        if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+        {
             msg_rc( _("Type 'menu select' or 'pause' to continue.") );
             vlc_object_release( p_playlist );
             return VLC_EGENERIC;
@@ -1259,29 +1249,12 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     }
     else if( !strcmp( psz_cmd, "play" ) )
     {
-        if( p_playlist->p_input )
-        {
-            vlc_value_t val;
-
-            var_Get( p_playlist->p_input, "rate", &val );
-            if( val.i_int != INPUT_RATE_DEFAULT )
-            {
-                val.i_int = INPUT_RATE_DEFAULT;
-                var_Set( p_playlist->p_input, "rate", val );
-            }
-            else
-            {
-                playlist_Play( p_playlist );
-            }
-        }
+        msg_Warn( p_playlist, "play" );
+        playlist_Play( p_playlist );
     }
     else if (!strcmp( psz_cmd, "goto" ) )
     {
-        if( strlen( newval.psz_string ) > 0)
-        {
-            val.i_int = atoi( newval.psz_string );
-            playlist_Goto( p_playlist, val.i_int);
-        }
+        msg_Err( p_playlist, "goto is deprecated" );
     }
     else if( !strcmp( psz_cmd, "stop" ) )
     {
@@ -1302,26 +1275,16 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "Trying to add %s to playlist.", newval.psz_string );
-            playlist_AddItem( p_playlist, p_item,
-                              PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
+//            playlist_AddItem( p_playlist, p_item,
+//                              PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
         }
     }
     else if( !strcmp( psz_cmd, "playlist" ) )
     {
         int i;
-
-        for ( i = 0; i < p_playlist->i_size; i++ )
-        {
-            msg_rc( "|%s%s   %s|%s|", i == p_playlist->i_index ? "*" : " ",
-                    p_playlist->pp_items[i]->input.psz_name,
-                    p_playlist->pp_items[i]->input.psz_uri,
-                    p_playlist->pp_items[i]->i_parents > 0 ?
-                    p_playlist->pp_items[i]->pp_parents[0]->p_parent->input.psz_name : "" );
-        }
-        if ( i == 0 )
-        {
-            msg_rc( "| no entries" );
-        }
+        playlist_view_t *p_view;
+        playlist_NodeDump( p_playlist, p_playlist->p_root_category, 0 );
+        playlist_NodeDump( p_playlist, p_playlist->p_root_onelevel, 0 );
     }
     else if( !strcmp( psz_cmd, "status" ) )
     {
index c315a04..79c00d9 100644 (file)
@@ -219,7 +219,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     demux_sys_t *p_sys = p_demux->p_sys;
     int64_t     *pi64;
     int         i;
-    vlc_meta_t **pp_meta;
+    vlc_meta_t *p_meta;
 
     switch( i_query )
     {
@@ -232,8 +232,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_GET_META:
-            pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-            *pp_meta = vlc_meta_Duplicate( p_sys->meta );
+            p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
+            vlc_meta_Merge( p_meta, p_sys->meta );
             return VLC_SUCCESS;
 
         case DEMUX_SET_POSITION:
@@ -812,25 +812,27 @@ static int DemuxInit( demux_t *p_demux )
     {
         if( p_cd->psz_title && *p_cd->psz_title )
         {
-            vlc_meta_Add( p_sys->meta, VLC_META_TITLE, p_cd->psz_title );
+            vlc_meta_SetTitle( p_sys->meta, p_cd->psz_title );
         }
         if( p_cd->psz_author && *p_cd->psz_author )
         {
-             vlc_meta_Add( p_sys->meta, VLC_META_AUTHOR, p_cd->psz_author );
+             vlc_meta_SetAuthor( p_sys->meta, p_cd->psz_author );
         }
         if( p_cd->psz_copyright && *p_cd->psz_copyright )
         {
-            vlc_meta_Add( p_sys->meta, VLC_META_COPYRIGHT, p_cd->psz_copyright );
+            vlc_meta_SetCopyright( p_sys->meta, p_cd->psz_copyright );
         }
         if( p_cd->psz_description && *p_cd->psz_description )
         {
-            vlc_meta_Add( p_sys->meta, VLC_META_DESCRIPTION, p_cd->psz_description );
+            vlc_meta_SetDescription( p_sys->meta, p_cd->psz_description );
         }
         if( p_cd->psz_rating && *p_cd->psz_rating )
         {
-            vlc_meta_Add( p_sys->meta, VLC_META_RATING, p_cd->psz_rating );
+            vlc_meta_SetRating( p_sys->meta, p_cd->psz_rating );
         }
     }
+    fprintf( stderr, "*********** Unhandled child meta\n" );
+#if 0
     for( i_stream = 0, i = 0; i < 128; i++ )
     {
         asf_object_codec_list_t *p_cl = ASF_FindObject( p_sys->p_root->p_hdr,
@@ -859,6 +861,7 @@ static int DemuxInit( demux_t *p_demux )
             i_stream++;
         }
     }
+#endif
 
     es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
     return VLC_SUCCESS;
index 98088fb..73040ea 100644 (file)
@@ -327,7 +327,7 @@ static int Open( vlc_object_t * p_this )
                  p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
                  p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
                  p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
-        vlc_meta_Add( p_sys->meta, VLC_META_SETTING, buffer );
+        vlc_meta_SetSetting( p_sys->meta, buffer );
     }
 
     /* now read info on each stream and create ES */
@@ -1308,7 +1308,7 @@ static int    Control( demux_t *p_demux, int i_query, va_list args )
     int i;
     double   f, *pf;
     int64_t i64, *pi64;
-    vlc_meta_t **pp_meta;
+    vlc_meta_t *p_meta;
 
     switch( i_query )
     {
@@ -1369,8 +1369,8 @@ static int    Control( demux_t *p_demux, int i_query, va_list args )
             }
             return VLC_SUCCESS;
         case DEMUX_GET_META:
-            pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-            *pp_meta = vlc_meta_Duplicate( p_sys->meta );
+            p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
+            vlc_meta_Merge( p_meta,  p_sys->meta );
             return VLC_SUCCESS;
 
         default:
index c007694..64f302f 100644 (file)
@@ -91,7 +91,7 @@ static int Open( vlc_object_t * p_this )
     p_demux->p_sys      = p_sys = malloc( sizeof( demux_sys_t ) );
     es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'f', 'l', 'a', 'c' ) );
     p_sys->b_start = VLC_TRUE;
-    p_sys->p_meta = 0;
+    p_sys->p_meta = NULL;
 
     /* We need to read and store the STREAMINFO metadata */
     i_peek = stream_Peek( p_demux->s, &p_peek, 8 );
@@ -231,10 +231,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     if( i_query == DEMUX_SET_TIME ) return VLC_EGENERIC;
     else if( i_query == DEMUX_GET_META )
     {
-        vlc_meta_t **pp_meta = (vlc_meta_t **)va_arg( args, vlc_meta_t** );
+        vlc_meta_t *p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* );
         if( p_demux->p_sys->p_meta )
-            *pp_meta = vlc_meta_Duplicate( p_demux->p_sys->p_meta );
-        else *pp_meta = NULL;
+            vlc_meta_Merge( p_meta, p_demux->p_sys->p_meta );
         return VLC_SUCCESS;
     }
     else return demux2_vaControlHelper( p_demux->s, 0, -1,
index 161136a..a608127 100644 (file)
@@ -68,10 +68,8 @@ vlc_module_begin();
     set_description( _("Playlist metademux") );
     set_capability( "demux2", 5 );
     set_callbacks( Activate, Deactivate );
-    add_shortcut( "m3u" );
     add_shortcut( "asx" );
     add_shortcut( "html" );
-    add_shortcut( "pls" );
     add_shortcut( "b4s" );
 vlc_module_end();
 
@@ -91,10 +89,7 @@ static int Activate( vlc_object_t * p_this )
     /* Check for m3u/asx file extension or if the demux has been forced */
     psz_ext = strrchr ( p_demux->psz_path, '.' );
 
-    if( ( psz_ext && !strcasecmp( psz_ext, ".m3u") ) ||
-        /* a .ram file can contain a single rtsp link */
-        ( psz_ext && !strcasecmp( psz_ext, ".ram") ) ||
-        ( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "m3u") ) )
+    if(( psz_ext && !strcasecmp( psz_ext, ".ram") ) )
     {
         i_type = TYPE_M3U;
     }
@@ -108,11 +103,6 @@ static int Activate( vlc_object_t * p_this )
     {
         i_type = TYPE_HTML;
     }
-    else if( ( psz_ext && !strcasecmp( psz_ext, ".pls") ) ||
-             ( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "pls") ) )
-    {
-        i_type = TYPE_PLS;
-    }
     else if( ( psz_ext && !strcasecmp( psz_ext, ".b4s") ) ||
              ( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "b4s") ) )
     {
index cfaebc1..a86f299 100644 (file)
@@ -1592,13 +1592,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     int         i_skp;
     size_t      i_idx;
 
-    vlc_meta_t **pp_meta;
+    vlc_meta_t *p_meta;
 
     switch( i_query )
     {
         case DEMUX_GET_META:
-            pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-            *pp_meta = vlc_meta_Duplicate( p_sys->meta );
+            p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
+            vlc_meta_Merge( p_meta, p_sys->meta );
             return VLC_SUCCESS;
 
         case DEMUX_GET_LENGTH:
@@ -4917,54 +4917,30 @@ void matroska_segment_c::InformationCreate( )
 
     if( psz_title )
     {
-        vlc_meta_Add( sys.meta, VLC_META_TITLE, psz_title );
+        vlc_meta_SetTitle( sys.meta, psz_title );
     }
     if( psz_date_utc )
     {
-        vlc_meta_Add( sys.meta, VLC_META_DATE, psz_date_utc );
+        vlc_meta_SetDate( sys.meta, psz_date_utc );
     }
     if( psz_segment_filename )
     {
-        vlc_meta_Add( sys.meta, _("Segment filename"), psz_segment_filename );
+        fprintf( stderr, "***** WARNING: Unhandled meta - Use custom\n" );
     }
     if( psz_muxing_application )
     {
-        vlc_meta_Add( sys.meta, _("Muxing application"), psz_muxing_application );
+        fprintf( stderr, "***** WARNING: Unhandled meta - Use custom\n" );
     }
     if( psz_writing_application )
     {
-        vlc_meta_Add( sys.meta, _("Writing application"), psz_writing_application );
+        fprintf( stderr, "***** WARNING: Unhandled meta - Use custom\n" );
     }
 
     for( i_track = 0; i_track < tracks.size(); i_track++ )
     {
-        mkv_track_t *tk = tracks[i_track];
-        vlc_meta_t *mtk = vlc_meta_New();
-
-        sys.meta->track = (vlc_meta_t**)realloc( sys.meta->track,
-                                                    sizeof( vlc_meta_t * ) * ( sys.meta->i_track + 1 ) );
-        sys.meta->track[sys.meta->i_track++] = mtk;
-
-        if( tk->fmt.psz_description )
-        {
-            vlc_meta_Add( sys.meta, VLC_META_DESCRIPTION, tk->fmt.psz_description );
-        }
-        if( tk->psz_codec_name )
-        {
-            vlc_meta_Add( sys.meta, VLC_META_CODEC_NAME, tk->psz_codec_name );
-        }
-        if( tk->psz_codec_settings )
-        {
-            vlc_meta_Add( sys.meta, VLC_META_SETTING, tk->psz_codec_settings );
-        }
-        if( tk->psz_codec_info_url )
-        {
-            vlc_meta_Add( sys.meta, VLC_META_CODEC_DESCRIPTION, tk->psz_codec_info_url );
-        }
-        if( tk->psz_codec_download_url )
-        {
-            vlc_meta_Add( sys.meta, VLC_META_URL, tk->psz_codec_download_url );
-        }
+//        mkv_track_t *tk = tracks[i_track];
+//        vlc_meta_t *mtk = vlc_meta_New();
+        fprintf( stderr, "***** WARNING: Unhandled child meta\n");
     }
 
     if( i_tags_position >= 0 )
index 884aad8..586bcfd 100644 (file)
@@ -387,6 +387,8 @@ static int Open( vlc_object_t * p_this )
                         !strncmp( psz_ref, "rtsp://", 7 ) )
                     {
                         msg_Dbg( p_demux, "adding ref = `%s'", psz_ref );
+                        msg_Err( p_demux, "REF is broken (fix playlist") ;
+#if 0
                         if( p_item )
                         {
                             playlist_item_t *p_child =
@@ -402,6 +404,7 @@ static int Open( vlc_object_t * p_this )
                                 b_play = VLC_TRUE;
                             }
                         }
+#endif
                     }
                     else
                     {
@@ -422,6 +425,8 @@ static int Open( vlc_object_t * p_this )
                         }
                         strcat( psz_absolute, psz_ref );
                         msg_Dbg( p_demux, "adding ref = `%s'", psz_absolute );
+                        msg_Err( p_demux, "Ref broken (fix playlist" );
+#if 0
                         if( p_item )
                         {
                             playlist_item_t *p_child =
@@ -438,6 +443,7 @@ static int Open( vlc_object_t * p_this )
                                 b_play = VLC_TRUE;
                             }
                         }
+#endif
                     }
                 }
                 else
@@ -449,7 +455,6 @@ static int Open( vlc_object_t * p_this )
             if( b_play == VLC_TRUE )
             {
                  playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                                   p_playlist->status.i_view,
                                    p_playlist->status.p_item, NULL );
             }
             vlc_object_release( p_playlist );
@@ -799,15 +804,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_META:
         {
-            vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-            vlc_meta_t *meta;
+            vlc_meta_t *p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t*);
             MP4_Box_t  *p_udta   = MP4_BoxGet( p_sys->p_root, "/moov/udta" );
             MP4_Box_t  *p_0xa9xxx;
             if( p_udta == NULL )
             {
                 return VLC_EGENERIC;
             }
-            *pp_meta = meta = vlc_meta_New();
             for( p_0xa9xxx = p_udta->p_first; p_0xa9xxx != NULL;
                  p_0xa9xxx = p_0xa9xxx->p_next )
             {
@@ -824,25 +827,25 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 switch( p_0xa9xxx->i_type )
                 {
                 case FOURCC_0xa9nam: /* Full name */
-                    vlc_meta_Add( meta, VLC_META_TITLE, psz_utf );
+                    vlc_meta_SetArtist( p_meta, psz_utf );
                     break;
                 case FOURCC_0xa9aut:
-                    vlc_meta_Add( meta, VLC_META_AUTHOR, psz_utf );
+                    vlc_meta_SetAuthor( p_meta, psz_utf );
                     break;
                 case FOURCC_0xa9ART:
-                    vlc_meta_Add( meta, VLC_META_ARTIST, psz_utf );
+                    vlc_meta_SetArtist( p_meta, psz_utf );
                     break;
                 case FOURCC_0xa9cpy:
-                    vlc_meta_Add( meta, VLC_META_COPYRIGHT, psz_utf );
+                    vlc_meta_SetCopyright( p_meta, psz_utf );
                     break;
                 case FOURCC_0xa9day: /* Creation Date */
-                    vlc_meta_Add( meta, VLC_META_DATE, psz_utf );
+                    vlc_meta_SetDate( p_meta, psz_utf );
                     break;
                 case FOURCC_0xa9des: /* Description */
-                    vlc_meta_Add( meta, VLC_META_DESCRIPTION, psz_utf );
+                    vlc_meta_SetDescription( p_meta, psz_utf );
                     break;
                 case FOURCC_0xa9gen: /* Genre */
-                    vlc_meta_Add( meta, VLC_META_GENRE, psz_utf );
+                    vlc_meta_SetGenre( p_meta, psz_utf );
                     break;
 
                 case FOURCC_0xa9swr:
index 4d14fc7..e1e3951 100644 (file)
@@ -371,15 +371,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 {
     demux_sys_t *p_sys  = p_demux->p_sys;
     int64_t *pi64;
-    vlc_meta_t **pp_meta;
+    vlc_meta_t *p_meta;
     int i_ret;
 
     switch( i_query )
     {
         case DEMUX_GET_META:
-            pp_meta = (vlc_meta_t **)va_arg( args, vlc_meta_t** );
-            if( p_sys->meta ) *pp_meta = vlc_meta_Duplicate( p_sys->meta );
-            else *pp_meta = NULL;
+            p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* );
+            vlc_meta_Merge( p_meta, p_sys->meta );
             return VLC_SUCCESS;
 
         case DEMUX_GET_TIME:
index da134da..272490d 100644 (file)
 struct demux_sys_t
 {
     char *psz_prefix;
-    playlist_t *p_playlist;
     xml_t *p_xml;
     xml_reader_t *p_xml_reader;
-    int b_shout;
 };
 
 /*****************************************************************************
@@ -51,9 +49,6 @@ static int Demux( demux_t *p_demux);
 static int Control( demux_t *p_demux, int i_query, va_list args );
 static char *GetNextToken(char *psz_cur_string);
 static int IsWhitespace( char *psz_string );
-static void ShoutcastAdd( playlist_t *p_playlist, playlist_item_t* p_genre,
-                          playlist_item_t *p_bitrate, playlist_item_t *p_item,
-                          char *psz_genre, char *psz_bitrate );
 
 /*****************************************************************************
  * Import_B4S: main import function
@@ -68,8 +63,7 @@ int E_(Import_B4S)( vlc_object_t *p_this )
     psz_ext = strrchr ( p_demux->psz_path, '.' );
 
     if( ( psz_ext && !strcasecmp( psz_ext, ".b4s") ) ||
-        ( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "b4s-open") ) ||
-        ( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "shout-b4s") ) )
+        ( p_demux->psz_demux && !strcmp(p_demux->psz_demux, "b4s-open") ) )
     {
         ;
     }
@@ -87,10 +81,7 @@ int E_(Import_B4S)( vlc_object_t *p_this )
         msg_Err( p_demux, "out of memory" );
         return VLC_ENOMEM;
     }
-    p_sys->b_shout = p_demux->psz_demux &&
-        !strcmp(p_demux->psz_demux, "shout-b4s");
     p_sys->psz_prefix = E_(FindPrefix)( p_demux );
-    p_sys->p_playlist = NULL;
     p_sys->p_xml = NULL;
     p_sys->p_xml_reader = NULL;
 
@@ -106,7 +97,6 @@ void E_(Close_B4S)( vlc_object_t *p_this )
     demux_sys_t *p_sys = p_demux->p_sys;
 
     if( p_sys->psz_prefix ) free( p_sys->psz_prefix );
-    if( p_sys->p_playlist ) vlc_object_release( p_sys->p_playlist );
     if( p_sys->p_xml_reader ) xml_ReaderDelete( p_sys->p_xml, p_sys->p_xml_reader );
     if( p_sys->p_xml ) xml_Delete( p_sys->p_xml );
     free( p_sys );
@@ -115,44 +105,19 @@ void E_(Close_B4S)( vlc_object_t *p_this )
 static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
-    playlist_t *p_playlist;
-    playlist_item_t *p_item, *p_current;
+    playlist_item_t *p_item;
     playlist_item_t *p_bitrate = NULL, *p_genre = NULL;
 
-    vlc_bool_t b_play;
-    int i_ret;
+    int i_ret, i_parent_id;
 
     xml_t *p_xml;
     xml_reader_t *p_xml_reader;
     char *psz_elname = NULL;
-    int i_type, b_shoutcast;
+    int i_type;
     char *psz_mrl = NULL, *psz_name = NULL, *psz_genre = NULL;
     char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
 
-
-    b_shoutcast = p_sys->b_shout;
-
-    p_playlist = (playlist_t *) vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST,
-                                                 FIND_ANYWHERE );
-    if( !p_playlist )
-    {
-        msg_Err( p_demux, "can't find playlist" );
-        return -1;
-    }
-    p_sys->p_playlist = p_playlist;
-
-    b_play = E_(FindItem)( p_demux, p_playlist, &p_current );
-
-    playlist_ItemToNode( p_playlist, p_current );
-    p_current->input.i_type = ITEM_TYPE_PLAYLIST;
-    if( b_shoutcast )
-    {
-        p_genre = playlist_NodeCreate( p_playlist, p_current->pp_parents[0]->i_view, "Genre", p_current );
-        playlist_CopyParents( p_current, p_genre );
-
-        p_bitrate = playlist_NodeCreate( p_playlist, p_current->pp_parents[0]->i_view, "Bitrate", p_current );
-        playlist_CopyParents( p_current, p_bitrate );
-    }
+    INIT_PLAYLIST_STUFF;
 
     p_xml = p_sys->p_xml = xml_Create( p_demux );
     if( !p_xml ) return -1;
@@ -170,6 +135,7 @@ static int Demux( demux_t *p_demux )
     if( xml_ReaderRead( p_xml_reader ) != 1 )
     {
         msg_Err( p_demux, "invalid file (no root node)" );
+        vlc_object_release( p_playlist );
         return -1;
     }
 
@@ -180,6 +146,7 @@ static int Demux( demux_t *p_demux )
         msg_Err( p_demux, "invalid root node %i, %s",
                  xml_ReaderNodeType( p_xml_reader ), psz_elname );
         if( psz_elname ) free( psz_elname );
+        vlc_object_release( p_playlist );
         return -1;
     }
     free( psz_elname );
@@ -317,82 +284,20 @@ static int Demux( demux_t *p_demux )
                 if( !psz_elname ) return -1;
                 if( !strcmp( psz_elname, "entry" ) )
                 {
-                    p_item = playlist_ItemNew( p_playlist, psz_mrl, psz_name );
+                    p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
+                                                0, NULL, -1 );
                     if( psz_now )
-                    {
-                        vlc_input_item_AddInfo( &(p_item->input),
-                                                _(VLC_META_INFO_CAT),
-                                                _( VLC_META_NOW_PLAYING ),
-                                                "%s",
-                                                psz_now );
-                    }
+                        vlc_meta_SetNowPlaying( p_input->p_meta, psz_now );
                     if( psz_genre )
-                    {
-                        vlc_input_item_AddInfo( &p_item->input,
-                                                _(VLC_META_INFO_CAT),
-                                                _( VLC_META_GENRE ),
-                                                "%s",
-                                                psz_genre );
-                    }
+                        vlc_meta_SetGenre( p_input->p_meta, psz_genre );
                     if( psz_listeners )
-                    {
-                        vlc_input_item_AddInfo( &p_item->input,
-                                                _(VLC_META_INFO_CAT),
-                                                _( "Listeners" ),
-                                                "%s",
-                                                psz_listeners );
-                    }
+                        msg_Err( p_playlist, "Unsupported meta listeners" );
                     if( psz_bitrate )
-                    {
-                        vlc_input_item_AddInfo( &p_item->input,
-                                                _(VLC_META_INFO_CAT),
-                                                _( "Bitrate" ),
-                                                "%s",
-                                                psz_bitrate );
-                    }
-                    playlist_NodeAddItem( p_playlist, p_item,
-                                          p_current->pp_parents[0]->i_view,
-                                          p_current, PLAYLIST_APPEND,
-                                          PLAYLIST_END );
-
-                    /* We need to declare the parents of the node as the
-                     *                  * same of the parent's ones */
-                    playlist_CopyParents( p_current, p_item );
-
-                    vlc_input_item_CopyOptions( &p_current->input,
-                                                &p_item->input );
-                    if( b_shoutcast )
-                    {
-                        char *psz_genreToken;
-                        char *psz_otherToken;
-                        int i = 0;
-
-                        psz_genreToken = psz_genre;
-
-                        /* split up the combined genre string form
-                        shoutcast and add the individual genres */
-                        while ( psz_genreToken &&
-                          ( psz_otherToken = GetNextToken(psz_genreToken )))
-                        {
-                            if( strlen(psz_genreToken)>2 )
-                            /* We dont want genres below 2 letters,
-                            this gets rid of alot of junk*/
-                            {
-                                /* lowercase everything */
-                                for( i=0; psz_genreToken[i]!=0; i++ )
-                                    psz_genreToken[i] =
-                                        tolower(psz_genreToken[i]);
-                /* Make first letter uppercase, purely cosmetical */
-                                psz_genreToken[0] =
-                                    toupper( psz_genreToken[0] );
-                                ShoutcastAdd( p_playlist, p_genre,
-                                              p_bitrate, p_item,
-                                              psz_genreToken, psz_bitrate );
-
-                                psz_genreToken = psz_otherToken;
-                            }
-                        }
-                    }
+                        msg_Err( p_playlist, "Unsupported meta bitrate" );
+
+                    playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
+                         p_item_in_category, (i_parent_id > 0 ) ? VLC_TRUE:
+                                                 VLC_FALSE, PLAYLIST_APPEND );
 
 #define FREE(a) if( a ) free( a ); a = NULL;
                     FREE( psz_name );
@@ -415,25 +320,8 @@ static int Demux( demux_t *p_demux )
     {
         msg_Warn( p_demux, "error while parsing data" );
     }
-    if( b_shoutcast )
-    {
-        vlc_mutex_lock( &p_playlist->object_lock );
-        playlist_NodeSort( p_playlist, p_bitrate, SORT_TITLE_NUMERIC, ORDER_NORMAL );
-        vlc_mutex_unlock( &p_playlist->object_lock );
-    }
 
-    /* Go back and play the playlist */
-    if( b_play && p_playlist->status.p_item &&
-        p_playlist->status.p_item->i_children > 0 )
-    {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                          p_playlist->status.i_view,
-                          p_playlist->status.p_item,
-                          p_playlist->status.p_item->pp_children[0] );
-    }
-    
-    vlc_object_release( p_playlist );
-    p_sys->p_playlist = NULL;
+    HANDLE_PLAY_AND_RELEASE;
     return VLC_SUCCESS;
 }
 
@@ -476,38 +364,3 @@ static int IsWhitespace( char *psz_string )
     }
     return VLC_TRUE;
 }
-
-static void ShoutcastAdd( playlist_t *p_playlist, playlist_item_t* p_genre,
-                          playlist_item_t *p_bitrate, playlist_item_t *p_item,
-                          char *psz_genre, char *psz_bitrate )
-{
-    playlist_item_t *p_parent;
-    if( psz_bitrate )
-    {
-        playlist_item_t *p_copy = playlist_ItemCopy(p_playlist,p_item);
-        p_parent = playlist_ChildSearchName( p_bitrate, psz_bitrate );
-        if( !p_parent )
-        {
-            p_parent = playlist_NodeCreate( p_playlist, p_genre->pp_parents[0]->i_view, psz_bitrate,
-                                            p_bitrate );
-            playlist_CopyParents( p_bitrate, p_parent );
-        }
-        playlist_NodeAddItem( p_playlist, p_copy, p_parent->pp_parents[0]->i_view, p_parent, PLAYLIST_APPEND, PLAYLIST_END  );
-        playlist_CopyParents( p_parent, p_copy );
-
-    }
-
-    if( psz_genre )
-    {
-        playlist_item_t *p_copy = playlist_ItemCopy(p_playlist,p_item);
-        p_parent = playlist_ChildSearchName( p_genre, psz_genre );
-        if( !p_parent )
-        {
-            p_parent = playlist_NodeCreate( p_playlist, p_genre->pp_parents[0]->i_view, psz_genre,
-                                            p_genre );
-            playlist_CopyParents( p_genre, p_parent );
-        }
-        playlist_NodeAddItem( p_playlist, p_copy, p_parent->pp_parents[0]->i_view, p_parent, PLAYLIST_APPEND, PLAYLIST_END );
-        playlist_CopyParents( p_parent, p_copy );
-    }
-}
index 8ad82ec..e7e6b01 100644 (file)
@@ -100,6 +100,7 @@ void E_(Close_DVB)( vlc_object_t *p_this )
  *****************************************************************************/
 static int Demux( demux_t *p_demux )
 {
+#if 0
     playlist_t *p_playlist;
     char       *psz_line;
     playlist_item_t *p_current;
@@ -116,7 +117,7 @@ static int Demux( demux_t *p_demux )
     b_play = E_(FindItem)( p_demux, p_playlist, &p_current );
 
     playlist_ItemToNode( p_playlist, p_current );
-    p_current->input.i_type = ITEM_TYPE_PLAYLIST;
+    p_current->p_input->i_type = ITEM_TYPE_PLAYLIST;
 
     while( (psz_line = stream_ReadLine( p_demux->s )) )
     {
@@ -166,6 +167,7 @@ static int Demux( demux_t *p_demux )
 
     vlc_object_release( p_playlist );
     return VLC_SUCCESS;
+#endif
 }
 
 static struct
index 6fadf92..931ad9b 100644 (file)
@@ -107,34 +107,16 @@ void E_(Close_M3U)( vlc_object_t *p_this )
 
 static int Demux( demux_t *p_demux )
 {
-    playlist_t *p_playlist;
     char       *psz_line;
-
     char       *psz_name = NULL;
     char       *psz_artist = NULL;
     int        i_parsed_duration = 0;
     mtime_t    i_duration = -1;
-    char       **ppsz_options = NULL;
-    int        i_options = 0, i;
-
-    playlist_item_t *p_item, *p_current;
-
-    vlc_bool_t b_play;
-
+    const char**ppsz_options = NULL;
+    int        i_options = 0, i, i_parent_id;
     vlc_bool_t b_cleanup = VLC_FALSE;
 
-    p_playlist = (playlist_t *) vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST,
-                                                 FIND_ANYWHERE );
-    if( !p_playlist )
-    {
-        msg_Err( p_demux, "can't find playlist" );
-        return -1;
-    }
-
-    b_play = E_(FindItem)( p_demux, p_playlist, &p_current );
-
-    playlist_ItemToNode( p_playlist, p_current );
-    p_current->input.i_type = ITEM_TYPE_PLAYLIST;
+    INIT_PLAYLIST_STUFF;
 
     psz_line = stream_ReadLine( p_demux->s );
     while( psz_line )
@@ -172,7 +154,7 @@ static int Demux( demux_t *p_demux )
                                    sizeof("EXTVLCOPT:") -1 ) )
             {
                 /* VLC Option */
-                char *psz_option;
+                const char *psz_option;
                 psz_parse += sizeof("EXTVLCOPT:") -1;
                 if( !*psz_parse ) goto error;
 
@@ -199,28 +181,18 @@ static int Demux( demux_t *p_demux )
             EnsureUTF8( psz_name );
             EnsureUTF8( psz_mrl );
 
-            p_item = playlist_ItemNew( p_playlist, psz_mrl, psz_name );
             for( i = 0; i< i_options; i++ )
-            {
-                EnsureUTF8( ppsz_options[i] );
-                playlist_ItemAddOption( p_item, ppsz_options[i] );
-            }
-            p_item->input.i_duration = i_duration;
+                EnsureUTF8( (char*)ppsz_options[i] );
+
+            p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
+                                        i_options, ppsz_options, i_duration );
             if ( psz_artist && *psz_artist )
-                vlc_input_item_AddInfo( &p_item->input, _(VLC_META_INFO_CAT),
+                vlc_input_item_AddInfo( p_input, _(VLC_META_INFO_CAT),
                                         _(VLC_META_ARTIST), "%s", psz_artist );
-            playlist_NodeAddItem( p_playlist, p_item,
-                                  p_current->pp_parents[0]->i_view,
-                                  p_current, PLAYLIST_APPEND,
-                                  PLAYLIST_END );
-
-            /* We need to declare the parents of the node as the
-             *                  * same of the parent's ones */
-            playlist_CopyParents( p_current, p_item );
-
-            vlc_input_item_CopyOptions( &p_current->input,
-                                        &p_item->input );
-
+            fprintf( stderr, "Adding %s\n", p_input->psz_uri );
+            playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
+                 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE,
+                 PLAYLIST_APPEND );
             free( psz_mrl );
         }
 
@@ -234,7 +206,7 @@ static int Demux( demux_t *p_demux )
         if( b_cleanup )
         {
             /* Cleanup state */
-            while( i_options-- ) free( ppsz_options[i_options] );
+            while( i_options-- ) free( (char*)ppsz_options[i_options] );
             if( ppsz_options ) free( ppsz_options );
             ppsz_options = NULL; i_options = 0;
             if( psz_name ) free( psz_name );
@@ -247,18 +219,7 @@ static int Demux( demux_t *p_demux )
             b_cleanup = VLC_FALSE;
         }
     }
-
-    /* Go back and play the playlist */
-    if( b_play && p_playlist->status.p_item &&
-        p_playlist->status.p_item->i_children > 0 )
-    {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                          p_playlist->status.i_view,
-                          p_playlist->status.p_item,
-                          p_playlist->status.p_item->pp_children[0] );
-    }
-
-    vlc_object_release( p_playlist );
+    HANDLE_PLAY_AND_RELEASE;
     return VLC_SUCCESS;
 }
 
@@ -267,7 +228,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     return VLC_EGENERIC;
 }
 
-static void parseEXTINF(char *psz_string, char **ppsz_artist, 
+static void parseEXTINF(char *psz_string, char **ppsz_artist,
                         char **ppsz_name, int *pi_duration)
 {
     char *end = NULL;
@@ -306,7 +267,7 @@ static void parseEXTINF(char *psz_string, char **ppsz_artist,
         *ppsz_artist = psz_string;
         *ppsz_name = psz_item + 3;          /* points directly after ' - ' */
         return;
-    } 
+    }
 
     /* reaching this point means: 0.8.1- with artist or something without artist */
     if ( *psz_string == ',' )
@@ -315,7 +276,7 @@ static void parseEXTINF(char *psz_string, char **ppsz_artist,
         psz_string++;
         *ppsz_name = psz_string;
         return;
-    } 
+    }
 
     psz_item = psz_string;
     psz_string = strchr( psz_string, ',' );
index 38323a3..62da136 100644 (file)
@@ -75,7 +75,6 @@ static int Demux( demux_t *p_demux)
         return VLC_EGENERIC;
     }
 
-    p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
     while( ( psz_line = stream_ReadLine( p_demux->s) ) != NULL )
     {
         char *psz_unicode;
@@ -95,8 +94,8 @@ static int Demux( demux_t *p_demux)
         }
 
         psz_unicode = FromLocale( psz_line );
-        playlist_Add( p_playlist, psz_unicode, psz_unicode, PLAYLIST_APPEND,
-                      PLAYLIST_END );
+//        playlist_Add( p_playlist, psz_unicode, psz_unicode, PLAYLIST_APPEND,
+//                      PLAYLIST_END );
 
         free( psz_line );
         LocaleFree( psz_line );
index d745944..23f5ca6 100644 (file)
@@ -50,6 +50,8 @@ vlc_module_begin();
     add_bool( "playlist-autostart", 1, NULL,
               AUTOSTART_TEXT, AUTOSTART_LONGTEXT, VLC_FALSE );
 
+    add_integer( "parent-item", 0, NULL, NULL, NULL, VLC_TRUE );
+
     set_shortname( _("Playlist") );
     set_description( _("Playlist") );
     add_shortcut( "old-open" );
@@ -153,13 +155,37 @@ char *E_(ProcessMRL)( char *psz_mrl, char *psz_prefix )
     return psz_mrl;
 }
 
+void E_(AddToPlaylist)( demux_t *p_demux, playlist_t *p_playlist,
+                        input_item_t *p_input,
+                        playlist_item_t *p_item, int i_parent_id )
+{
+    // Only add to parent if specific parent requested or not current
+    // playlist item
+   if( i_parent_id > 0 || ! (
+         p_playlist->status.p_item &&
+         p_playlist->status.p_item->p_input ==
+              ((input_thread_t *)p_demux->p_parent)->input.p_item ) )
+   {
+       playlist_NodeAddInput( p_playlist, p_input, p_item,
+                              PLAYLIST_APPEND, PLAYLIST_END );
+   }
+   // Else, add to both
+   else
+   {
+       playlist_BothAddInput( p_playlist, p_input, p_item,
+                              PLAYLIST_APPEND, PLAYLIST_END );
+   }
+   vlc_input_item_CopyOptions( p_item->p_input, p_input );
+}
+
+
 vlc_bool_t E_(FindItem)( demux_t *p_demux, playlist_t *p_playlist,
                      playlist_item_t **pp_item )
 {
      vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" );
 
      if( b_play && p_playlist->status.p_item &&
-             &p_playlist->status.p_item->input ==
+             p_playlist->status.p_item->p_input ==
                 ((input_thread_t *)p_demux->p_parent)->input.p_item )
      {
          msg_Dbg( p_playlist, "starting playlist playback" );
index 542f234..a669849 100644 (file)
@@ -26,6 +26,8 @@ char *E_(FindPrefix)( demux_t * );
 
 vlc_bool_t E_(FindItem)( demux_t *, playlist_t *, playlist_item_t **);
 
+void E_(AddToPlaylist)( demux_t *, playlist_t*,input_item_t*,playlist_item_t*,int );
+
 int E_(Import_Old) ( vlc_object_t * );
 
 int E_(Import_Native) ( vlc_object_t * );
@@ -50,3 +52,38 @@ int E_(xspf_import_Activate) ( vlc_object_t * );
 
 int E_(Import_Shoutcast) ( vlc_object_t * );
 void E_(Close_Shoutcast) ( vlc_object_t * );
+
+#define INIT_PLAYLIST_STUFF \
+    vlc_bool_t b_play; \
+    playlist_item_t *p_current, *p_item_in_category = NULL; \
+    input_item_t *p_input; \
+    playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_demux, \
+                                        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); \
+    if( !p_playlist ) \
+    { \
+        msg_Err( p_demux, "can't find playlist" ); \
+        return VLC_EGENERIC; \
+    } \
+    i_parent_id = var_CreateGetInteger( p_demux, "parent-item" ); \
+    if( i_parent_id > 0 ) \
+    { \
+        b_play = VLC_FALSE;     \
+        p_current = playlist_ItemGetById( p_playlist, i_parent_id );    \
+    } \
+    else \
+    { \
+        b_play = E_(FindItem)( p_demux, p_playlist, &p_current ); \
+        p_item_in_category = playlist_ItemToNode( p_playlist, p_current ); \
+        p_current->p_input->i_type = ITEM_TYPE_PLAYLIST;        \
+    }
+
+#define HANDLE_PLAY_AND_RELEASE \
+    /* Go back and play the playlist */ \
+    if( b_play && p_playlist->status.p_item && \
+                  p_playlist->status.p_item->i_children > 0 ) \
+    { \
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242, \
+                          p_playlist->status.p_item, NULL ); \
+    } \
+    vlc_object_release( p_playlist );
+
index 3341890..e924f50 100644 (file)
@@ -99,6 +99,7 @@ void E_(Close_PLS)( vlc_object_t *p_this )
 
 static int Demux( demux_t *p_demux )
 {
+#if 0
     mtime_t        i_duration = -1;
     char          *psz_name = NULL;
     char          *psz_line;
@@ -282,6 +283,7 @@ static int Demux( demux_t *p_demux )
     }
     vlc_object_release( p_playlist );
     return VLC_SUCCESS;
+#endif
 }
 
 static int Control( demux_t *p_demux, int i_query, va_list args )
index 8122d96..25f9846 100644 (file)
@@ -106,13 +106,10 @@ void E_(Close_podcast)( vlc_object_t *p_this )
 static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
-    playlist_t *p_playlist;
-    playlist_item_t *p_item, *p_current;
 
-    vlc_bool_t b_play;
     vlc_bool_t b_item = VLC_FALSE;
     vlc_bool_t b_image = VLC_FALSE;
-    int i_ret;
+    int i_ret, i_parent_id;
 
     xml_t *p_xml;
     xml_reader_t *p_xml_reader;
@@ -130,19 +127,7 @@ static int Demux( demux_t *p_demux )
     char *psz_item_summary = NULL;
     int i_type;
 
-    p_playlist = (playlist_t *) vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST,
-                                                 FIND_ANYWHERE );
-    if( !p_playlist )
-    {
-        msg_Err( p_demux, "can't find playlist" );
-        return -1;
-    }
-    p_sys->p_playlist = p_playlist;
-
-    b_play = E_(FindItem)( p_demux, p_playlist, &p_current );
-
-    playlist_ItemToNode( p_playlist, p_current );
-    p_current->input.i_type = ITEM_TYPE_PLAYLIST;
+    INIT_PLAYLIST_STUFF;
 
     p_xml = p_sys->p_xml = xml_Create( p_demux );
     if( !p_xml ) return -1;
@@ -285,7 +270,7 @@ static int Demux( demux_t *p_demux )
                 else if( b_item == VLC_FALSE && b_image == VLC_FALSE
                          && !strcmp( psz_elname, "link" ) )
                 {
-                    vlc_input_item_AddInfo( &(p_current->input),
+                    vlc_input_item_AddInfo( p_current->p_input,
                                             _( "Podcast Info" ),
                                             _( "Podcast Link" ),
                                             "%s",
@@ -294,7 +279,7 @@ static int Demux( demux_t *p_demux )
                 else if( b_item == VLC_FALSE && b_image == VLC_FALSE
                          && !strcmp( psz_elname, "copyright" ) )
                 {
-                    vlc_input_item_AddInfo( &(p_current->input),
+                    vlc_input_item_AddInfo( p_current->p_input,
                                             _( "Podcast Info" ),
                                             _( "Podcast Copyright" ),
                                             "%s",
@@ -303,7 +288,7 @@ static int Demux( demux_t *p_demux )
                 else if( b_item == VLC_FALSE && b_image == VLC_FALSE
                          && !strcmp( psz_elname, "itunes:category" ) )
                 {
-                    vlc_input_item_AddInfo( &(p_current->input),
+                    vlc_input_item_AddInfo( p_current->p_input,
                                             _( "Podcast Info" ),
                                             _( "Podcast Category" ),
                                             "%s",
@@ -312,7 +297,7 @@ static int Demux( demux_t *p_demux )
                 else if( b_item == VLC_FALSE && b_image == VLC_FALSE
                          && !strcmp( psz_elname, "itunes:keywords" ) )
                 {
-                    vlc_input_item_AddInfo( &(p_current->input),
+                    vlc_input_item_AddInfo( p_current->p_input,
                                             _( "Podcast Info" ),
                                             _( "Podcast Keywords" ),
                                             "%s",
@@ -321,7 +306,7 @@ static int Demux( demux_t *p_demux )
                 else if( b_item == VLC_FALSE && b_image == VLC_FALSE
                          && !strcmp( psz_elname, "itunes:subtitle" ) )
                 {
-                    vlc_input_item_AddInfo( &(p_current->input),
+                    vlc_input_item_AddInfo( p_current->p_input,
                                             _( "Podcast Info" ),
                                             _( "Podcast Subtitle" ),
                                             "%s",
@@ -331,7 +316,7 @@ static int Demux( demux_t *p_demux )
                          && ( !strcmp( psz_elname, "itunes:summary" )
                             ||!strcmp( psz_elname, "description" ) ) )
                 { /* <description> isn't standard iTunes podcast stuff */
-                    vlc_input_item_AddInfo( &(p_current->input),
+                    vlc_input_item_AddInfo( p_current->p_input,
                                             _( "Podcast Info" ),
                                             _( "Podcast Summary" ),
                                             "%s",
@@ -354,21 +339,12 @@ static int Demux( demux_t *p_demux )
                 if( !psz_elname ) return -1;
                 if( !strcmp( psz_elname, "item" ) )
                 {
-                    p_item = playlist_ItemNew( p_playlist, psz_item_mrl,
-                                               psz_item_name );
-                    if( p_item == NULL ) break;
-                    playlist_NodeAddItem( p_playlist, p_item,
-                                          p_current->pp_parents[0]->i_view,
-                                          p_current, PLAYLIST_APPEND,
-                                          PLAYLIST_END );
-
-                    /* We need to declare the parents of the node as the
-                     *                  * same of the parent's ones */
-                    playlist_CopyParents( p_current, p_item );
-
+                    p_input = input_ItemNewExt( p_playlist, psz_item_mrl,
+                                                psz_item_name, 0, NULL, -1 );
+                    if( p_input == NULL ) break;
                     if( psz_item_date )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Publication Date" ),
                                                 "%s",
@@ -376,7 +352,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_author )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Author" ),
                                                 "%s",
@@ -384,7 +360,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_category )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Subcategory" ),
                                                 "%s",
@@ -392,7 +368,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_duration )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Duration" ),
                                                 "%s",
@@ -400,7 +376,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_keywords )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Keywords" ),
                                                 "%s",
@@ -408,7 +384,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_subtitle )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Subtitle" ),
                                                 "%s",
@@ -416,7 +392,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_summary )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Summary" ),
                                                 "%s",
@@ -424,7 +400,7 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_size )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Size" ),
                                                 "%s bytes",
@@ -432,13 +408,17 @@ static int Demux( demux_t *p_demux )
                     }
                     if( psz_item_type )
                     {
-                        vlc_input_item_AddInfo( &p_item->input,
+                        vlc_input_item_AddInfo( p_input,
                                                 _( "Podcast Info" ),
                                                 _( "Podcast Type" ),
                                                 "%s",
                                                 psz_item_type );
                     }
 
+                    fprintf( stderr, "Adding WHEREVER\n");
+                    playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
+                          p_item_in_category, (i_parent_id > 0 ) ? VLC_TRUE:
+                                                VLC_FALSE, PLAYLIST_APPEND );
 #define FREE(a) if( a ) free( a ); a = NULL;
                     FREE( psz_item_name );
                     FREE( psz_item_mrl );
@@ -472,18 +452,7 @@ static int Demux( demux_t *p_demux )
         msg_Warn( p_demux, "error while parsing data" );
     }
 
-    /* Go back and play the playlist */
-    if( b_play && p_playlist->status.p_item &&
-        p_playlist->status.p_item->i_children > 0 )
-    {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
-                          p_playlist->status.i_view,
-                          p_playlist->status.p_item,
-                          p_playlist->status.p_item->pp_children[0] );
-    }
-
-    vlc_object_release( p_playlist );
-    p_sys->p_playlist = NULL;
+    HANDLE_PLAY_AND_RELEASE;
     return VLC_SUCCESS;
 }
 
index 1433032..438b6b0 100644 (file)
@@ -119,6 +119,7 @@ void E_(Close_Shoutcast)( vlc_object_t *p_this )
 
 static int Demux( demux_t *p_demux )
 {
+#if 0
     demux_sys_t *p_sys = p_demux->p_sys;
     playlist_t *p_playlist;
 
@@ -196,6 +197,7 @@ static int Demux( demux_t *p_demux )
 
     vlc_object_release( p_playlist );
     p_sys->p_playlist = NULL;
+#endif
     return VLC_SUCCESS;
 }
 
@@ -211,6 +213,7 @@ static int Demux( demux_t *p_demux )
  **/
 static int DemuxGenre( demux_t *p_demux )
 {
+#if 0
     demux_sys_t *p_sys = p_demux->p_sys;
     char *psz_name = NULL; /* genre name */
     char *psz_eltname = NULL; /* tag name */
@@ -303,6 +306,7 @@ static int DemuxGenre( demux_t *p_demux )
                 break;
         }
     }
+#endif
     return 0;
 }
 
@@ -333,6 +337,7 @@ static int DemuxGenre( demux_t *p_demux )
  **/
 static int DemuxStation( demux_t *p_demux )
 {
+#if 0
     demux_sys_t *p_sys = p_demux->p_sys;
 
     char *psz_base = NULL; /* */
@@ -552,6 +557,7 @@ static int DemuxStation( demux_t *p_demux )
                 break;
         }
     }
+#endif
     return 0;
 }
 #undef FREE
index 34ae342..2b6c321 100644 (file)
@@ -61,6 +61,7 @@ int E_(xspf_import_Activate)( vlc_object_t *p_this )
  */
 int xspf_import_Demux( demux_t *p_demux )
 {
+#if 0
     playlist_t *p_playlist = NULL;
     playlist_item_t *p_current = NULL;
 
@@ -144,6 +145,7 @@ int xspf_import_Demux( demux_t *p_demux )
         xml_Delete( p_xml );
 
     return i_ret;
+#endif
 }
 
 /** \brief dummy function for demux callback interface */
@@ -151,7 +153,7 @@ int xspf_import_Control( demux_t *p_demux, int i_query, va_list args )
 {
     return VLC_EGENERIC;
 }
-
+#if 0
 /**
  * \brief parse the root node of a XSPF playlist
  * \param p_demux demuxer instance
@@ -680,3 +682,4 @@ static vlc_bool_t insert_new_item( playlist_t *p_pl, playlist_item_t *p_cur,
 
     return VLC_TRUE;
 }
+#endif
index 509ca1d..08e5736 100644 (file)
@@ -404,6 +404,8 @@ static int Demux ( demux_t *p_demux )
         free( temp );
     }
 
+    msg_Err( p_playlist, "SGIMB playlist handling is broken" );
+#if 0
     p_child = playlist_ItemNew( p_playlist, p_sys->psz_uri,
                       p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri );
 
@@ -442,7 +444,7 @@ static int Demux ( demux_t *p_demux )
     playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
                            p_playlist->status.i_view,
                            p_playlist->status.p_item, NULL );
-
+#endif
     vlc_object_release( p_playlist );
     return VLC_SUCCESS;
 }
index c6e23b3..3ae74b3 100644 (file)
@@ -74,6 +74,7 @@
  *  - ...
  */
 
+#define vlc_meta_Add(a,b,c) fprintf(stderr, "FIXME: TS demuxer meta is broken\n" )
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
index a716939..0de160c 100644 (file)
@@ -76,6 +76,8 @@ static void ParseID3Tag( demux_t *p_demux, uint8_t *p_data, int i_size )
 
         while( i_strings > 0 )
         {
+            vlc_meta_t *p_meta = (vlc_meta_t *)(p_demux->p_private);
+
             char *psz_temp = id3_ucs4_utf8duplicate(
                 id3_field_getstrings( &p_frame->fields[1], --i_strings ) );
 
@@ -87,51 +89,41 @@ static void ParseID3Tag( demux_t *p_demux, uint8_t *p_data, int i_size )
                 if( psz_temp != psz_endptr &&
                     i_genre >= 0 && i_genre < NUM_GENRES )
                 {
-                    vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                                  VLC_META_GENRE, ppsz_genres[atoi(psz_temp)]);
+                    vlc_meta_SetGenre( p_meta, ppsz_genres[atoi(psz_temp)]);
                 }
                 else
                 {
                     /* Unknown genre */
-                    vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                                  VLC_META_GENRE, psz_temp );
+                    vlc_meta_SetGenre( p_meta,psz_temp );
                 }
             }
             else if( !strcmp(p_frame->id, ID3_FRAME_TITLE ) )
             {
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              VLC_META_TITLE, psz_temp );
+                vlc_meta_SetTitle( p_meta, psz_temp );
             }
             else if( !strcmp(p_frame->id, ID3_FRAME_ARTIST ) )
             {
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              VLC_META_ARTIST, psz_temp );
+                vlc_meta_SetArtist( p_meta, psz_temp );
             }
             else if( !strcmp(p_frame->id, ID3_FRAME_YEAR ) )
             {
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              VLC_META_DATE, psz_temp );
+                vlc_meta_SetDate( p_meta, psz_temp );
             }
             else if( !strcmp(p_frame->id, ID3_FRAME_COMMENT ) )
             {
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              VLC_META_DESCRIPTION, psz_temp );
+                vlc_meta_SetDescription( p_meta, psz_temp );
             }
             else if( strstr( (char*)p_frame->description, "Copyright" ) )
             {
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              VLC_META_COPYRIGHT, psz_temp );
+                vlc_meta_SetCopyright( p_meta, psz_temp );
             }
             else if( strstr( (char*)p_frame->description, "Publisher" ) )
             {
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              VLC_META_PUBLISHER, psz_temp );
+                vlc_meta_SetPublisher( p_meta, psz_temp );
             }
             else
             {
-                /* Unknown meta info */
-                vlc_meta_Add( (vlc_meta_t *)p_demux->p_private,
-                              (char *)p_frame->description, psz_temp );
+                msg_Err(p_demux, "Fixme: unhandled meta" );
             }
             free( psz_temp );
         }
index a6d059e..203a268 100644 (file)
         if ( o_urlString )
         {
             NSURL * o_url;
-    
-            playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
-                          [[[NSFileManager defaultManager] displayNameAtPath: o_urlString] UTF8String],
-                          PLAYLIST_INSERT, PLAYLIST_END );
+            input_item_t *p_input;
+
+            p_input = input_ItemNew( p_playlist,
+                                    [o_urlString fileSystemRepresentation],
+                                    [[[NSFileManager defaultManager]
+                                    displayNameAtPath: o_urlString] UTF8String] );
+            playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_INSERT,
+                                                                PLAYLIST_END );
+
 
             o_url = [NSURL fileURLWithPath: o_urlString];
             if( o_url != nil )
-            { 
+            {
                 [[NSDocumentController sharedDocumentController]
-                    noteNewRecentDocumentURL: o_url]; 
+                    noteNewRecentDocumentURL: o_url];
             }
         }
         vlc_object_release( p_playlist );
index 2065392..9f53999 100644 (file)
@@ -943,7 +943,6 @@ static VLCMain *_o_sharedMainInstance = nil;
         return;
     }
 
-#define p_input p_intf->p_sys->p_input
     if( p_intf->p_sys->b_input_update )
     {
         /* Called when new input is opened */
@@ -965,17 +964,17 @@ static VLCMain *_o_sharedMainInstance = nil;
 
         vlc_object_release( p_playlist );
 
-        if( ( b_input = ( p_input != NULL ) ) )
+        if( ( b_input = ( p_intf->p_sys->p_input != NULL ) ) )
         {
-            vlc_object_yield( p_input );
+            vlc_object_yield( p_intf->p_sys->p_input );
             /* seekable streams */
-            b_seekable = var_GetBool( p_input, "seekable" );
+            b_seekable = var_GetBool( p_intf->p_sys->p_input, "seekable" );
 
             /* check wether slow/fast motion is possible*/
-            b_control = p_input->input.b_can_pace_control;
+            b_control = p_intf->p_sys->p_input->input.b_can_pace_control;
 
             /* chapters & titles */
-            //b_chapters = p_input->stream.i_area_nb > 1;
+            //b_chapters = p_intf->p_sys->p_input->stream.i_area_nb > 1;
             vlc_object_release( p_input );
         }
 
@@ -1039,13 +1038,13 @@ static VLCMain *_o_sharedMainInstance = nil;
                 return;
             }
             o_temp = [NSString stringWithUTF8String:
-                p_playlist->status.p_item->input.psz_name];
+                p_playlist->status.p_item->p_input->psz_name];
             if( o_temp == NULL )
                 o_temp = [NSString stringWithCString:
-                    p_playlist->status.p_item->input.psz_name];
+                    p_playlist->status.p_item->p_input->psz_name];
             [self setScrollField: o_temp stopAfter:-1];
 
-            p_vout = vlc_object_find( p_input, VLC_OBJECT_VOUT,
+            p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT,
                                                     FIND_PARENT );
             if( p_vout != NULL )
             {
@@ -1069,7 +1068,7 @@ static VLCMain *_o_sharedMainInstance = nil;
             p_intf->p_sys->b_current_title_update = FALSE;
         }
 
-        if( p_input && [o_timeslider isEnabled] )
+        if( p_intf->p_sys->p_input && [o_timeslider isEnabled] )
         {
             /* Update the slider */
             vlc_value_t time;
@@ -1078,11 +1077,11 @@ static VLCMain *_o_sharedMainInstance = nil;
             vlc_value_t pos;
             float f_updated;
 
-            var_Get( p_input, "position", &pos );
+            var_Get( p_intf->p_sys->p_input, "position", &pos );
             f_updated = 10000. * pos.f_float;
             [o_timeslider setFloatValue: f_updated];
 
-            var_Get( p_input, "time", &time );
+            var_Get( p_intf->p_sys->p_input, "time", &time );
             i_seconds = time.i_time / 1000000;
 
             o_time = [NSString stringWithFormat: @"%d:%02d:%02d",
@@ -1108,7 +1107,7 @@ static VLCMain *_o_sharedMainInstance = nil;
         }
 
         /* Manage Playing status */
-        var_Get( p_input, "state", &val );
+        var_Get( p_intf->p_sys->p_input, "state", &val );
         if( p_intf->p_sys->i_play_status != val.i_int )
         {
             p_intf->p_sys->i_play_status = val.i_int;
@@ -1125,7 +1124,6 @@ static VLCMain *_o_sharedMainInstance = nil;
         [self setSubmenusEnabled: FALSE];
     }
 
-#undef p_input
 
     [self updateMessageArray];
 
@@ -1225,8 +1223,7 @@ static VLCMain *_o_sharedMainInstance = nil;
 - (void)resetScrollField
 {
     i_end_scroll = -1;
-#define p_input p_intf->p_sys->p_input
-    if( p_input && !p_input->b_die )
+    if( p_intf->p_sys->p_input && !p_intf->p_sys->p_input->b_die )
     {
         NSString *o_temp;
         playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
@@ -1236,15 +1233,14 @@ static VLCMain *_o_sharedMainInstance = nil;
             return;
         }
         o_temp = [NSString stringWithUTF8String:
-                  p_playlist->status.p_item->input.psz_name];
+                  p_playlist->status.p_item->p_input->psz_name];
         if( o_temp == NULL )
             o_temp = [NSString stringWithCString:
-                    p_playlist->status.p_item->input.psz_name];
+                    p_playlist->status.p_item->p_input->psz_name];
         [self setScrollField: o_temp stopAfter:-1];
         vlc_object_release( p_playlist );
         return;
     }
-#undef p_input
     [self setScrollField: _NS("VLC media player") stopAfter:-1];
 }
 
index 67ecdf3..18ef164 100644 (file)
@@ -42,7 +42,6 @@
     IBOutlet id o_outline_view;
 
     NSMutableDictionary *o_outline_dict;
-    int i_current_view;
 }
 
 - (void)initStrings;
 - (IBAction)addNode:(id)sender;
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
-- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position inView:(int)i_view enqueue:(BOOL)b_enqueue;
+- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue;
 
 
 @end
index 406ff16..07d8edc 100644 (file)
 {
     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
                                           FIND_ANYWHERE );
-    i_current_view = VIEW_CATEGORY;
-    playlist_ViewUpdate( p_playlist, i_current_view );
-
     [o_outline_view setTarget: self];
     [o_outline_view setDelegate: self];
     [o_outline_view setDataSource: self];
     if( item == nil )
     {
         /* root object */
-        playlist_view_t *p_view;
-        p_view = playlist_ViewFind( p_playlist, i_current_view );
-        if( p_view && p_view->p_root )
+        if( p_playlist->p_root_category )
         {
-            i_return = p_view->p_root->i_children;
-
-            if( i_current_view == VIEW_CATEGORY )
-            {
-                i_return--; /* remove the GENERAL item from the list */
-                i_return += p_playlist->p_general->i_children; /* add the items of the general node */
-            }
+            i_return = p_playlist->p_root_category->i_children;
         }
     }
     else
             i_return = p_item->i_children;
     }
     vlc_object_release( p_playlist );
-    
+
     if( i_return <= 0 )
         i_return = 0;
-    
+
     return i_return;
 }
 
     if( item == nil )
     {
         /* root object */
-        playlist_view_t *p_view;
-        p_view = playlist_ViewFind( p_playlist, i_current_view );
-        if( p_view && p_view->p_root ) p_return = p_view->p_root->pp_children[index];
-
-        if( i_current_view == VIEW_CATEGORY )
+        if( p_playlist->p_root_category )
         {
-            if( p_playlist->p_general->i_children && index >= 0 && index < p_playlist->p_general->i_children )
-            {
-                p_return = p_playlist->p_general->pp_children[index];
-            }
-            else if( p_view && p_view->p_root && index >= 0 && index - p_playlist->p_general->i_children < p_view->p_root->i_children )
-            {
-                p_return = p_view->p_root->pp_children[index - p_playlist->p_general->i_children + 1];
-            }
+            p_return = p_playlist->p_root_category->pp_children[index];
         }
     }
     else
         if( p_item && index < p_item->i_children && index >= 0 )
             p_return = p_item->pp_children[index];
     }
-    
 
     vlc_object_release( p_playlist );
 
     if( item == nil )
     {
         /* root object */
-        playlist_view_t *p_view;
-        p_view = playlist_ViewFind( p_playlist, i_current_view );
-        if( p_view && p_view->p_root ) i_return = p_view->p_root->i_children;
-
-        if( i_current_view == VIEW_CATEGORY )
+        if( p_playlist->p_root_category )
         {
-            i_return--;
-            i_return += p_playlist->p_general->i_children;
+            i_return = p_playlist->p_root_category->i_children;
         }
     }
     else
     if( [[o_tc identifier] isEqualToString:@"1"] )
     {
         o_value = [NSString stringWithUTF8String:
-            p_item->input.psz_name];
+            p_item->p_input->psz_name];
         if( o_value == NULL )
             o_value = [NSString stringWithCString:
-                p_item->input.psz_name];
+                p_item->p_input->psz_name];
     }
     else if( [[o_tc identifier] isEqualToString:@"2"] )
     {
         char *psz_temp;
-        psz_temp = vlc_input_item_GetInfo( &p_item->input ,_("Meta-information"),_("Artist") );
+        psz_temp = vlc_input_item_GetInfo( p_item->p_input ,_("Meta-information"),_("Artist") );
 
         if( psz_temp == NULL )
             o_value = @"";
     else if( [[o_tc identifier] isEqualToString:@"3"] )
     {
         char psz_duration[MSTRTIME_MAX_SIZE];
-        mtime_t dur = p_item->input.i_duration;
+        mtime_t dur = p_item->p_input->i_duration;
         if( dur != -1 )
         {
             secstotimestr( psz_duration, dur/1000000 );
@@ -577,19 +549,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     vlc_object_release( p_playlist );
 }
 
-- (playlist_item_t *)parentOfItem:(playlist_item_t *)p_item
-{
-    int i;
-    for( i = 0 ; i < p_item->i_parents; i++ )
-    {
-        if( p_item->pp_parents[i]->i_view == i_current_view )
-        {
-            return p_item->pp_parents[i]->p_parent;
-        }
-    }
-    return NULL;
-}
-
 - (void)updateRowSelection
 {
     int i_row;
@@ -611,11 +570,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
 
     p_temp_item = p_item;
-    while( p_temp_item->i_parents > 0 )
+    while( p_temp_item->p_parent )
     {
         [o_array insertObject: [NSValue valueWithPointer: p_temp_item] atIndex: 0];
-
-        p_temp_item = [self parentOfItem: p_temp_item];
+        p_temp_item = p_temp_item->p_parent;
         /*for (i = 0 ; i < p_temp_item->i_parents ; i++)
         {
             if( p_temp_item->pp_parents[i]->i_view == i_current_view )
@@ -626,13 +584,16 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         }*/
     }
 
-    for (j = 0 ; j < [o_array count] - 1 ; j++)
+    for( j = 0; j < [o_array count] - 1; j++ )
     {
         id o_item;
         if( ( o_item = [o_outline_dict objectForKey:
                             [NSString stringWithFormat: @"%p",
                             [[o_array objectAtIndex:j] pointerValue]]] ) != nil )
+        {
+            msg_Err( p_playlist, "o_item: %p", o_item );
             [o_outline_view expandItem: o_item];
+        }
 
     }
 
@@ -700,33 +661,15 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             }
         }
 
-        while( p_temp_item->i_parents > 0 )
+        while( p_temp_item )
         {
-            p_temp_item = [self parentOfItem: p_temp_item];
+            p_temp_item = p_temp_item->p_parent;
             if( p_temp_item == p_node )
             {
                  vlc_mutex_unlock( &p_playlist->object_lock );
                  vlc_object_release( p_playlist );
                  return YES;
             }
-
-/*            for( i = 0; i < p_temp_item->i_parents ; i++ )
-            {
-                if( p_temp_item->pp_parents[i]->i_view == i_current_view )
-                {
-                    if( p_temp_item->pp_parents[i]->p_parent == p_node )
-                    {
-                        vlc_mutex_unlock( &p_playlist->object_lock );
-                        vlc_object_release( p_playlist );
-                        return YES;
-                    }
-                    else
-                    {
-                        p_temp_item = p_temp_item->pp_parents[i]->p_parent;
-                        break;
-                    }
-                }
-            }*/
         }
         vlc_mutex_unlock( &p_playlist->object_lock );
     }
@@ -816,7 +759,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             {
                 o_real_filename = o_filename;
             }
-            playlist_Export( p_playlist, [o_real_filename fileSystemRepresentation], "export-m3u" );
+            playlist_Export( p_playlist, [o_real_filename fileSystemRepresentation], p_playlist->p_local_category, "export-m3u" );
         }
     }
     vlc_object_release( p_playlist );
@@ -840,15 +783,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         {
             if( p_item->i_children == -1 )
             {
-                p_node = [self parentOfItem: p_item];
+                p_node = p_item->p_parent;
 
-/*                for( i = 0 ; i < p_item->i_parents ; i++ )
-                {
-                    if( p_item->pp_parents[i]->i_view == i_current_view )
-                    {
-                        p_node = p_item->pp_parents[i]->p_parent;
-                    }
-                }*/
             }
             else
             {
@@ -862,7 +798,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
                     p_item = NULL;
                 }
             }
-            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, i_current_view, p_node, p_item );
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 0, p_node, p_item );
         }
         vlc_object_release( p_playlist );
     }
@@ -898,7 +834,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             {
                 if( p_item->i_children == -1 )
                 {
-                    playlist_PreparseEnqueue( p_playlist, &p_item->input );
+                    playlist_PreparseEnqueue( p_playlist, p_item->p_input );
                 }
                 else
                 {
@@ -925,8 +861,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     [o_mi setState: playlist_IsServicesDiscoveryLoaded( p_playlist,
                                           [o_string cString] ) ? YES : NO];
 
-    i_current_view = VIEW_CATEGORY;
-    playlist_ViewUpdate( p_playlist, i_current_view );
     vlc_object_release( p_playlist );
     [self playlistUpdated];
     return;
@@ -983,14 +917,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         }
         else
         {
-            if( p_playlist->status.i_status != PLAYLIST_STOPPED &&
-                p_playlist->status.p_item == [[o_outline_view itemAtRow: i_row] pointerValue] )
-            {
-                playlist_Stop( p_playlist );
-            }
-            vlc_mutex_lock( &p_playlist->object_lock );
-            playlist_Delete( p_playlist, p_item->input.i_id );
-            vlc_mutex_unlock( &p_playlist->object_lock );
+            playlist_LockDelete( p_playlist, p_item->i_id );
         }
     }
     [self playlistUpdated];
@@ -1026,8 +953,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     else
     /*If no item is selected, sort the whole playlist*/
     {
-        playlist_view_t * p_view = playlist_ViewFind( p_playlist, i_current_view );
-        p_item = p_view->p_root;
+        p_item = p_playlist->p_root_category;
     }
 
     if( p_item->i_children > -1 ) // the item is a node
@@ -1038,25 +964,16 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
     else
     {
-        int i;
-
-        for( i = 0 ; i < p_item->i_parents ; i++ )
-        {
-            if( p_item->pp_parents[i]->i_view == i_current_view )
-            {
-                vlc_mutex_lock( &p_playlist->object_lock );
-                playlist_RecursiveNodeSort( p_playlist,
-                        p_item->pp_parents[i]->p_parent, i_mode, ORDER_NORMAL );
-                vlc_mutex_unlock( &p_playlist->object_lock );
-                break;
-            }
-        }
+        vlc_mutex_lock( &p_playlist->object_lock );
+        playlist_RecursiveNodeSort( p_playlist,
+                p_item->p_parent, i_mode, ORDER_NORMAL );
+        vlc_mutex_unlock( &p_playlist->object_lock );
     }
     vlc_object_release( p_playlist );
     [self playlistUpdated];
 }
 
-- (playlist_item_t *)createItem:(NSDictionary *)o_one_item
+- (input_item_t *)createItem:(NSDictionary *)o_one_item
 {
     intf_thread_t * p_intf = VLCIntf;
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
@@ -1066,7 +983,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     {
         return NULL;
     }
-    playlist_item_t *p_item;
+    input_item_t *p_input;
     int i;
     BOOL b_rem = FALSE, b_dir = FALSE;
     NSString *o_uri, *o_name;
@@ -1124,15 +1041,15 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         o_uri = o_temp;
     }
 
-    p_item = playlist_ItemNew( p_intf, [o_uri fileSystemRepresentation], [o_name UTF8String] );
-    if( !p_item )
+    p_input = input_ItemNew( p_playlist, [o_uri fileSystemRepresentation], [o_name UTF8String] );
+    if( !p_input )
        return NULL;
 
     if( o_options )
     {
         for( i = 0; i < (int)[o_options count]; i++ )
         {
-            playlist_ItemAddOption( p_item, strdup( [[o_options objectAtIndex:i] UTF8String] ) );
+            vlc_input_item_AddOption( p_input, strdup( [[o_options objectAtIndex:i] UTF8String] ) );
         }
     }
 
@@ -1145,7 +1062,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
 
     vlc_object_release( p_playlist );
-    return p_item;
+    return p_input;
 }
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
@@ -1160,29 +1077,39 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
     {
-        playlist_item_t *p_item;
+        input_item_t *p_input;
         NSDictionary *o_one_item;
 
         /* Get the item */
         o_one_item = [o_array objectAtIndex: i_item];
-        p_item = [self createItem: o_one_item];
-        if( !p_item )
+        p_input = [self createItem: o_one_item];
+        if( !p_input )
         {
             continue;
         }
 
         /* Add the item */
-        playlist_AddItem( p_playlist, p_item, PLAYLIST_INSERT, i_position == -1 ? PLAYLIST_END : i_position + i_item );
+        playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_INSERT,
+                        i_position == -1 ? PLAYLIST_END : i_position + i_item );
 
         if( i_item == 0 && !b_enqueue )
         {
+            playlist_item_t *p_item;
+            p_item = playlist_ItemGetByInput( p_playlist, p_input );
             playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
         }
+        else
+        {
+            playlist_item_t *p_item;
+            p_item = playlist_ItemGetByInput( p_playlist, p_input );
+            playlist_Control( p_playlist, PLAYLIST_PREPARSE, p_item );
+        }
     }
+    [self playlistUpdated];
     vlc_object_release( p_playlist );
 }
 
-- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position inView:(int)i_view enqueue:(BOOL)b_enqueue
+- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue
 {
     int i_item;
     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
@@ -1194,27 +1121,39 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
     {
-        playlist_item_t *p_item;
+        input_item_t *p_input;
         NSDictionary *o_one_item;
 
         /* Get the item */
         o_one_item = [o_array objectAtIndex: i_item];
-        p_item = [self createItem: o_one_item];
-        if( !p_item )
+        p_input = [self createItem: o_one_item];
+        if( !p_input )
         {
             continue;
         }
 
         /* Add the item */
-        playlist_NodeAddItem( p_playlist, p_item, i_view, p_node, PLAYLIST_INSERT, i_position + i_item );
+       playlist_NodeAddInput( p_playlist, p_input, p_node,
+                                      PLAYLIST_INSERT,
+                                      i_position == -1 ?
+                                      PLAYLIST_END : i_position + i_item );
+
 
         if( i_item == 0 && !b_enqueue )
         {
+            playlist_item_t *p_item;
+            p_item = playlist_ItemGetByInput( p_playlist, p_input );
             playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
         }
+        else
+        {
+            playlist_item_t *p_item;
+            p_item = playlist_ItemGetByInput( p_playlist, p_input );
+            playlist_Control( p_playlist, PLAYLIST_PREPARSE, p_item );
+        }
     }
+    [self playlistUpdated];
     vlc_object_release( p_playlist );
-
 }
 
 - (IBAction)handlePopUp:(id)sender
@@ -1288,8 +1227,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
         vlc_mutex_lock( &p_playlist->object_lock );
         o_current_name = [NSString stringWithUTF8String:
-            p_item->pp_children[i_current]->input.psz_name];
-        psz_temp = vlc_input_item_GetInfo( &p_item->input ,
+            p_item->pp_children[i_current]->p_input->psz_name];
+        psz_temp = vlc_input_item_GetInfo( p_item->p_input ,
                    _("Meta-information"),_("Artist") );
         o_current_author = [NSString stringWithUTF8String: psz_temp];
         free( psz_temp);
@@ -1339,7 +1278,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 {
     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
                                                        FIND_ANYWHERE );
-    playlist_view_t * p_view;
     id o_result;
 
     unsigned int i;
@@ -1349,65 +1287,53 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     if( p_playlist == NULL )
         return;
-    p_view = playlist_ViewFind( p_playlist, i_current_view );
 
-    if( p_view )
-    {
         /*First, only search after the selected item:*
          *(b_selected_item_met = NO)                 */
-        o_result = [self subSearchItem:p_view->p_root];
-        if( o_result == NULL )
-        {
-            /* If the first search failed, search again from the beginning */
-            o_result = [self subSearchItem:p_view->p_root];
-        }
-        if( o_result != NULL )
-        {
-            int i_start;
-            if( [[o_result objectAtIndex: 0] pointerValue] ==
-                                                    p_playlist->p_general )
-            i_start = 1;
-            else
-            i_start = 0;
+    o_result = [self subSearchItem:p_playlist->p_root_category];
+    if( o_result == NULL )
+    {
+        /* If the first search failed, search again from the beginning */
+        o_result = [self subSearchItem:p_playlist->p_root_category];
+    }
+    if( o_result != NULL )
+    {
+        int i_start;
+        if( [[o_result objectAtIndex: 0] pointerValue] ==
+                                                    p_playlist->p_local_category )
+        i_start = 1;
+        else
+        i_start = 0;
 
-            for( i = i_start ; i < [o_result count] - 1 ; i++ )
-            {
-                [o_outline_view expandItem: [o_outline_dict objectForKey:
-                            [NSString stringWithFormat: @"%p",
-                            [[o_result objectAtIndex: i] pointerValue]]]];
-            }
-            i_row = [o_outline_view rowForItem: [o_outline_dict objectForKey:
-                            [NSString stringWithFormat: @"%p",
-                            [[o_result objectAtIndex: [o_result count] - 1 ]
-                            pointerValue]]]];
-        }
-        if( i_row > -1 )
+        for( i = i_start ; i < [o_result count] - 1 ; i++ )
         {
-            [o_outline_view selectRow:i_row byExtendingSelection: NO];
-            [o_outline_view scrollRowToVisible: i_row];
+            [o_outline_view expandItem: [o_outline_dict objectForKey:
+                        [NSString stringWithFormat: @"%p",
+                        [[o_result objectAtIndex: i] pointerValue]]]];
         }
+        i_row = [o_outline_view rowForItem: [o_outline_dict objectForKey:
+                        [NSString stringWithFormat: @"%p",
+                        [[o_result objectAtIndex: [o_result count] - 1 ]
+                        pointerValue]]]];
+    }
+    if( i_row > -1 )
+    {
+        [o_outline_view selectRow:i_row byExtendingSelection: NO];
+        [o_outline_view scrollRowToVisible: i_row];
     }
     vlc_object_release( p_playlist );
 }
 
 - (IBAction)recursiveExpandNode:(id)sender
 {
-    int i;
     id o_item = [o_outline_view itemAtRow: [o_outline_view selectedRow]];
     playlist_item_t *p_item = (playlist_item_t *)[o_item pointerValue];
 
     if( ![[o_outline_view dataSource] outlineView: o_outline_view
                                                     isItemExpandable: o_item] )
     {
-        for( i = 0 ; i < p_item->i_parents ; i++ )
-        {
-            if( p_item->pp_parents[i]->i_view == i_current_view )
-            {
-                o_item = [o_outline_dict objectForKey: [NSString
-                    stringWithFormat: @"%p", p_item->pp_parents[i]->p_parent]];
-                break;
-            }
-        }
+        o_item = [o_outline_dict objectForKey: [NSString
+                   stringWithFormat: @"%p", p_item->p_parent]];
     }
 
     /* We need to collapse the node first, since OSX refuses to recursively
@@ -1445,7 +1371,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 {
     int i_mode = 0, i_type;
     intf_thread_t *p_intf = VLCIntf;
-    playlist_view_t *p_view;
 
     playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                        FIND_ANYWHERE );
@@ -1462,8 +1387,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         return;
     }
 
-    p_view = playlist_ViewFind( p_playlist, i_current_view );
-
     if( o_tc_sortColumn == o_tc )
     {
         b_isSortDescending = !b_isSortDescending;
@@ -1492,7 +1415,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
 
     vlc_mutex_lock( &p_playlist->object_lock );
-    playlist_RecursiveNodeSort( p_playlist, p_view->p_root, i_mode, i_type );
+    playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
     vlc_mutex_unlock( &p_playlist->object_lock );
 
     vlc_object_release( p_playlist );
@@ -1552,15 +1475,14 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         return;
     }
 
-    playlist_item_t * p_item = playlist_NodeCreate( p_playlist, VIEW_CATEGORY, 
-        _("Empty Folder"), p_playlist->p_general );
+    playlist_item_t * p_item = playlist_NodeCreate( p_playlist,
+                                _("Empty Folder"), p_playlist->p_local_category );
 
     if(! p_item )
         msg_Warn( VLCIntf, "node creation failed" );
-    
-    playlist_ViewUpdate( p_playlist, VIEW_CATEGORY );
-    
+
     vlc_object_release( p_playlist );
+    [self playlistUpdated];
 }
 
 @end
@@ -1621,7 +1543,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         /* Refuse to move items that are not in the General Node
            (Service Discovery) */
         if( ![self isItem: [o_item pointerValue] inNode:
-                        p_playlist->p_general checkItemExistence: NO])
+                        p_playlist->p_local_category checkItemExistence: NO])
         {
             vlc_object_release(p_playlist);
             return NO;
@@ -1671,7 +1593,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     /* We refuse to drop an item in anything else than a child of the General
        Node. We still accept items that would be root nodes of the outlineview
        however, to allow drop in an empty playlist. */
-    if( !([self isItem: [item pointerValue] inNode: p_playlist->p_general
+    if( !([self isItem: [item pointerValue] inNode: p_playlist->p_local_category
                                     checkItemExistence: NO] || item == nil) )
     {
         vlc_object_release( p_playlist );
@@ -1726,7 +1648,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         /* If the item is to be dropped as root item of the outline, make it a
            child of the General node.
            Else, choose the proposed parent as parent. */
-        if( item == nil ) p_new_parent = p_playlist->p_general;
+        if( item == nil ) p_new_parent = p_playlist->p_local_category;
         else p_new_parent = [item pointerValue];
 
         /* Make sure the proposed parent is a node.
@@ -1743,7 +1665,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             int i_old_index = 0;
 
             p_item = [[o_all_items objectAtIndex:i] pointerValue];
-            p_old_parent = [self parentOfItem: p_item];
+            p_old_parent = p_item->p_parent;
             if( !p_old_parent )
             continue;
             /* We may need the old index later */
@@ -1763,8 +1685,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             vlc_mutex_lock( &p_playlist->object_lock );
             // Acually detach the item from the old position
             if( playlist_NodeRemoveItem( p_playlist, p_item, p_old_parent ) ==
-                VLC_SUCCESS  &&
-                playlist_NodeRemoveParent( p_playlist, p_item, p_old_parent ) ==
                 VLC_SUCCESS )
             {
                 int i_new_index;
@@ -1783,8 +1703,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
                     i_new_index = index + i - i_removed_from_node;
                 }
                 // Reattach the item to the new position
-                playlist_NodeInsert( p_playlist, i_current_view, p_item,
-                                                    p_new_parent, i_new_index );
+                playlist_NodeInsert( p_playlist, p_item, p_new_parent, i_new_index );
             }
             vlc_mutex_unlock( &p_playlist->object_lock );
         }
@@ -1839,7 +1758,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         else
         {
             [self appendNodeArray: o_array inNode: p_node
-                atPos: index inView: i_current_view enqueue: YES];
+                atPos: index enqueue: YES];
         }
         vlc_object_release( p_playlist );
         return YES;
index a52a0d1..8869e8d 100644 (file)
     if(! [self isItemInPlaylist: p_item] ) return;
 
     char *psz_temp;
-    vlc_mutex_lock( &p_item->input.lock );
+    vlc_mutex_lock( &p_item->p_input->lock );
 
     /* fill uri / title / author info */
-    if( p_item->input.psz_uri )
+    if( p_item->p_input->psz_uri )
     {
         [o_uri_txt setStringValue:
-            ([NSString stringWithUTF8String:p_item->input.psz_uri] == nil ) ?
-            [NSString stringWithCString:p_item->input.psz_uri] :
-            [NSString stringWithUTF8String:p_item->input.psz_uri]];
+            ([NSString stringWithUTF8String:p_item->p_input->psz_uri] == nil ) ?
+            [NSString stringWithCString:p_item->p_input->psz_uri] :
+            [NSString stringWithUTF8String:p_item->p_input->psz_uri]];
     }
 
-    if( p_item->input.psz_name )
+    if( p_item->p_input->psz_name )
     {
         [o_title_txt setStringValue:
-            ([NSString stringWithUTF8String:p_item->input.psz_name] == nil ) ?
-            [NSString stringWithCString:p_item->input.psz_name] :
-            [NSString stringWithUTF8String:p_item->input.psz_name]];
+            ([NSString stringWithUTF8String:p_item->p_input->psz_name] == nil ) ?
+            [NSString stringWithCString:p_item->p_input->psz_name] :
+            [NSString stringWithUTF8String:p_item->p_input->psz_name]];
     }
-    vlc_mutex_unlock( &p_item->input.lock );
+    vlc_mutex_unlock( &p_item->p_input->lock );
 
-    psz_temp = vlc_input_item_GetInfo( &p_item->input, _("Meta-information"), _("Artist") );
+    psz_temp = vlc_input_item_GetInfo( p_item->p_input, _("Meta-information"), _("Artist") );
 
     if( psz_temp )
     {
 
 - (void)setMeta: (char *)meta forLabel: (id)theItem
 {
-    char *psz_meta = vlc_input_item_GetInfo( &p_item->input, \
+    char *psz_meta = vlc_input_item_GetInfo( p_item->p_input, \
         _(VLC_META_INFO_CAT), _(meta) );
     if( psz_meta != NULL && *psz_meta)
         [theItem setStringValue: [NSString stringWithUTF8String: psz_meta]];
     {
         /* we can only do that if there's a valid input around */
 
-        vlc_mutex_lock( &p_item->input.p_stats->lock );
+        vlc_mutex_lock( &p_item->p_input->p_stats->lock );
 
         /* input */
         [o_read_bytes_txt setStringValue: [NSString stringWithFormat: \
-            @"%8.0f kB", (float)(p_item->input.p_stats->i_read_bytes)/1000]];
+            @"%8.0f kB", (float)(p_item->p_input->p_stats->i_read_bytes)/1000]];
         [o_input_bitrate_txt setStringValue: [NSString stringWithFormat: \
-            @"%6.0f kb/s", (float)(p_item->input.p_stats->f_input_bitrate)*8000]];
+            @"%6.0f kb/s", (float)(p_item->p_input->p_stats->f_input_bitrate)*8000]];
         [o_demux_bytes_txt setStringValue: [NSString stringWithFormat: \
-            @"%8.0f kB", (float)(p_item->input.p_stats->i_demux_read_bytes)/1000]];
+            @"%8.0f kB", (float)(p_item->p_input->p_stats->i_demux_read_bytes)/1000]];
         [o_demux_bitrate_txt setStringValue: [NSString stringWithFormat: \
-            @"%6.0f kb/s", (float)(p_item->input.p_stats->f_demux_bitrate)*8000]];
+            @"%6.0f kb/s", (float)(p_item->p_input->p_stats->f_demux_bitrate)*8000]];
 
         /* Video */
         [o_video_decoded_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_decoded_video]];
+            p_item->p_input->p_stats->i_decoded_video]];
         [o_displayed_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_displayed_pictures]];
+            p_item->p_input->p_stats->i_displayed_pictures]];
         [o_lost_frames_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_lost_pictures]];
+            p_item->p_input->p_stats->i_lost_pictures]];
 
         /* Sout */
         [o_sent_packets_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_sent_packets]];
+            p_item->p_input->p_stats->i_sent_packets]];
         [o_sent_bytes_txt setStringValue: [NSString stringWithFormat: @"%8.0f kB", \
-            (float)(p_item->input.p_stats->i_sent_bytes)/1000]];
+            (float)(p_item->p_input->p_stats->i_sent_bytes)/1000]];
         [o_sent_bitrate_txt setStringValue: [NSString stringWithFormat: \
-            @"%6.0f kb/s", (float)(p_item->input.p_stats->f_send_bitrate*8)*1000]];
+            @"%6.0f kb/s", (float)(p_item->p_input->p_stats->f_send_bitrate*8)*1000]];
 
         /* Audio */
         [o_audio_decoded_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_decoded_audio]];
+            p_item->p_input->p_stats->i_decoded_audio]];
         [o_played_abuffers_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_played_abuffers]];
+            p_item->p_input->p_stats->i_played_abuffers]];
         [o_lost_abuffers_txt setStringValue: [NSString stringWithFormat: @"%5i", \
-            p_item->input.p_stats->i_lost_abuffers]];
+            p_item->p_input->p_stats->i_lost_abuffers]];
 
-        vlc_mutex_unlock( &p_item->input.p_stats->lock );
+        vlc_mutex_unlock( &p_item->p_input->p_stats->lock );
     }
 }
 
 
     if( [self isItemInPlaylist: p_item] )
     {
-        vlc_mutex_lock( &p_item->input.lock );
+        vlc_mutex_lock( &p_item->p_input->lock );
 
-        p_item->input.psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] );
-        p_item->input.psz_name = strdup( [[o_title_txt stringValue] UTF8String] );
-        vlc_mutex_unlock( &p_item->input.lock );
-        vlc_input_item_AddInfo( &p_item->input, _("Meta-information"), _("Artist"), [[o_author_txt stringValue] UTF8String]);
+        p_item->p_input->psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] );
+        p_item->p_input->psz_name = strdup( [[o_title_txt stringValue] UTF8String] );
+        vlc_mutex_unlock( &p_item->p_input->lock );
+        vlc_input_item_AddInfo( p_item->p_input, _("Meta-information"), _("Artist"), [[o_author_txt stringValue] UTF8String]);
         
         val.b_bool = VLC_TRUE;
         var_Set( p_playlist, "intf-change", val );
@@ -461,37 +461,37 @@ static VLCInfoTreeItem *o_root_item = nil;
         {
             if( self == o_root_item )
             {
-                vlc_mutex_lock( &p_item->input.lock );
+                vlc_mutex_lock( &p_item->p_input->lock );
                 o_children = [[NSMutableArray alloc] initWithCapacity:
-                                                p_item->input.i_categories];
-                for (i = 0 ; i < p_item->input.i_categories ; i++)
+                                                p_item->p_input->i_categories];
+                for (i = 0 ; i < p_item->p_input->i_categories ; i++)
                 {
                     [o_children addObject:[[VLCInfoTreeItem alloc]
                         initWithName: [NSString stringWithUTF8String:
-                            p_item->input.pp_categories[i]->psz_name]
+                            p_item->p_input->pp_categories[i]->psz_name]
                         value: @""
                         ID: i
                         parent: self]];
                 }
-                vlc_mutex_unlock( &p_item->input.lock );
+                vlc_mutex_unlock( &p_item->p_input->lock );
             }
             else if( o_parent == o_root_item )
             {
-                vlc_mutex_lock( &p_item->input.lock );
+                vlc_mutex_lock( &p_item->p_input->lock );
                 o_children = [[NSMutableArray alloc] initWithCapacity:
-                    p_item->input.pp_categories[i_object_id]->i_infos];
+                    p_item->p_input->pp_categories[i_object_id]->i_infos];
 
-                for (i = 0 ; i < p_item->input.pp_categories[i_object_id]->i_infos ; i++)
+                for (i = 0 ; i < p_item->p_input->pp_categories[i_object_id]->i_infos ; i++)
                 {
                     [o_children addObject:[[VLCInfoTreeItem alloc]
                     initWithName: [NSString stringWithUTF8String:
-                            p_item->input.pp_categories[i_object_id]->pp_infos[i]->psz_name]
+                            p_item->p_input->pp_categories[i_object_id]->pp_infos[i]->psz_name]
                         value: [NSString stringWithUTF8String:
-                            p_item->input.pp_categories[i_object_id]->pp_infos[i]->psz_value]
+                            p_item->p_input->pp_categories[i_object_id]->pp_infos[i]->psz_value]
                         ID: i
                         parent: self]];
                 }
-                vlc_mutex_unlock( &p_item->input.lock );
+                vlc_mutex_unlock( &p_item->p_input->lock );
             }
             else
             {
index 8ef0f75..388c02f 100644 (file)
@@ -583,7 +583,7 @@ static VLCWizard *_o_sharedInstance = nil;
                 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
                 while( x != y )
                 {
-                    playlist_item_t *p_item = 
+                    playlist_item_t *p_item =
                         [[o_t2_tbl_plst itemAtRow: 
                             [[o_t2_tbl_plst selectedRowIndexes] 
                             indexGreaterThanOrEqualToIndex: x]] pointerValue];
@@ -591,7 +591,7 @@ static VLCWizard *_o_sharedInstance = nil;
                     if( p_item->i_children <= 0 )
                     {
                         [tempArray addObject: [NSString stringWithUTF8String:
-                        p_item->input.psz_uri]];
+                        p_item->p_input->psz_uri]];
                         stop = NO;
                     }
                     else
@@ -1289,17 +1289,17 @@ static VLCWizard *_o_sharedInstance = nil;
                 NSString *tempString = [NSString stringWithFormat: \
                     @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"), \
                     ( x + 1 ), y];
-                playlist_item_t *p_item = playlist_ItemNew( p_playlist, \
+                input_item_t *p_input = input_ItemNew( p_playlist, \
                     [[[o_userSelections objectForKey:@"pathToStrm"] \
                     objectAtIndex:x] UTF8String], \
                     [tempString UTF8String] );
-                playlist_ItemAddOption( p_item, [[[o_userSelections \
+                vlc_input_item_AddOption( p_input, [[[o_userSelections \
                     objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
 
                 if(! [[o_userSelections objectForKey:@"partExtractFrom"] \
                     isEqualToString:@""] )
                 {
-                    playlist_ItemAddOption( p_item, [[NSString \
+                    vlc_input_item_AddOption( p_input, [[NSString \
                         stringWithFormat: @"start-time=%@", [o_userSelections \
                         objectForKey: @"partExtractFrom"]] UTF8String] );
                 }
@@ -1307,26 +1307,27 @@ static VLCWizard *_o_sharedInstance = nil;
                 if(! [[o_userSelections objectForKey:@"partExtractTo"] \
                     isEqualToString:@""] )
                 {
-                    playlist_ItemAddOption( p_item, [[NSString \
+                    vlc_input_item_AddOption( p_input, [[NSString \
                         stringWithFormat: @"stop-time=%@", [o_userSelections \
                         objectForKey: @"partExtractTo"]] UTF8String] );
                 }
 
-                playlist_ItemAddOption( p_item, [[NSString stringWithFormat: \
+                vlc_input_item_AddOption( p_input, [[NSString stringWithFormat: \
                     @"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \
                     UTF8String] );
 
-                playlist_AddItem( p_playlist, p_item, PLAYLIST_STOP, PLAYLIST_END );
-                
+                playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END );
+
                 if( x == 0 )
-                    /* play the first item and add the others afterwards */ 
+                {
+                    /* play the first item and add the others afterwards */
+                    playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
                     playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+                }
 
                 x += 1;
             }
 
-            playlist_ViewUpdate( p_playlist, VIEW_CATEGORY );
-
             vlc_object_release(p_playlist);
         } else {
             msg_Err( p_intf, "unable to find playlist" );
index b72118c..1951eec 100644 (file)
@@ -176,8 +176,6 @@ SOURCES_skins2 = \
        \
        vars/equalizer.cpp \
        vars/equalizer.hpp \
-       vars/playlist.cpp \
-       vars/playlist.hpp \
        vars/playtree.cpp \
        vars/playtree.hpp \
        vars/time.cpp \
index 9bf80b6..771ec13 100644 (file)
@@ -37,13 +37,13 @@ void CmdAddItem::execute()
     if( m_playNow )
     {
         // Enqueue and play the item
-        playlist_Add( pPlaylist, m_name.c_str(),m_name.c_str(),
-                      PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+        playlist_PlaylistAdd( pPlaylist, m_name.c_str(),m_name.c_str(),
+                              PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
     }
     else
     {
         // Enqueue the item only
-        playlist_Add( pPlaylist, m_name.c_str(), m_name.c_str(),
-                      PLAYLIST_APPEND, PLAYLIST_END );
+        playlist_PlaylistAdd( pPlaylist, m_name.c_str(), m_name.c_str(),
+                              PLAYLIST_APPEND, PLAYLIST_END );
     }
 }
index 617dc56..a598ba8 100644 (file)
@@ -33,18 +33,6 @@ void CmdPlaylistDel::execute()
 }
 
 
-void CmdPlaylistSort::execute()
-{
-    // XXX add the mode and type
-    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
-    if( pPlaylist != NULL )
-    {
-        playlist_Sort( pPlaylist, SORT_TITLE, ORDER_NORMAL );
-    }
-
-}
-
-
 void CmdPlaylistNext::execute()
 {
     playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
@@ -118,7 +106,8 @@ void CmdPlaylistSave::execute()
     {
         // FIXME: when the PLS export will be working, we'll need to remove
         // this hardcoding...
-        playlist_Export( pPlaylist, m_file.c_str(), "export-m3u" );
+        msg_Err( getIntf(), "need to fix playlist save" );
+//        playlist_Export( pPlaylist, m_file.c_str(), "export-m3u" );
     }
 }
 
index e40da63..68aac7d 100644 (file)
@@ -33,10 +33,11 @@ void CmdPlaytreeDel::execute()
 void CmdPlaytreeSort::execute()
 {
     /// \todo Choose sort method/order - Need more commands
+    /// \todo Choose the correct view
     playlist_t *p_playlist = getIntf()->p_sys->p_playlist;
     vlc_mutex_lock( &p_playlist->object_lock );
-    playlist_view_t* p_view = playlist_ViewFind( p_playlist, p_playlist->status.i_view );
-    playlist_RecursiveNodeSort( p_playlist, p_view->p_root , SORT_TITLE, ORDER_NORMAL );
+    playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_onelevel,
+                                SORT_TITLE, ORDER_NORMAL );
     vlc_mutex_unlock( &p_playlist->object_lock );
 
     // Ask for rebuild
index ce08f35..59c5848 100644 (file)
 #include "../src/vlcproc.hpp"
 #include "../utils/var_text.hpp"
 #include "../vars/equalizer.hpp"
-#include "../vars/playlist.hpp"
 #include "../vars/playtree.hpp"
 
 
-void CmdNotifyPlaylist::execute()
-{
-    // Notify the playlist variable
-    Playlist &rVar = VlcProc::instance( getIntf() )->getPlaylistVar();
-    rVar.onChange();
-}
-
 void CmdPlaytreeChanged::execute()
 {
     // Notify  the playtree variable
@@ -43,7 +35,6 @@ void CmdPlaytreeChanged::execute()
     rVar.onChange();
 }
 
-
 void CmdPlaytreeUpdate::execute()
 {
     // Notify  the playtree variable
@@ -53,9 +44,8 @@ void CmdPlaytreeUpdate::execute()
 
 bool CmdPlaytreeUpdate::checkRemove( CmdGeneric *pQueuedCommand ) const
 {
-
+    // We don't use RTTI - Use C-style cast
     CmdPlaytreeUpdate *pUpdateCommand = (CmdPlaytreeUpdate *)(pQueuedCommand);
-    //CmdPlaytreeUpdate *pUpdateCommand = dynamic_cast<CmdPlaytreeUpdate *>(pQueuedCommand);
     if( m_id == pUpdateCommand->m_id )
     {
         return true;
index b09e910..2ba41f6 100644 (file)
@@ -76,12 +76,8 @@ Interpreter::Interpreter( intf_thread_t *pIntf ): SkinObject( pIntf )
     REGISTER_CMD( "playlist.load()", CmdDlgPlaylistLoad )
     REGISTER_CMD( "playlist.save()", CmdDlgPlaylistSave )
     REGISTER_CMD( "playlist.add()", CmdDlgAdd )
-    VarList &rVar = VlcProc::instance( getIntf() )->getPlaylistVar();
-    m_commandMap["playlist.del()"] =
-        CmdGenericPtr( new CmdPlaylistDel( getIntf(), rVar ) );
     REGISTER_CMD( "playlist.next()", CmdPlaylistNext )
     REGISTER_CMD( "playlist.previous()", CmdPlaylistPrevious )
-    REGISTER_CMD( "playlist.sort()", CmdPlaylistSort )
     m_commandMap["playlist.setRandom(true)"] =
         CmdGenericPtr( new CmdPlaylistRandom( getIntf(), true ) );
     m_commandMap["playlist.setRandom(false)"] =
index f3ea0c2..09a6dc7 100644 (file)
@@ -291,12 +291,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         m_pData->m_listLayout.push_back( layout );
         m_curLayer = 0;
     }
-
     else if( rName == "Playlist" )
     {
         RequireDefault( "id" );
         RequireDefault( "font" );
         CheckDefault( "visible", "true" );
+        CheckDefault( "flat", "true" ); // Only difference here
         CheckDefault( "x", "0" );
         CheckDefault( "y", "0" );
         CheckDefault( "width", "0" );
@@ -304,26 +304,33 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         CheckDefault( "lefttop", "lefttop" );
         CheckDefault( "rightbottom", "lefttop" );
         CheckDefault( "bgimage", "none" );
+        CheckDefault( "itemimage", "none" );
+        CheckDefault( "openimage", "none" );
+        CheckDefault( "closedimage", "none" );
         CheckDefault( "fgcolor", "#000000" );
         CheckDefault( "playcolor", "#FF0000" );
         CheckDefault( "bgcolor1", "#FFFFFF" );
         CheckDefault( "bgcolor2", "#FFFFFF" );
         CheckDefault( "selcolor", "#0000FF" );
         CheckDefault( "help", "" );
-
-        m_curListId = uniqueId( attr["id"] );
-        const BuilderData::List listData( m_curListId, atoi( attr["x"] ) +
+        m_curTreeId = uniqueId( attr["id"] );
+        const BuilderData::Tree treeData( m_curTreeId, atoi( attr["x"] ) +
                 m_xOffset, atoi( attr["y"] ) + m_yOffset, attr["visible"],
+                attr["flat"],
                 atoi( attr["width"]), atoi( attr["height"] ),
-                attr["lefttop"], attr["rightbottom"], attr["font"],
-                "playlist", attr["bgimage"], attr["fgcolor"],
-                attr["playcolor"], attr["bgcolor1"], attr["bgcolor2"],
+                attr["lefttop"], attr["rightbottom"],
+                attr["font"], "playtree",
+                attr["bgimage"], attr["itemimage"],
+                attr["openimage"], attr["closedimage"],
+                attr["fgcolor"],
+                attr["playcolor"],
+                attr["bgcolor1"],
+                attr["bgcolor2"],
                 attr["selcolor"], attr["help"],
                 m_curLayer, m_curWindowId, m_curLayoutId );
         m_curLayer++;
-        m_pData->m_listList.push_back( listData );
+        m_pData->m_listTree.push_back( treeData );
     }
-
     else if( rName == "Playtree" )
     {
         RequireDefault( "id" );
@@ -412,12 +419,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         CheckDefault( "help", "" );
 
         string newValue = attr["value"];
-        if( m_curListId != "" )
-        {
-            // Slider associated to a list
-            newValue = "playlist.slider";
-        }
-        else if( m_curTreeId != "" )
+        if( m_curTreeId != "" )
         {
             // Slider associated to a tree
             newValue = "playtree.slider";
@@ -560,11 +562,7 @@ void SkinParser::handleEndElement( const string &rName )
         m_xOffsetList.pop_back();
         m_yOffsetList.pop_back();
     }
-    else if( rName == "Playlist" )
-    {
-        m_curListId = "";
-    }
-    else if( rName == "Playtree" )
+    else if( rName == "Playtree" || rName == "Playlist" )
     {
         m_curTreeId = "";
     }
index 5039661..dccee59 100644 (file)
@@ -308,8 +308,8 @@ static int DemuxOpen( vlc_object_t *p_this )
             if( p_playlist != NULL )
             {
                 // Make sure the item is deleted afterwards
-                p_playlist->pp_items[p_playlist->i_index]->b_autodeletion =
-                    VLC_TRUE;
+                /// \bug does not always work
+                p_playlist->status.p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
                 vlc_object_release( p_playlist );
             }
 
index ec11234..dcd36ed 100644 (file)
@@ -79,11 +79,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
 #define REGISTER_VAR( var, type, name ) \
     var = VariablePtr( new type( getIntf() ) ); \
     pVarManager->registerVar( var, name );
-
-    /* Playlist variables */
-    REGISTER_VAR( m_cPlaylist, Playlist, "playlist" )
-    pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(),
-                              "playlist.slider" );
     REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
     REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
     REGISTER_VAR( m_cVarRepeat, VarBoolImpl, "playlist.isRepeat" )
@@ -415,14 +410,11 @@ int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
     playlist_t *p_playlist = (playlist_t*)pObj;
     pThis->updateStreamName(p_playlist);
 
-    // Create a playlist notify command (for old style playlist)
-    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
     // Create a playtree notify command (for new style playtree)
     CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
 
     // Push the command in the asynchronous command queue
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
-    pQueue->push( CmdGenericPtr( pCmd ) );
     pQueue->push( CmdGenericPtr( pCmdTree ) );
 
     return VLC_SUCCESS;
@@ -460,16 +452,12 @@ int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
     playlist_t *p_playlist = (playlist_t*)pObj;
     pThis->updateStreamName(p_playlist);
 
-    // Create a playlist notify command
-    // TODO: selective update
-    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
     // Create a playtree notify command
     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
                                                          newVal.i_int );
 
     // Push the command in the asynchronous command queue
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
-    pQueue->push( CmdGenericPtr( pCmd ) );
     pQueue->push( CmdGenericPtr( pCmdTree ), true );
 
     return VLC_SUCCESS;
@@ -491,12 +479,8 @@ int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
                                                              p_add );
     ptrTree = CmdGenericPtr( pCmdTree );
 
-    // Create a playlist notify command (for old style playlist)
-    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
-
     // Push the command in the asynchronous command queue
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
-    pQueue->push( CmdGenericPtr( pCmd ) );
     pQueue->push( ptrTree , false );
 
     return VLC_SUCCESS;
@@ -515,20 +499,14 @@ int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
                                                          i_id);
     ptrTree = CmdGenericPtr( pCmdTree );
 
-    // Create a playlist notify command (for old style playlist)
-    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
-
     // Push the command in the asynchronous command queue
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
-    pQueue->push( CmdGenericPtr( pCmd ) );
     pQueue->push( ptrTree , false );
 
     return VLC_SUCCESS;
 }
 
 
-
-
 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
                                vlc_value_t oldVal, vlc_value_t newVal,
                                void *pParam )
@@ -541,10 +519,6 @@ int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
     playlist_t *p_playlist = (playlist_t*)pObj;
     pThis->updateStreamName(p_playlist);
 
-    // Create a playlist notify command (old style playlist)
-    // TODO: selective update
-    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
-    pQueue->push( CmdGenericPtr( pCmd ) );
     // Create two playtree notify commands: one for old item, one for new
     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
                                                          oldVal.i_int );
index 9f0ecea..6008089 100644 (file)
@@ -28,7 +28,6 @@
 #include <set>
 
 #include "../vars/equalizer.hpp"
-#include "../vars/playlist.hpp"
 #include "../vars/playtree.hpp"
 #include "../vars/time.hpp"
 #include "../vars/volume.hpp"
@@ -52,9 +51,6 @@ class VlcProc: public SkinObject
         /// Delete the instance of VlcProc
         static void destroy( intf_thread_t *pIntf );
 
-        /// Getter for the playlist variable
-        Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
-
         /// Getter for the playtree variable
         Playtree &getPlaytreeVar() { return *((Playtree*)m_cPlaytree.get()); }
 
@@ -104,9 +100,7 @@ class VlcProc: public SkinObject
     private:
         /// Timer to call manage() regularly (via doManage())
         OSTimer *m_pTimer;
-        /// Playlist variable
-        VariablePtr m_cPlaylist;
-        /// Playtree variable FIXME
+        /// Playtree variable
         VariablePtr m_cPlaytree;
         VariablePtr m_cVarRandom;
         VariablePtr m_cVarLoop;
diff --git a/modules/gui/skins2/vars/playlist.cpp b/modules/gui/skins2/vars/playlist.cpp
deleted file mode 100644 (file)
index 80d77d7..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*****************************************************************************
- * playlist.cpp
- *****************************************************************************
- * Copyright (C) 2003 the VideoLAN team
- * $Id$
- *
- * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <vlc/vlc.h>
-
-#include "playlist.hpp"
-#include "../utils/ustring.hpp"
-
-Playlist::Playlist( intf_thread_t *pIntf ): VarList( pIntf )
-{
-    // Get the playlist VLC object
-    m_pPlaylist = pIntf->p_sys->p_playlist;
-
-    buildList();
-}
-
-
-Playlist::~Playlist()
-{
-}
-
-
-void Playlist::delSelected()
-{
-    // Remove the items from the VLC playlist
-    int index = 0;
-    ConstIterator it;
-    for( it = begin(); it != end(); it++ )
-    {
-        if( (*it).m_selected )
-        {
-            playlist_item_t *p_item = playlist_LockItemGetByPos( m_pPlaylist,
-                                                                 index );
-            playlist_LockDelete( m_pPlaylist, p_item->input.i_id );
-        }
-        else
-        {
-            index++;
-        }
-    }
-
-    notify();
-}
-
-
-void Playlist::action( Elem_t *pItem )
-{
-    // Find the index of the item
-    int index = 0;
-    ConstIterator it;
-    for( it = begin(); it != end(); it++ )
-    {
-        if( &*it == pItem ) break;
-        index++;
-    }
-    // Item found ?
-    if( index < size() )
-    {
-        playlist_Goto( m_pPlaylist, index );
-    }
-}
-
-
-void Playlist::onChange()
-{
-    buildList();
-    notify();
-}
-
-
-void Playlist::buildList()
-{
-    clear();
-
-    vlc_mutex_lock( &m_pPlaylist->object_lock );
-    for( int i = 0; i < m_pPlaylist->i_size; i++ )
-    {
-        // Get the name of the playlist item
-        UString *pName =
-            new UString( getIntf(), m_pPlaylist->pp_items[i]->input.psz_name );
-        // Is it the played stream ?
-        bool playing = (i == m_pPlaylist->i_index );
-        // Add the item in the list
-        m_list.push_back( Elem_t( UStringPtr( pName ), false, playing ) );
-    }
-    vlc_mutex_unlock( &m_pPlaylist->object_lock );
-}
-
diff --git a/modules/gui/skins2/vars/playlist.hpp b/modules/gui/skins2/vars/playlist.hpp
deleted file mode 100644 (file)
index 693f1c9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************************
- * playlist.hpp
- *****************************************************************************
- * Copyright (C) 2003 the VideoLAN team
- * $Id$
- *
- * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef PLAYLIST_HPP
-#define PLAYLIST_HPP
-
-#include "../utils/var_list.hpp"
-
-/// Variable for VLC playlist
-class Playlist: public VarList
-{
-    public:
-        Playlist( intf_thread_t *pIntf );
-        virtual ~Playlist();
-
-        /// Remove the selected elements from the list
-        virtual void delSelected();
-
-        /// Execute the action associated to this item
-        virtual void action( Elem_t *pItem );
-
-        /// Function called to notify playlist changes
-        void onChange();
-
-    private:
-        /// VLC playlist object
-        playlist_t *m_pPlaylist;
-
-        /// Build the list from the VLC playlist
-        void buildList();
-};
-
-
-#endif
index 944a2e7..bf12c75 100644 (file)
@@ -80,8 +80,8 @@ void Playtree::delSelected()
             playlist_item_t *p_item = (playlist_item_t *)(it->m_pData);
             if( p_item->i_children == -1 )
             {
-                playlist_Delete( getIntf()->p_sys->p_playlist,
-                                     p_item->input.i_id );
+                playlist_DeleteFromItemId( getIntf()->p_sys->p_playlist,
+                                           p_item->i_id );
                 it2 = getNextVisibleItem( it ) ;
                 it->parent()->removeChild( it );
                 it = it2;
@@ -107,21 +107,21 @@ void Playtree::action( VarTree *pItem )
 {
     vlc_mutex_lock( &m_pPlaylist->object_lock );
     VarTree::Iterator it;
-    if( pItem->size() )
+
+    playlist_item_t *p_item = (playlist_item_t *)pItem->m_pData;
+    playlist_item_t *p_parent = p_item;
+    while( p_parent )
+    {
+        if( p_parent == m_pPlaylist->p_root_category )
+            break;
+        p_parent = p_parent->p_parent;
+    }
+
+    if( p_parent )
     {
-        it = pItem->begin();
-        while( it->size() ) it = it->begin();
+        playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, 1242,
+                          p_parent, p_item );
     }
-    playlist_Control( m_pPlaylist,
-                      PLAYLIST_VIEWPLAY,
-                      m_pPlaylist->status.i_view,
-                      pItem->size()
-                          ? (playlist_item_t *)pItem->m_pData
-                          : (playlist_item_t *)pItem->parent()->m_pData,
-                      pItem->size()
-                          ? (playlist_item_t *)it->m_pData
-                          : (playlist_item_t *)pItem->m_pData
-                    );
     vlc_mutex_unlock( &m_pPlaylist->object_lock );
 }
 
@@ -142,7 +142,7 @@ void Playtree::onUpdateItem( int id )
     {
         // Update the item
         playlist_item_t* pNode = (playlist_item_t*)(it->m_pData);
-        UString *pName = new UString( getIntf(), pNode->input.psz_name );
+        UString *pName = new UString( getIntf(), pNode->p_input->psz_name );
         it->m_cString = UStringPtr( pName );
         it->m_playing = m_pPlaylist->status.p_item == pNode;
         if( it->m_playing ) descr.b_active_item = true;
@@ -185,7 +185,8 @@ void Playtree::onAppend( playlist_add_t *p_add )
             playlist_item_t *p_item = playlist_ItemGetById(
                                         m_pPlaylist, p_add->i_item );
             if( !p_item ) return;
-            UString *pName = new UString( getIntf(), p_item->input.psz_name );
+            UString *pName = new UString( getIntf(),
+                                          p_item->p_input->psz_name );
             node->add( p_add->i_item, UStringPtr( pName ),
                       false,false, false, p_item->i_flags & PLAYLIST_RO_FLAG,
                       p_item );
@@ -204,8 +205,8 @@ void Playtree::buildNode( playlist_item_t *pNode, VarTree &rTree )
     for( int i = 0; i < pNode->i_children; i++ )
     {
         UString *pName = new UString( getIntf(),
-                                      pNode->pp_children[i]->input.psz_name );
-        rTree.add( pNode->pp_children[i]->input.i_id, UStringPtr( pName ),
+                                   pNode->pp_children[i]->p_input->psz_name );
+        rTree.add( pNode->pp_children[i]->p_input->i_id, UStringPtr( pName ),
                      false,
                      m_pPlaylist->status.p_item == pNode->pp_children[i],
                      false, pNode->pp_children[i]->i_flags & PLAYLIST_RO_FLAG,
@@ -224,17 +225,16 @@ void Playtree::buildTree()
 
     i_items_to_append = 0;
 
-    playlist_view_t *p_view;
-    p_view = playlist_ViewFind( m_pPlaylist, VIEW_CATEGORY );
-    /// \todo let the user chose the view
-
     clear();
 
+    /* TODO: Let user choose view - Stick with category ATM */
+
     /* Set the root's name */
-    UString *pName = new UString( getIntf(), p_view->p_root->input.psz_name );
+    UString *pName = new UString( getIntf(),
+                             m_pPlaylist->p_root_category->p_input->psz_name );
     m_cString = UStringPtr( pName );
 
-    buildNode( p_view->p_root, *this );
+    buildNode( m_pPlaylist->p_root_category, *this );
 
     vlc_mutex_unlock( &m_pPlaylist->object_lock );
 //  What is it ?
index 3f8aaa9..b9f9e04 100644 (file)
@@ -440,12 +440,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
         {
             char *psz_utf8 = wxFromLocale( paths[i] );
             if( event.GetInt() )
-                playlist_Add( p_playlist, psz_utf8, psz_utf8,
+                playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
                               PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
                               (i ? PLAYLIST_PREPARSE : 0 ),
                               PLAYLIST_END );
             else
-                playlist_Add( p_playlist, psz_utf8, psz_utf8,
+                playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
                               PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
             wxLocaleFree( psz_utf8 );
         }
@@ -471,7 +471,7 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
     {
         wxString path = p_dir_dialog->GetPath();
         char *psz_utf8 = wxFromLocale( path );
-        playlist_Add( p_playlist, psz_utf8, psz_utf8,
+        playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
                       PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
                       PLAYLIST_END );
         wxLocaleFree( psz_utf8 );
index 16be914..7260265 100644 (file)
@@ -98,6 +98,7 @@ MetaDataPanel::MetaDataPanel( intf_thread_t *_p_intf,
     ADD_META( VLC_META_LANGUAGE, language_text );
     ADD_META( VLC_META_NOW_PLAYING, nowplaying_text );
     ADD_META( VLC_META_PUBLISHER, publisher_text );
+    ADD_META( VLC_META_SETTING, setting_text );
 
     meta_sizer->Layout();
 
@@ -120,8 +121,7 @@ void MetaDataPanel::Update( input_item_t *p_item )
     name_text->SetValue( wxU( p_item->psz_name ) );
 
 #define UPDATE_META( meta, widget ) {                                       \
-    char *psz_meta = vlc_input_item_GetInfo( p_item, _(VLC_META_INFO_CAT),  \
-                                            _(meta) );                      \
+    char *psz_meta = p_item->p_meta->psz_##meta;                            \
     if( psz_meta != NULL && *psz_meta)                                      \
     {                                                                       \
         widget->SetLabel( wxU( psz_meta ) );                                \
@@ -129,17 +129,18 @@ void MetaDataPanel::Update( input_item_t *p_item )
     else { widget->SetLabel( wxU( "-" ) ); }                                \
     }
 
-    UPDATE_META( VLC_META_ARTIST, artist_text );
-    UPDATE_META( VLC_META_GENRE, genre_text );
-    UPDATE_META( VLC_META_COPYRIGHT, copyright_text );
-    UPDATE_META( VLC_META_COLLECTION, collection_text );
-    UPDATE_META( VLC_META_SEQ_NUM, seqnum_text );
-    UPDATE_META( VLC_META_DESCRIPTION, description_text );
-    UPDATE_META( VLC_META_RATING, rating_text );
-    UPDATE_META( VLC_META_DATE, date_text );
-    UPDATE_META( VLC_META_LANGUAGE, language_text );
-    UPDATE_META( VLC_META_NOW_PLAYING, nowplaying_text );
-    UPDATE_META( VLC_META_PUBLISHER, publisher_text );
+    UPDATE_META( artist, artist_text );
+    UPDATE_META( genre, genre_text );
+    UPDATE_META( copyright, copyright_text );
+    UPDATE_META( album, collection_text );
+    UPDATE_META( tracknum, seqnum_text );
+    UPDATE_META( description, description_text );
+    UPDATE_META( rating, rating_text );
+    UPDATE_META( date, date_text );
+    UPDATE_META( language, language_text );
+    UPDATE_META( nowplaying, nowplaying_text );
+    UPDATE_META( publisher, publisher_text );
+    UPDATE_META( setting, setting_text );
 
 #undef UPDATE_META
 }
index 7a92df0..01cc2ea 100644 (file)
@@ -70,7 +70,7 @@ ItemInfoDialog::ItemInfoDialog( intf_thread_t *_p_intf,
 
     /* Create the standard info panel */
     info_panel = new MetaDataPanel(p_intf, panel, true );
-    info_panel->Update( &(p_item->input) );
+    info_panel->Update( p_item->p_input );
     /* Separation */
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
 
@@ -107,10 +107,10 @@ ItemInfoDialog::~ItemInfoDialog()
  *****************************************************************************/
 void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 {
-    vlc_mutex_lock( &p_item->input.lock );
-    p_item->input.psz_name = info_panel->GetName();
-    p_item->input.psz_uri = info_panel->GetURI();
-    vlc_mutex_unlock( &p_item->input.lock );
+    vlc_mutex_lock( &p_item->p_input->lock );
+    p_item->p_input->psz_name = info_panel->GetName();
+    p_item->p_input->psz_uri = info_panel->GetURI();
+    vlc_mutex_unlock( &p_item->p_input->lock );
     EndModal( wxID_OK );
 }
 
index d6a48cc..d8c9a17 100644 (file)
@@ -1165,11 +1165,11 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     for( int i = 0; i < (int)mrl.GetCount(); i++ )
     {
         vlc_bool_t b_start = !i && i_open_arg;
-        playlist_item_t *p_item;
+        input_item_t *p_input;
         char *psz_utf8;
 
         psz_utf8 = wxFromLocale( mrl[i] );
-        p_item = playlist_ItemNew( p_intf, psz_utf8, psz_utf8 );
+        p_input = input_ItemNew( p_intf, psz_utf8, psz_utf8 );
         wxLocaleFree( psz_utf8 );
 
         /* Insert options */
@@ -1177,7 +1177,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
                ((const char *)mrl[i + 1].mb_str())[0] == ':' )
         {
             psz_utf8 = wxFromLocale( mrl[i + 1] );
-            playlist_ItemAddOption( p_item, psz_utf8 );
+            vlc_input_item_AddOption( p_input, psz_utf8 );
             wxLocaleFree( psz_utf8 );
             i++;
         }
@@ -1188,7 +1188,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
             {
                 psz_utf8 = wxFromLocale( subsfile_mrl[j] );
-                playlist_ItemAddOption( p_item, psz_utf8 );
+                vlc_input_item_AddOption( p_input, psz_utf8 );
                 wxLocaleFree( psz_utf8 );
             }
         }
@@ -1199,24 +1199,24 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
             {
                 psz_utf8 = wxFromLocale( sout_mrl[j] );
-                playlist_ItemAddOption( p_item, psz_utf8 );
+                vlc_input_item_AddOption( p_input, psz_utf8 );
                 wxLocaleFree( psz_utf8 );
             }
         }
 
-
         if( b_start )
         {
-            playlist_AddItem( p_playlist, p_item,
-                              PLAYLIST_APPEND,
-                              PLAYLIST_END );
-            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+            playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_APPEND,
+                                       PLAYLIST_END );
+            msg_Err( p_playlist, "Item start not implemented" );
+            // FIXME: Play only within the playlist node
+            //playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
         }
         else
         {
-            playlist_AddItem( p_playlist, p_item,
-                              PLAYLIST_APPEND|PLAYLIST_PREPARSE,
-                              PLAYLIST_END );
+            playlist_PlaylistAddInput( p_playlist, p_input,
+                                       PLAYLIST_APPEND|PLAYLIST_PREPARSE,
+                                       PLAYLIST_END );
         }
     }
 
index a1162bd..8802d70 100644 (file)
@@ -102,6 +102,7 @@ enum
     Search_Event,
 
     /* controls */
+    Source_Event,
     TreeCtrl_Event,
 
     Browse_Event,  /* For export playlist */
@@ -114,6 +115,7 @@ enum
     MenuDummy_Event = wxID_HIGHEST + 999,
 
     FirstView_Event = wxID_HIGHEST + 1000,
+    CategoryView_Event, OneLevelView_Event,
     LastView_Event = wxID_HIGHEST + 1100,
 
     FirstSD_Event = wxID_HIGHEST + 2000,
@@ -156,6 +158,8 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
     EVT_MENU( PopupInfo_Event, Playlist::OnPopupInfo)
     EVT_MENU( PopupAddNode_Event, Playlist::OnPopupAddNode)
 
+    /* Source selector */
+    EVT_LIST_ITEM_SELECTED( Source_Event, Playlist::OnSourceSelected )
     /* Tree control events */
     EVT_TREE_ITEM_ACTIVATED( TreeCtrl_Event, Playlist::OnActivateItem )
     EVT_TREE_KEY_DOWN( -1, Playlist::OnKeyDown )
@@ -187,9 +191,11 @@ class PlaylistItem : public wxTreeItemData
 public:
     PlaylistItem( playlist_item_t *p_item ) : wxTreeItemData()
     {
-        i_id = p_item->input.i_id;
+        i_id = p_item->i_id;
+        i_input_id = p_item->p_input->i_id;
     }
 protected:
+    int i_input_id;
     int i_id;
 friend class Playlist;
 friend class PlaylistFileDropTarget;
@@ -220,8 +226,9 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     p_view_menu = NULL;
     p_sd_menu = SDMenu();
 
-    i_current_view = VIEW_CATEGORY;
-    b_changed_view = VLC_FALSE;
+//    i_current_view = VIEW_ONELEVEL;
+    p_current_viewroot = p_playlist->p_root_onelevel;
+    p_current_treeroot = p_playlist->p_local_onelevel;
 
     i_title_sorted = 0;
     i_group_sorted = 0;
@@ -331,6 +338,11 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     search_button->SetDefault();
     toolbar->Realize();
 
+    /* Create teh source selector */
+    source_sel = new wxListCtrl( playlist_panel, Source_Event,
+                                wxDefaultPosition, wxDefaultSize,
+                                wxLC_AUTOARRANGE|wxLC_SINGLE_SEL );
+
     /* Create the tree */
     treectrl = new wxTreeCtrl( playlist_panel, TreeCtrl_Event,
                                wxDefaultPosition, wxDefaultSize,
@@ -362,7 +374,8 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     font.SetPointSize(9);
     treectrl->SetFont( font );
 
-    wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
+    wxBoxSizer *panel_sizer = new wxBoxSizer( wxHORIZONTAL );
+    panel_sizer->Add( source_sel, 0, wxALL | wxEXPAND, 5 );
     panel_sizer->Add( treectrl, 1, wxEXPAND | wxALL, 5 );
     panel_sizer->Layout();
 
@@ -380,9 +393,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
 #endif
 
     i_saved_id = -1;
-
-
-    /* We want to be noticed of playlist changes */
+    i_saved_input_id = -1;
 
     /* Some global changes happened -> Rebuild all */
     var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
@@ -443,7 +454,7 @@ void Playlist::UpdateNode( playlist_item_t *p_node, wxTreeItemId node )
             child = treectrl->GetNextChild( node, cookie );
         }
     }
-    treectrl->SetItemImage( node, p_node->input.i_type );
+    treectrl->SetItemImage( node, p_node->p_input->i_type );
 
 }
 
@@ -451,9 +462,9 @@ void Playlist::UpdateNode( playlist_item_t *p_node, wxTreeItemId node )
 void Playlist::CreateNode( playlist_item_t *p_node, wxTreeItemId parent )
 {
     wxTreeItemId node =
-        treectrl->AppendItem( parent, wxL2U( p_node->input.psz_name ),
+        treectrl->AppendItem( parent, wxL2U( p_node->p_input->psz_name ),
                               -1,-1, new PlaylistItem( p_node ) );
-    treectrl->SetItemImage( node, p_node->input.i_type );
+    treectrl->SetItemImage( node, p_node->p_input->i_type );
 
     UpdateNodeChildren( p_node, node );
 }
@@ -462,18 +473,20 @@ void Playlist::CreateNode( playlist_item_t *p_node, wxTreeItemId parent )
 void Playlist::UpdateNodeChildren( playlist_item_t *p_node,
                                    wxTreeItemId node )
 {
-
     for( int i = 0; i< p_node->i_children ; i++ )
     {
         /* Append the item */
         if( p_node->pp_children[i]->i_children == -1 )
         {
-            wxTreeItemId item =
-                treectrl->AppendItem( node,
-                    wxL2U( p_node->pp_children[i]->input.psz_name ), -1,-1,
+            if( !(p_node->pp_children[i]->i_flags & PLAYLIST_DBL_FLAG) )
+            {
+                wxTreeItemId item =
+                    treectrl->AppendItem( node,
+                    wxL2U( p_node->pp_children[i]->p_input->psz_name ), -1,-1,
                            new PlaylistItem( p_node->pp_children[i]) );
 
-            UpdateTreeItem( item );
+                UpdateTreeItem( item );
+            }
         }
         else
         {
@@ -485,12 +498,12 @@ void Playlist::UpdateNodeChildren( playlist_item_t *p_node,
 /* Update an item in the tree */
 void Playlist::UpdateTreeItem( wxTreeItemId item )
 {
+    LockPlaylist( p_intf->p_sys, p_playlist );
     if( ! item.IsOk() ) return;
 
     wxTreeItemData *p_data = treectrl->GetItemData( item );
     if( !p_data ) return;
 
-    LockPlaylist( p_intf->p_sys, p_playlist );
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
                                           ((PlaylistItem *)p_data)->i_id );
     if( !p_item )
@@ -501,16 +514,19 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
 
     wxString msg;
     wxString duration = wxU( "" );
-    char *psz_author = vlc_input_item_GetInfo( &p_item->input,
-                                               _(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );
-    if( !psz_author )
+
+    char *psz_author;
+    if( p_item->p_input->p_meta )
     {
-        UnlockPlaylist( p_intf->p_sys, p_playlist );
-        return;
+        psz_author= p_item->p_input->p_meta->psz_artist ?
+                        strdup( p_item->p_input->p_meta->psz_artist ) :
+                        strdup("");
     }
+    else
+        psz_author = strdup( "" );
 
     char psz_duration[MSTRTIME_MAX_SIZE];
-    mtime_t dur = p_item->input.i_duration;
+    mtime_t dur = p_item->p_input->i_duration;
 
     if( dur != -1 )
     {
@@ -519,18 +535,18 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
                          wxU( " )" ) );
     }
 
-    if( !strcmp( psz_author, "" ) || p_item->input.b_fixed_name == VLC_TRUE )
+    if( !strcmp( psz_author, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
     {
-        msg = wxString( wxU( p_item->input.psz_name ) ) + duration;
+        msg = wxString( wxU( p_item->p_input->psz_name ) ) + duration;
     }
     else
     {
         msg = wxString(wxU( psz_author )) + wxT(" - ") +
-              wxString(wxU(p_item->input.psz_name)) + duration;
+              wxString(wxU(p_item->p_input->psz_name)) + duration;
     }
     free( psz_author );
     treectrl->SetItemText( item , msg );
-    treectrl->SetItemImage( item, p_item->input.i_type );
+    treectrl->SetItemImage( item, p_item->p_input->i_type );
 
     if( p_playlist->status.p_item == p_item )
     {
@@ -562,21 +578,20 @@ void Playlist::AppendItem( wxCommandEvent& event )
     /* No need to do anything if the playlist is going to be rebuilt */
     if( b_need_update ) return;
 
-    if( p_add->i_view != i_current_view ) goto update;
-
     node = FindItem( treectrl->GetRootItem(), p_add->i_node );
     if( !node.IsOk() ) goto update;
 
     p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
     if( !p_item ) goto update;
+    if( (p_item->i_flags & PLAYLIST_DBL_FLAG ) ) goto update;
 
     item = FindItem( treectrl->GetRootItem(), p_add->i_item );
     if( item.IsOk() ) goto update;
 
     item = treectrl->AppendItem( node,
-                                 wxL2U( p_item->input.psz_name ), -1,-1,
+                                 wxL2U( p_item->p_input->psz_name ), -1,-1,
                                  new PlaylistItem( p_item ) );
-    treectrl->SetItemImage( item, p_item->input.i_type );
+    treectrl->SetItemImage( item, p_item->p_input->i_type );
 
     if( item.IsOk() && p_item->i_children == -1 )
     {
@@ -585,26 +600,8 @@ void Playlist::AppendItem( wxCommandEvent& event )
 
 update:
     int i_count = CountItems( treectrl->GetRootItem());
-    if( i_count != p_playlist->i_size )
-    {
-        statusbar->SetStatusText( wxString::Format( wxU(_(
-                                  "%i items in playlist (%i not shown)")),
-                                  p_playlist->i_size,
-                                  p_playlist->i_size - i_count ) );
-        if( !b_changed_view )
-        {
-            i_current_view = VIEW_CATEGORY;
-            b_changed_view = VLC_TRUE;
-            b_need_update = VLC_TRUE;
-        }
-    }
-    else
-    {
-        statusbar->SetStatusText( wxString::Format( wxU(_(
-                                  "%i items in playlist")),
-                                  p_playlist->i_size ), 0 );
-    }
-
+    statusbar->SetStatusText( wxString::Format( wxU(_(
+                                  "%i items in playlist" ) ), i_count ) );
     return;
 }
 
@@ -612,9 +609,7 @@ update:
 void Playlist::UpdateItem( int i )
 {
     if( i < 0 ) return; /* Sanity check */
-
-    wxTreeItemId item = FindItem( treectrl->GetRootItem(), i );
-
+    wxTreeItemId item = FindItemByInput( treectrl->GetRootItem(), i );
     if( item.IsOk() )
     {
         UpdateTreeItem( item );
@@ -626,6 +621,11 @@ void Playlist::RemoveItem( int i )
     if( i <= 0 ) return; /* Sanity check */
     if( i == i_saved_id ) i_saved_id = -1;
 
+    /* Hack: always invalidate input item cache */
+    i_saved_input_id = -1;
+
+    /// \todo Check if it is in the source selector */
+
     wxTreeItemId item = FindItem( treectrl->GetRootItem(), i );
 
     if( item.IsOk() )
@@ -641,6 +641,16 @@ void Playlist::RemoveItem( int i )
 
 /* Find a wxItem from a playlist id */
 wxTreeItemId Playlist::FindItem( wxTreeItemId root, int i_id )
+{
+    return FindItemInner( root, i_id, false );
+}
+
+wxTreeItemId Playlist::FindItemByInput( wxTreeItemId root, int i_input_id )
+{
+    return FindItemInner( root, i_input_id, true );
+}
+
+wxTreeItemId Playlist::FindItemInner( wxTreeItemId root, int i_id, bool b_byinput )
 {
     wxTreeItemIdValue cookie;
     PlaylistItem *p_wxcurrent;
@@ -652,51 +662,70 @@ wxTreeItemId Playlist::FindItem( wxTreeItemId root, int i_id )
 
     if( i_id < 0 )
     {
-        wxTreeItemId dummy;
-        return dummy;
+        wxTreeItemId dummy; dummy.Unset(); return dummy;
     }
-    if( i_saved_id == i_id )
-    {
+    if( b_byinput && i_saved_input_id == i_id )
+        return saved_input_tree_item;
+    if( !b_byinput && i_saved_id == i_id)
         return saved_tree_item;
-    }
 
     if( !p_wxcurrent )
     {
-        wxTreeItemId dummy;
-        return dummy;
+        wxTreeItemId dummy; dummy.Unset(); return dummy;
     }
 
-    if( p_wxcurrent->i_id == i_id )
+    if( !b_byinput && p_wxcurrent->i_id == i_id  )
     {
         i_saved_id = i_id;
         saved_tree_item = root;
         return root;
     }
+    if( b_byinput && p_wxcurrent->i_input_id == i_id )
+    {
+        i_saved_input_id = i_id;
+        saved_input_tree_item = root;
+        return root;
+    }
 
     while( item.IsOk() )
     {
         p_wxcurrent = (PlaylistItem *)treectrl->GetItemData( item );
-        if( p_wxcurrent->i_id == i_id )
+        if( !b_byinput && p_wxcurrent->i_id == i_id )
         {
             i_saved_id = i_id;
             saved_tree_item = item;
             return item;
         }
+        else if( b_byinput && p_wxcurrent->i_input_id == i_id )
+        {
+            i_saved_input_id = i_id;
+            saved_input_tree_item = item;
+            return item;
+        }
         if( treectrl->ItemHasChildren( item ) )
         {
-            wxTreeItemId search = FindItem( item, i_id );
+            wxTreeItemId search = FindItemInner( item, i_id, b_byinput );
             if( search.IsOk() )
             {
-                i_saved_id = i_id;
-                saved_tree_item = search;
-                return search;
+                if( !b_byinput )
+                {
+                    i_saved_id = i_id;
+                    saved_tree_item = search;
+                    return search;
+                }
+                else
+                {
+                    i_saved_input_id = i_id;
+                    saved_input_tree_item = search;
+                    return search;
+
+                }
             }
         }
         item = treectrl->GetNextChild( root, cookie );
     }
     /* Not found */
-    wxTreeItemId dummy;
-    return dummy;
+    wxTreeItemId dummy; dummy.Unset(); return dummy;
 }
 
 int Playlist::CountItems( wxTreeItemId root )
@@ -759,7 +788,7 @@ wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string
         item = treectrl->GetNextChild( root, cookie);
     }
     /* Not found */
-    wxTreeItemId dummy;
+    wxTreeItemId dummy; dummy.Unset();
     return dummy;
 }
 
@@ -768,8 +797,6 @@ wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string
  **********************************************************************/
 void Playlist::Rebuild( vlc_bool_t b_root )
 {
-    playlist_view_t *p_view;
-
     i_items_to_append = 0;
 
     /* We can remove the callbacks before locking, anyway, we won't
@@ -785,39 +812,36 @@ void Playlist::Rebuild( vlc_bool_t b_root )
         /* ...and rebuild it */
         LockPlaylist( p_intf->p_sys, p_playlist );
     }
+    /* Invalidate cache */
     i_saved_id = -1;
+    i_saved_input_id = -1;
 
-    p_view = playlist_ViewFind( p_playlist, i_current_view ); /* FIXME */
+    /* Rebuild the list */
+    source_sel->ClearAll();
+    for( int i = 0 ; i< p_current_viewroot->i_children ; i++ )
+    {
+        source_sel->InsertItem( i,
+               wxL2U( p_current_viewroot->pp_children[i]->p_input->psz_name) );
+        source_sel->SetItemData( i,
+                        p_current_viewroot->pp_children[i]->i_id );
+        if( p_current_viewroot->pp_children[i] == p_current_treeroot )
+            source_sel->Select( i );
+    }
 
     /* HACK we should really get new*/
     treectrl->DeleteAllItems();
     treectrl->AddRoot( wxU(_("root" )), -1, -1,
-                         new PlaylistItem( p_view->p_root) );
+                         new PlaylistItem( p_current_treeroot ) );
 
     wxTreeItemId root = treectrl->GetRootItem();
-    UpdateNode( p_view->p_root, root );
+    //UpdateNode( p_current_treeroot, root );
+    //CreateNode( p_current_treeroot, root );
+    UpdateNodeChildren( p_current_treeroot, root );
 
     int i_count = CountItems( treectrl->GetRootItem() );
 
-    if( i_count < p_playlist->i_size && !b_changed_view )
-    {
-        i_current_view = VIEW_CATEGORY;
-        b_changed_view = VLC_TRUE;
-        Rebuild( VLC_FALSE );
-    }
-    else if( i_count != p_playlist->i_size )
-    {
-        statusbar->SetStatusText( wxString::Format( wxU(_(
-                                  "%i items in playlist (%i not shown)")),
-                                  p_playlist->i_size,
-                                  p_playlist->i_size - i_count ) );
-    }
-    else
-    {
-        statusbar->SetStatusText( wxString::Format( wxU(_(
-                                  "%i items in playlist")),
-                                  p_playlist->i_size ), 0 );
-    }
+    statusbar->SetStatusText( wxString::Format( wxU(_(
+                              "%i items in playlist")), i_count ), 0 );
 
     if( b_root )
     {
@@ -832,8 +856,6 @@ void Playlist::Rebuild( vlc_bool_t b_root )
     }
 }
 
-
-
 void Playlist::ShowPlaylist( bool show )
 {
     if( show ) Rebuild( VLC_TRUE );
@@ -876,16 +898,16 @@ void Playlist::DeleteTreeItem( wxTreeItemId item )
        return;
    }
 
-   if( p_item->i_children == -1 ) DeleteItem( p_item->input.i_id );
+   if( p_item->i_children == -1 ) DeleteItem( p_item->i_id );
    else DeleteNode( p_item );
 
-   RemoveItem( p_item->input.i_id );
+   RemoveItem( p_item->i_id );
    UnlockPlaylist( p_intf->p_sys, p_playlist );
 }
 
 void Playlist::DeleteItem( int item_id )
 {
-    playlist_Delete( p_playlist, item_id );
+    playlist_DeleteFromItemId( p_playlist, item_id );
 }
 
 void Playlist::DeleteNode( playlist_item_t *p_item )
@@ -937,8 +959,10 @@ void Playlist::OnSave( wxCommandEvent& WXUNUSED(event) )
     {
         if( dialog.GetPath().mb_str() )
         {
-            playlist_Export( p_playlist, dialog.GetPath().mb_str(),
-                             formats[dialog.GetFilterIndex()].psz_module );
+              abort();
+//            playlist_Export( p_playlist, dialog.GetPath().mb_str(),
+//                             /* ROOT */
+//                             formats[dialog.GetFilterIndex()].psz_module );
         }
     }
 
@@ -1010,28 +1034,16 @@ void Playlist::OnSort( wxCommandEvent& event )
 void Playlist::OnSearch( wxCommandEvent& WXUNUSED(event) )
 {
     wxString search_string = search_text->GetValue();
+    PlaylistItem *p_wxroot;
+    p_wxroot = (PlaylistItem *)treectrl->GetItemData( treectrl->GetRootItem() );
+    playlist_item_t *p_root = playlist_ItemGetById( p_playlist, p_wxroot->i_id );
 
-    vlc_bool_t pb_found = VLC_FALSE;
-
-    wxTreeItemId found =
-     FindItemByName( treectrl->GetRootItem(), search_string,
-                     search_current, &pb_found );
-
-    if( !found.IsOk() )
-    {
-        wxTreeItemId dummy;
-        search_current = dummy;
-        found =  FindItemByName( treectrl->GetRootItem(), search_string,
-                                 search_current, &pb_found );
-    }
+    if( !p_root ) abort();
+    char *psz_name = wxFromLocale( search_string );
+    playlist_LiveSearchUpdate( p_playlist, p_root, psz_name );
+    Rebuild( VLC_TRUE );
 
-    if( found.IsOk() )
-    {
-