]> git.sesse.net Git - vlc/commitdiff
* Remove some unneeded complexity in playlist and directory
authorClément Stenac <zorglub@videolan.org>
Sat, 11 Nov 2006 23:37:25 +0000 (23:37 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 11 Nov 2006 23:37:25 +0000 (23:37 +0000)
* Remove some unneeded wrappers and locking

43 files changed:
include/vlc_input.h
include/vlc_playlist.h
include/vlc_symbols.h
modules/access/cdda.c
modules/access/directory.c
modules/access/mms/mmsh.c
modules/codec/cmml/intf.c
modules/control/http/macro.c
modules/control/http/rpn.c
modules/control/rc.c
modules/demux/mp4/mp4.c
modules/demux/playlist/asx.c
modules/demux/playlist/b4s.c
modules/demux/playlist/dvb.c
modules/demux/playlist/gvp.c
modules/demux/playlist/m3u.c
modules/demux/playlist/playlist.c
modules/demux/playlist/playlist.h
modules/demux/playlist/pls.c
modules/demux/playlist/podcast.c
modules/demux/playlist/qtl.c
modules/demux/playlist/sgimb.c
modules/demux/playlist/shoutcast.c
modules/demux/playlist/xspf.c
modules/gui/beos/InterfaceWindow.cpp
modules/gui/macosx/applescript.m
modules/gui/macosx/playlist.m
modules/gui/macosx/wizard.m
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/skins2/commands/cmd_add_item.cpp
modules/gui/skins2/commands/cmd_playlist.cpp
modules/gui/wxwidgets/dialogs.cpp
modules/gui/wxwidgets/dialogs/open.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/dialogs/wizard.cpp
modules/gui/wxwidgets/interface.cpp
modules/meta_engine/taglib.cpp
src/libvlc.c
src/misc/win32_specific.c
src/playlist/item.c
src/playlist/loadsave.c

index f7e78ec9163f3d79bad665e715d37c26595ff3d5..fde3c8162ed918907077c56042fbb83ae8744754 100644 (file)
@@ -27,7 +27,6 @@
 #define _VLC__INPUT_H 1
 
 #include <vlc_es.h>
-#include <vlc_playlist.h>
 #include <vlc_meta.h>
 
 struct vlc_meta_t;
index 9afb01ddf603686ce32a366cddfc0ff185f39884..7f45120e6c373401855bbdf7dbd3da64e8a4ffa7 100644 (file)
@@ -25,6 +25,9 @@
 #define _VLC_PLAYLIST_H_
 
 #include <assert.h>
+#include <vlc_input.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 TYPEDEF_ARRAY(playlist_item_t*, playlist_item_array_t);
 TYPEDEF_ARRAY(input_item_t*, input_item_array_t);
@@ -73,9 +76,7 @@ struct playlist_item_t
 #define PLAYLIST_REMOVE_FLAG    0x0010    /**< Remove this item at the end */
 #define PLAYLIST_EXPANDED_FLAG  0x0020    /**< Expanded node */
 
-/**
- * Playlist status
- */
+/** Playlist status */
 typedef enum
 { PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_status_t;
 
@@ -95,11 +96,6 @@ struct services_discovery_t
 struct playlist_t
 {
     VLC_COMMON_MEMBERS
-/**
-   \name playlist_t
-   These members are uniq to playlist_t
-*/
-/*@{*/
     int                   i_enabled; /**< How many items are enabled ? */
 
     playlist_item_array_t items; /**< Arrays of items */
@@ -172,10 +168,9 @@ struct playlist_t
     /** The input thread computing stats */
     input_thread_t      *p_stats_computer;
     global_stats_t      *p_stats;             /**< Global statistics */
-    /*@}*/
 };
 
-/* Helper to add an item */
+/** Helper to add an item */
 struct playlist_add_t
 {
     int i_node;
@@ -250,7 +245,6 @@ 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 *, playlist_item_t *, vlc_bool_t ) );
 VLC_EXPORT( int,  playlist_Export, ( playlist_t *, const char *, playlist_item_t *, const char * ) );
 
 /********************************************************
@@ -296,68 +290,6 @@ VLC_EXPORT( int, playlist_AddInput, ( playlist_t *, input_item_t *,int , int, vl
 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 ) );
-
-/** Add a MRL into the playlist.
- * \see playlist_Add
- */
-static inline int playlist_PlaylistAdd( playlist_t *p_playlist,
-                          const char *psz_uri, const char *psz_name,
-                          int i_mode, int i_pos )
-{
-    return playlist_Add( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-                         VLC_TRUE);
-}
-
-/** Add a MRL to the media library
- * \see playlist_Add
- */
-static inline int playlist_MLAdd( playlist_t *p_playlist, const char *psz_uri,
-                                  const char *psz_name, int i_mode, int i_pos )
-{
-    return playlist_Add( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-                         VLC_FALSE );
-}
-
-/** Add a MRL to the playlist, with duration and options given
- * \see playlist_AddExt
- */
-static inline int playlist_PlaylistAddExt( playlist_t *p_playlist,
-            const char * psz_uri, const char *psz_name, int i_mode, int i_pos,
-            mtime_t i_duration, const char **ppsz_options, int i_options ) 
-{
-    return playlist_AddExt( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-                            i_duration, ppsz_options, i_options, VLC_TRUE );
-}
-
-/** Add a MRL to the media library, with duration and options given
- * \see playlist_AddExt
- */
-static inline int playlist_MLAddExt( playlist_t *p_playlist,
-            const char * psz_uri, const char *psz_name, int i_mode, int i_pos,
-            mtime_t i_duration, const char **ppsz_options, int i_options ) 
-{
-    return playlist_AddExt( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-                            i_duration, ppsz_options, i_options, VLC_FALSE );
-}
-
-/** Add an input item to the playlist node
- * \see playlist_AddInput
- */
-static inline int playlist_PlaylistAddInput( playlist_t* p_playlist,
-                                input_item_t *p_input, int i_mode, int i_pos )
-{
-    return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, VLC_TRUE );
-}
-
-/** Add an input item to the media library
- * \see playlist_AddInput
- */
-static inline int playlist_MLAddInput( playlist_t* p_playlist,
-                                input_item_t *p_input, int i_mode, int i_pos )
-{
-    return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, VLC_FALSE );
-}
 
 /********************** Misc item operations **********************/
 VLC_EXPORT( playlist_item_t*, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
@@ -413,32 +345,27 @@ VLC_EXPORT( playlist_item_t *, playlist_GetPreferredNode, ( playlist_t *p_playli
 /***********************************************************************
  * Inline functions
  ***********************************************************************/
+/** Open a playlist file, add its content to the current playlist */
+static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file){
+    char psz_uri[256+10];
+    input_item_t *p_input;
+    snprintf( psz_uri, 256+9, "file/://%s", psz_file );
+    p_input = input_ItemNewExt( p_playlist, psz_uri, psz_file, 0, NULL, -1 );
+    playlist_AddInput( p_playlist, p_input, PLAYLIST_APPEND, PLAYLIST_END,
+                       VLC_TRUE );
+    input_Read( p_playlist, p_input, VLC_TRUE );
+    return VLC_SUCCESS;
+}
 
 /** 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 );
-}
+#define playlist_IsPlaying( pl ) ( pl->status.i_status == PLAYLIST_RUNNING )
 
 /** 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->items.i_size == 0;
-    vlc_mutex_unlock( &p_playlist->object_lock );
-    return( b_empty );
-}
+#define playlist_IsEmpty( pl ) ( pl->items.i_size == 0 )
 
 /** Tell the number of items in the current playing context */
-static inline int playlist_CurrentSize( vlc_object_t *p_this )
-{
-    return p_this->p_libvlc->p_playlist->current.i_size;
-}
+#define playlist_CurrentSize( obj ) obj->p_libvlc->p_playlist->current.i_size
+
 
 /** Ask the playlist to do some work */
 static inline void playlist_Signal( playlist_t *p_playlist )
index 4d0015d0aa4a35dbba18f2ef2127be6bf3cffb91..312d5d170f15c58e2d923ca502b7d31eb8404583 100644 (file)
@@ -312,7 +312,7 @@ struct module_symbols_t
     void *playlist_NodeGroup_deprecated;
     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 *, playlist_item_t *, vlc_bool_t);
+    void *playlist_Import_deprecated;
     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 *);
@@ -506,7 +506,7 @@ struct module_symbols_t
     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);
+    void *playlist_AddWhereverNeeded_deprecated;
     int (*playlist_DeleteFromItemId_inner) (playlist_t *, int);
     void (*playlist_NodeDump_inner) (playlist_t *p_playlist, playlist_item_t *p_item, int i_level);
     void *__intf_UserOkayCancel_deprecated;
@@ -557,6 +557,7 @@ struct module_symbols_t
     int (*net_ListenSingle_inner) (vlc_object_t *p_this, const char *psz_host, int i_port, int family, int socktype, int protocol);
     char * (*str_format_time_inner) (char *);
     char * (*__str_format_meta_inner) (vlc_object_t *, char *);
+    int (*vout_Snapshot_inner) (vout_thread_t *p_vout, picture_t *p_pic);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -821,7 +822,6 @@ struct module_symbols_t
 #  define playlist_ItemGetByInput (p_symbols)->playlist_ItemGetByInput_inner
 #  define playlist_NodeSort (p_symbols)->playlist_NodeSort_inner
 #  define playlist_RecursiveNodeSort (p_symbols)->playlist_RecursiveNodeSort_inner
-#  define playlist_Import (p_symbols)->playlist_Import_inner
 #  define playlist_Export (p_symbols)->playlist_Export_inner
 #  define __spu_Create (p_symbols)->__spu_Create_inner
 #  define spu_Init (p_symbols)->spu_Init_inner
@@ -996,7 +996,6 @@ struct module_symbols_t
 #  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_UserStringInput (p_symbols)->__intf_UserStringInput_inner
@@ -1034,6 +1033,7 @@ struct module_symbols_t
 #  define net_ListenSingle (p_symbols)->net_ListenSingle_inner
 #  define str_format_time (p_symbols)->str_format_time_inner
 #  define __str_format_meta (p_symbols)->__str_format_meta_inner
+#  define vout_Snapshot (p_symbols)->vout_Snapshot_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1301,7 +1301,6 @@ struct module_symbols_t
     ((p_symbols)->playlist_ItemGetByInput_inner) = playlist_ItemGetByInput; \
     ((p_symbols)->playlist_NodeSort_inner) = playlist_NodeSort; \
     ((p_symbols)->playlist_RecursiveNodeSort_inner) = playlist_RecursiveNodeSort; \
-    ((p_symbols)->playlist_Import_inner) = playlist_Import; \
     ((p_symbols)->playlist_Export_inner) = playlist_Export; \
     ((p_symbols)->__spu_Create_inner) = __spu_Create; \
     ((p_symbols)->spu_Init_inner) = spu_Init; \
@@ -1476,7 +1475,6 @@ struct module_symbols_t
     ((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_UserStringInput_inner) = __intf_UserStringInput; \
@@ -1514,6 +1512,7 @@ struct module_symbols_t
     ((p_symbols)->net_ListenSingle_inner) = net_ListenSingle; \
     ((p_symbols)->str_format_time_inner) = str_format_time; \
     ((p_symbols)->__str_format_meta_inner) = __str_format_meta; \
+    ((p_symbols)->vout_Snapshot_inner) = vout_Snapshot; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
     (p_symbols)->__sout_CfgParse_deprecated = NULL; \
     (p_symbols)->sout_CfgCreate_deprecated = NULL; \
@@ -1545,6 +1544,7 @@ struct module_symbols_t
     (p_symbols)->playlist_Sort_deprecated = NULL; \
     (p_symbols)->playlist_Move_deprecated = NULL; \
     (p_symbols)->playlist_NodeGroup_deprecated = NULL; \
+    (p_symbols)->playlist_Import_deprecated = NULL; \
     (p_symbols)->playlist_NodeRemoveParent_deprecated = NULL; \
     (p_symbols)->__vlc_fix_readdir_charset_deprecated = NULL; \
     (p_symbols)->FromUTF32_deprecated = NULL; \
@@ -1564,6 +1564,7 @@ struct module_symbols_t
     (p_symbols)->playlist_PlaylistAddExt_deprecated = NULL; \
     (p_symbols)->playlist_PlaylistAddInput_deprecated = NULL; \
     (p_symbols)->vlc_input_item_AddOption_deprecated = NULL; \
+    (p_symbols)->playlist_AddWhereverNeeded_deprecated = NULL; \
     (p_symbols)->__intf_UserOkayCancel_deprecated = NULL; \
     (p_symbols)->playlist_NodesCreateForSD_deprecated = NULL; \
     (p_symbols)->stats_TimerClean_deprecated = NULL; \
index f159bf5babca4b9c1b3be173b8509229dac38099..dec483594b3bd288c5be9bfd5108031af768feb0 100644 (file)
@@ -501,8 +501,8 @@ static int GetTracks( access_t *p_access,
             }
         }
 #endif
-        playlist_AddWhereverNeeded( p_playlist, p_input_item, p_parent,
-                               p_item_in_category, VLC_FALSE, PLAYLIST_APPEND );
+        playlist_BothAddInput( p_playlist, p_input_item, p_item_in_category,
+                               PLAYLIST_APPEND, PLAYLIST_END );
         free( psz_uri ); free( psz_opt ); free( psz_name );
         free( psz_first ); free( psz_last );
     }
index 831179a02578b2e53f46e7986c5b74f242f0747a..40ec31878102e29b6aa9e0096c5d7cae97aa5b1e 100644 (file)
@@ -178,13 +178,24 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
  *****************************************************************************/
 static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
 {
-    char *psz;
-    int  i_mode, i_activity;
-
-    char *psz_name = strdup (p_access->psz_path);
-    if (psz_name == NULL)
+    char               *psz;
+    int                 i_mode, i_activity;
+    playlist_t         *p_playlist = pl_Yield( p_access );
+    playlist_item_t    *p_item_in_category;
+    input_item_t       *p_current_input = ( (input_thread_t*)p_access->p_parent)
+                                                       ->input.p_item;
+    playlist_item_t    *p_current =
+                playlist_LockItemGetByInput( p_playlist, p_current_input );
+    char               *psz_name = strdup (p_access->psz_path);
+
+    if( psz_name == NULL )
         return VLC_ENOMEM;
 
+    if( p_current == NULL ) {
+        msg_Err( p_access, "unable to find item in playlist" );
+        return VLC_ENOOBJ;
+    }
+
     /* Remove the ending '/' char */
     if (psz_name[0])
     {
@@ -197,9 +208,6 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
         }
     }
 
-    playlist_item_t *p_item, *p_root_category;
-    playlist_t *p_playlist = pl_Yield( p_access );
-
     /* Handle mode */
     psz = var_CreateGetString( p_access, "recursive" );
     if( *psz == '\0' || !strncmp( psz, "none" , 4 )  )
@@ -212,33 +220,19 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
 
     msg_Dbg( p_access, "opening directory `%s'", p_access->psz_path );
 
-    if( p_playlist->status.p_item && p_playlist->status.p_item->p_input ==
-        ((input_thread_t *)p_access->p_parent)->input.p_item )
-        p_item = p_playlist->status.p_item;
-    else
-    {
-        input_item_t *p_current = ( (input_thread_t*)p_access->p_parent)->
-                                                        input.p_item;
-        p_item = playlist_LockItemGetByInput( p_playlist, p_current );
-        if( !p_item )
-        {
-            msg_Dbg( p_playlist, "unable to find item in playlist");
-            return VLC_ENOOBJ;
-        }
-    }
-    p_item->p_input->i_type = ITEM_TYPE_DIRECTORY;
-
-    p_root_category = playlist_LockItemToNode( p_playlist, p_item );
+    p_current->p_input->i_type = ITEM_TYPE_DIRECTORY;
+    p_item_in_category = playlist_LockItemToNode( p_playlist, p_current );
 
     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 );
+    ReadDir( p_playlist, psz_name, i_mode, p_current, p_item_in_category );
 
     i_activity = var_GetInteger( p_playlist, "activity" );
     var_SetInteger( p_playlist, "activity", i_activity -
                     DIRECTORY_ACTIVITY );
+
     if( psz_name ) free( psz_name );
     vlc_object_release( p_playlist );
 
@@ -475,9 +469,10 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
                                                  psz_uri, entry, 0, NULL,
                                                  -1, ITEM_TYPE_VFILE );
                 if (p_input != NULL)
-                    playlist_AddWhereverNeeded (p_playlist, p_input, p_parent,
-                                                p_parent_category, VLC_FALSE,
-                                                PLAYLIST_APPEND|PLAYLIST_PREPARSE);
+                    playlist_BothAddInput( p_playlist, p_input,
+                                           p_parent_category,
+                                           PLAYLIST_APPEND|PLAYLIST_PREPARSE,
+                                           PLAYLIST_END );
             }
         }
     }
index 8d312b7f0c5b2f4befdaadea939524600e22a0ff..4818d3c0621e3ef8a1e805b3125f0ec25c64a079 100644 (file)
@@ -112,8 +112,8 @@ int E_(MMSHOpen)( access_t *p_access )
         msg_Dbg( p_access, "redirection to %s", psz_location );
 
         /** \bug we do not autodelete here */
-        playlist_PlaylistAdd( p_playlist, psz_location, psz_location,
-                              PLAYLIST_INSERT | PLAYLIST_GO, PLAYLIST_END );
+        playlist_Add( p_playlist, psz_location, psz_location,
+                      PLAYLIST_INSERT | PLAYLIST_GO, PLAYLIST_END, VLC_TRUE );
         vlc_object_release( p_playlist );
 
         free( psz_location );
index 78daaf7e1ffe9efcbd7c86e77da494b2b25219f2..346c69020ef0edd8c45d6f0ace8b6ba300a27a16 100644 (file)
@@ -795,8 +795,8 @@ void GoForward( intf_thread_t *p_intf )
 static void ReplacePlaylistItem( playlist_t *p_playlist, char *psz_uri )
 {
     playlist_Stop( p_playlist );
-    (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 */ );
+    (void) playlist_Add( p_playlist, psz_uri, psz_uri,
+                         PLAYLIST_INSERT /* FIXME: used to be PLAYLIST_REPLACE */, PLAYLIST_END|PLAYLIST_GO, VLC_TRUE /* FIXME: p_playlist->status.i_index */ );
 }
 
 /****************************************************************************
index fe8076001e49ddd48dd655415d7cc543d77a601f..45e8e8654ed35e2dbe839b1d4ac05fd98f379b1d 100644 (file)
@@ -338,8 +338,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                     }
                     else
                     {
-                        playlist_PlaylistAddInput( p_sys->p_playlist, p_input,
-                                          PLAYLIST_APPEND, PLAYLIST_END );
+                        playlist_AddInput( p_sys->p_playlist, p_input,
+                                     PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE );
                         msg_Dbg( p_intf, "requested mrl add: %s", mrl );
                     }
 
index 962473c08347694157c641fe09b23792542aaa79..1da4491eb6dc18051272efd048849e5e1ae7a20d 100644 (file)
@@ -850,8 +850,8 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
             }
             else
             {
-                i_id = playlist_PlaylistAddInput( p_sys->p_playlist, p_input,
-                                         PLAYLIST_APPEND, PLAYLIST_END );
+                i_id = playlist_AddInput( p_sys->p_playlist, p_input,
+                                   PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE );
                 msg_Dbg( p_intf, "requested mrl add: %s", mrl );
             }
             E_(SSPushN)( st, i_id );
index e420b6c635b897cca82346079921b4c2935a0f67..0a1e297d7504871471e89a56063790dd8c163db3 100644 (file)
@@ -1416,8 +1416,8 @@ 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_PlaylistAddInput( p_playlist, p_item,
-                              PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_item,
+                     PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE );
         }
     }
     else if( !strcmp( psz_cmd, "enqueue" ) &&
@@ -1428,8 +1428,8 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "trying to enqueue %s to playlist", newval.psz_string );
-            playlist_PlaylistAddInput( p_playlist, p_item,
-                              PLAYLIST_APPEND, PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_item,
+                               PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE );
         }
     }
     else if( !strcmp( psz_cmd, "playlist" ) )
index ef2f10ff79f2ff4c496e4054506d7236e1b1343f..a430c7fa3893039e9594302b3bd9fbeaf2d48eb5 100644 (file)
@@ -415,8 +415,9 @@ static int Open( vlc_object_t * p_this )
                         p_input = input_ItemNewExt( p_playlist, psz_ref, NULL,
                                             0, NULL, -1 );
                         input_ItemCopyOptions( p_current->p_input, p_input );
-                        playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                                p_item_in_category, VLC_FALSE, PLAYLIST_APPEND );
+                        playlist_BothAddInput( p_playlist, p_input,
+                                               p_item_in_category,
+                                               PLAYLIST_APPEND, PLAYLIST_END );
                     }
                 }
                 else
index 5456de3eafd2da31b373dd3d90a6b82f98e9a838..0f8d5b8d8a6298d9741e9a9bb99d99a76338cd86 100644 (file)
@@ -131,7 +131,7 @@ static int Demux( demux_t *p_demux )
     char        *psz_parse = NULL;
     char        *psz_backup = NULL;
     vlc_bool_t  b_entry = VLC_FALSE;
-
+    input_item_t *p_input;
     INIT_PLAYLIST_STUFF;
 
     /* init txt */
@@ -355,9 +355,10 @@ static int Demux( demux_t *p_demux )
                             psz_string[i_strlen] = '\0';
                             p_input = input_ItemNew( p_playlist, psz_string, psz_title_asx );
                             input_ItemCopyOptions( p_current->p_input, p_input );
-                            playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                                 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE,
-                                 PLAYLIST_APPEND );
+                            playlist_BothAddInput( p_playlist, p_input,
+                                                   p_item_in_category,
+                                                   PLAYLIST_APPEND,
+                                                   PLAYLIST_END );
                             free( psz_string );
                         }
                         else continue;
@@ -434,10 +435,9 @@ static int Demux( demux_t *p_demux )
                             if( psz_copyright_entry ) vlc_meta_SetCopyright( p_entry->p_meta, psz_copyright_entry );
                             if( psz_moreinfo_entry ) vlc_meta_SetURL( p_entry->p_meta, psz_moreinfo_entry );
                             if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry );
-                            
-                            playlist_AddWhereverNeeded( p_playlist, p_entry, p_current,
-                                p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE,
-                                PLAYLIST_APPEND );
+                            playlist_BothAddInput( p_playlist, p_entry,
+                                                 p_item_in_category,
+                                                 PLAYLIST_APPEND, PLAYLIST_END);
                             free( psz_string );
                         }
                         else continue;
index 45cef697d7381c9f5901d8ad4c8f8b301bf1bb0e..49729a6cee156b89c7db65d84d99abaf64eaa4ae 100644 (file)
@@ -84,6 +84,7 @@ static int Demux( demux_t *p_demux )
     xml_reader_t *p_xml_reader;
     char *psz_elname = NULL;
     int i_type;
+    input_item_t *p_input;
     char *psz_mrl = NULL, *psz_name = NULL, *psz_genre = NULL;
     char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
 
@@ -265,10 +266,9 @@ static int Demux( demux_t *p_demux )
                     if( psz_bitrate )
                         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 );
-
+                    playlist_BothAddInput( p_playlist, p_input,
+                                           p_item_in_category,
+                                           PLAYLIST_APPEND, PLAYLIST_END );
                     FREENULL( psz_name );
                     FREENULL( psz_mrl );
                     FREENULL( psz_genre );
index 38d7ef5b2136d85203609ca2e75f5f60866d1494..91662f32dc359bfce8fd892f8c7190d8c4fb896d 100644 (file)
@@ -95,6 +95,7 @@ void E_(Close_DVB)( vlc_object_t *p_this )
 static int Demux( demux_t *p_demux )
 {
     char       *psz_line;
+    input_item_t *p_input;
     INIT_PLAYLIST_STUFF;
 
     while( (psz_line = stream_ReadLine( p_demux->s )) )
@@ -117,10 +118,8 @@ static int Demux( demux_t *p_demux )
             EnsureUTF8( ppsz_options[i] );
             input_ItemAddOption( p_input, ppsz_options[i] );
         }
-        playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 
-                                    p_item_in_category,
-                                    (i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
-                                    PLAYLIST_APPEND );
+        playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
+                               PLAYLIST_APPEND, PLAYLIST_END );
 
         while( i_options-- ) free( ppsz_options[i_options] );
         if( ppsz_options ) free( ppsz_options );
index 6484a67b76bb9adfb0d30d8f00f028d92393b776..81f5de8675b7a904e3de2c4e87ad805e3a52c16d 100644 (file)
@@ -62,7 +62,6 @@ struct demux_sys_t
     playlist_t *p_playlist;
     playlist_item_t *p_current;
     playlist_item_t *p_item_in_category;
-    int i_parent_id;
 };
 
 /*****************************************************************************
@@ -129,12 +128,12 @@ static int Demux( demux_t *p_demux )
     int i_duration = -1;
     char *psz_title = NULL;
     char *psz_description = NULL;
+    input_item_t *p_input;
 
     INIT_PLAYLIST_STUFF;
 
     p_sys->p_playlist = p_playlist;
     p_sys->p_current = p_current;
-    p_sys->i_parent_id = i_parent_id;
     p_sys->p_item_in_category = p_item_in_category;
 
     while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
@@ -214,10 +213,9 @@ static int Demux( demux_t *p_demux )
         SADD_INFO( "gvp_version", psz_version );
         SADD_INFO( "docid", psz_docid );
         SADD_INFO( "description", psz_description );
-        playlist_AddWhereverNeeded( p_sys->p_playlist, p_input,
-                            p_sys->p_current, p_sys->p_item_in_category,
-                            (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
-                            PLAYLIST_APPEND );
+        playlist_BothAddInput( p_sys->p_playlist, p_input,
+                               p_sys->p_item_in_category,
+                               PLAYLIST_APPEND, PLAYLIST_END );
     }
 
     HANDLE_PLAY_AND_RELEASE;
index f79dd5eaa8d519746e93a75f096a65becbb785d2..3c45ad2acae01df2df1d80c35847211d2a67708c 100644 (file)
@@ -56,15 +56,11 @@ int E_(Import_M3U)( vlc_object_t *p_this )
     uint8_t *p_peek;
     CHECK_PEEK( p_peek, 8 );
 
-    if( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) ||
-        isExtension( p_demux, ".m3u" ) || isExtension( p_demux, ".vlc" ) ||
-        /* A .ram file can contain a single rtsp link */
-        isExtension( p_demux, ".ram" ) || isExtension( p_demux, ".rm" ) ||
-        isDemux( p_demux,  "m3u" ) )
-    {
-        ;
-    }
-    else
+    if(! ( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) ||
+           isExtension( p_demux, ".m3u" ) || isExtension( p_demux, ".vlc" ) ||
+           /* A .ram file can contain a single rtsp link */
+           isExtension( p_demux, ".ram" ) || isExtension( p_demux, ".rm" ) ||
+           isDemux( p_demux,  "m3u" ) ) )
         return VLC_EGENERIC;
 
     STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" );
@@ -79,8 +75,7 @@ int E_(Import_M3U)( vlc_object_t *p_this )
 void E_(Close_M3U)( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
-
-    if( p_demux->p_sys->psz_prefix ) free( p_demux->p_sys->psz_prefix );
+    free( p_demux->p_sys->psz_prefix );
     free( p_demux->p_sys );
 }
 
@@ -94,6 +89,7 @@ static int Demux( demux_t *p_demux )
     const char**ppsz_options = NULL;
     int        i_options = 0, i;
     vlc_bool_t b_cleanup = VLC_FALSE;
+    input_item_t *p_input;
 
     INIT_PLAYLIST_STUFF;
 
@@ -172,9 +168,8 @@ static int Demux( demux_t *p_demux )
             if ( psz_artist && *psz_artist )
                 input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT),
                                         _(VLC_META_ARTIST), "%s", psz_artist );
-            playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE,
-                 PLAYLIST_APPEND );
+            playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
+                                   PLAYLIST_APPEND, PLAYLIST_END );
             free( psz_mrl );
         }
 
index 5d991178c946688f5de6d702580d316eb0fe6874..cf322a3a7a8cbee6776ede3f7e0f221c21098371 100644 (file)
@@ -164,56 +164,3 @@ char *E_(ProcessMRL)( char *psz_mrl, char *psz_prefix )
     asprintf( &psz_mrl, "%s%s", psz_prefix, psz_mrl );
     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 );
-   }
-   input_ItemCopyOptions( 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->p_input ==
-                ((input_thread_t *)p_demux->p_parent)->input.p_item )
-     {
-         msg_Dbg( p_playlist, "starting playlist playback" );
-         *pp_item = p_playlist->status.p_item;
-         b_play = VLC_TRUE;
-     }
-     else
-     {
-         input_item_t *p_current = ( (input_thread_t*)p_demux->p_parent)->
-                                                        input.p_item;
-         *pp_item = playlist_LockItemGetByInput( p_playlist, p_current );
-         if( !*pp_item )
-         {
-             msg_Dbg( p_playlist, "unable to find item in playlist");
-         }
-         msg_Dbg( p_playlist, "not starting playlist playback");
-         p_playlist->status.i_status = PLAYLIST_STOPPED;
-         b_play = VLC_FALSE;
-     }
-     return b_play;
-}
index 4e643b85428dcf009a12634b7bf1914c46450f89..49c1612556d5384cb188d9821000c244c7036081 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <vlc_playlist.h>
 char *E_(ProcessMRL)( char *, char * );
 char *E_(FindPrefix)( demux_t * );
 
@@ -67,31 +68,21 @@ int E_(Import_GVP) ( vlc_object_t * );
 void E_(Close_GVP) ( vlc_object_t * );
 
 #define INIT_PLAYLIST_STUFF \
-    int i_parent_id; \
-    vlc_bool_t b_play; \
-    playlist_item_t *p_current, *p_item_in_category = NULL; \
-    input_item_t *p_input; \
     playlist_t *p_playlist = pl_Yield( p_demux ); \
-    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_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;        \
-    }
+    vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" ); \
+    input_item_t *p_current_input = ( (input_thread_t*)p_demux->p_parent)-> \
+                                                         input.p_item; \
+    playlist_item_t *p_current = \
+                 playlist_LockItemGetByInput( p_playlist, p_current_input ); \
+    playlist_item_t *p_item_in_category = \
+                            playlist_ItemToNode( p_playlist, p_current ); \
+    b_play = b_play && p_current == p_playlist->status.p_item; \
+    if( p_item_in_category ) \
+        p_item_in_category->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,  \
-                          p_playlist->status.p_item, NULL ); \
-    } \
+    if( b_play && p_item_in_category && p_item_in_category->i_children > 0 ) \
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_item_in_category, \
+                          NULL ); \
     vlc_object_release( p_playlist );
-
index fec4b769896b6536ac379c07183fea24e774355d..ebd89c91a0dbcc83a16d6b2aa5785416270bd6e6 100644 (file)
@@ -89,6 +89,7 @@ static int Demux( demux_t *p_demux )
     int            i_item = -1;
     int            i_new_item = 0;
     int            i_key_length;
+    input_item_t *p_input;
 
     INIT_PLAYLIST_STUFF;
 
@@ -155,9 +156,8 @@ static int Demux( demux_t *p_demux )
                 p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
                                             0, NULL, -1 );
                 input_ItemCopyOptions( p_current->p_input, p_input );
-                playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                                p_item_in_category, (i_parent_id > 0 ) ?
-                                VLC_TRUE: VLC_FALSE, PLAYLIST_APPEND );
+                playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
+                                        PLAYLIST_APPEND, PLAYLIST_END );
             }
             else
             {
@@ -212,9 +212,8 @@ static int Demux( demux_t *p_demux )
     {
         p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,0, NULL, -1 );
         input_ItemCopyOptions( p_current->p_input, p_input );
-        playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                                p_item_in_category, (i_parent_id > 0 ) ?
-                                VLC_TRUE: VLC_FALSE, PLAYLIST_APPEND );
+        playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
+                               PLAYLIST_APPEND, PLAYLIST_END );
         free( psz_mrl_orig );
         psz_mrl = NULL;
     }
index 6e07bb074f4d27c97d77515837b520fbbf6a2ee5..c1de9b8319c7d2c4a2ca2fdfa606f6b5584582bf 100644 (file)
@@ -105,6 +105,7 @@ static int Demux( demux_t *p_demux )
     char *psz_item_subtitle = NULL;
     char *psz_item_summary = NULL;
     int i_type;
+    input_item_t *p_input;
 
     INIT_PLAYLIST_STUFF;
 
@@ -290,9 +291,9 @@ static int Demux( demux_t *p_demux )
                                                 "%s bytes",
                                                 psz_item_size );
                     }
-                    playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                          p_item_in_category, (i_parent_id > 0 ) ? VLC_TRUE:
-                                                VLC_FALSE, PLAYLIST_APPEND );
+                    playlist_BothAddInput( p_playlist, p_input,
+                                           p_item_in_category,
+                                           PLAYLIST_APPEND, PLAYLIST_END );
                     FREENULL( psz_item_name );
                     FREENULL( psz_item_mrl );
                     FREENULL( psz_item_size );
index eabd67464b20a1a9b179ad1814eef7d246294695..792ed4dc66ee88cfb2e2ed17ab942d30376ca7ca 100644 (file)
@@ -61,7 +61,6 @@ struct demux_sys_t
     playlist_t *p_playlist;
     playlist_item_t *p_current;
     playlist_item_t *p_item_in_category;
-    int i_parent_id;
 
     xml_t *p_xml;
     xml_reader_t *p_xml_reader;
@@ -119,6 +118,7 @@ static int Demux( demux_t *p_demux )
     xml_t *p_xml;
     xml_reader_t *p_xml_reader;
     char *psz_eltname = NULL;
+    input_item_t *p_input;
 
     /* List of all possible attributes. The only required one is "src" */
     vlc_bool_t b_autoplay = VLC_FALSE;
@@ -140,7 +140,6 @@ static int Demux( demux_t *p_demux )
 
     p_sys->p_playlist = p_playlist;
     p_sys->p_current = p_current;
-    p_sys->i_parent_id = i_parent_id;
     p_sys->p_item_in_category = p_item_in_category;
 
     p_xml = p_sys->p_xml = xml_Create( p_demux );
@@ -361,19 +360,16 @@ static int Demux( demux_t *p_demux )
                     p_input, "QuickTime Media Link", _(type), "%s", field ) ; }
         SADD_INFO( "href", psz_href );
         SADD_INFO( "mime type", psz_mimetype );
-        playlist_AddWhereverNeeded( p_sys->p_playlist, p_input,
-                            p_sys->p_current, p_sys->p_item_in_category,
-                            (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
-                            PLAYLIST_APPEND );
-
+        playlist_BothAddInput( p_sys->p_playlist, p_input,
+                               p_sys->p_item_in_category, PLAYLIST_APPEND,
+                               PLAYLIST_END );
         if( psz_qtnext )
         {
             p_input = input_ItemNewExt( p_sys->p_playlist,
                                         psz_qtnext, NULL, 0, NULL, -1 );
-            playlist_AddWhereverNeeded( p_sys->p_playlist, p_input,
-                            p_sys->p_current, p_sys->p_item_in_category,
-                            (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
-                            PLAYLIST_APPEND );
+            playlist_BothAddInput( p_sys->p_playlist, p_input,
+                                   p_sys->p_item_in_category,
+                                   PLAYLIST_APPEND, PLAYLIST_END );
         }
     }
 
index d074557d6b61ea19d882eb41a84bff2d3ab72ba2..1564f89bfe5140378a7abdd48b1273f96ffb1adf 100644 (file)
@@ -406,9 +406,8 @@ static int Demux ( demux_t *p_demux )
         free( psz_option );
     }
 
-    playlist_AddWhereverNeeded( p_playlist, p_child, p_current,
-                                 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE,
-                                 PLAYLIST_APPEND );
+    playlist_BothAddInput( p_playlist, p_child, p_item_in_category,
+                           PLAYLIST_APPEND, PLAYLIST_END );
     HANDLE_PLAY_AND_RELEASE
     return VLC_SUCCESS;
 }
index 2b0048103ac382f510ee6e1ef4163734e86ea139..862287f278d75de1bb1d7e861233693f16bb80d1 100644 (file)
@@ -40,7 +40,6 @@ struct demux_sys_t
     playlist_t *p_playlist;
     playlist_item_t *p_current;
     playlist_item_t *p_item_in_category;
-    int i_parent_id;
 
     xml_t *p_xml;
     xml_reader_t *p_xml_reader;
@@ -111,7 +110,6 @@ static int Demux( demux_t *p_demux )
     INIT_PLAYLIST_STUFF;
     p_sys->p_playlist = p_playlist;
     p_sys->p_current = p_current;
-    p_sys->i_parent_id = i_parent_id;
     p_sys->p_item_in_category = p_item_in_category;
 
     p_xml = p_sys->p_xml = xml_Create( p_demux );
@@ -242,10 +240,9 @@ static int DemuxGenre( demux_t *p_demux )
                     input_ItemCopyOptions( p_sys->p_current->p_input,
                                                 p_input );
                     free( psz_mrl );
-                    playlist_AddWhereverNeeded( p_sys->p_playlist, p_input,
-                             p_sys->p_current, p_sys->p_item_in_category,
-                             (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
-                             PLAYLIST_APPEND );
+                    playlist_BothAddInput( p_sys->p_playlist, p_input,
+                                           p_sys->p_item_in_category,
+                                           PLAYLIST_APPEND, PLAYLIST_END );
                     FREENULL( psz_name );
                 }
                 FREENULL( psz_eltname );
@@ -434,10 +431,9 @@ static int DemuxStation( demux_t *p_demux )
                     if( psz_rt )
                         vlc_meta_SetRating( p_input->p_meta, psz_rt );
 
-                    playlist_AddWhereverNeeded( p_sys->p_playlist, p_input,
-                             p_sys->p_current, p_sys->p_item_in_category,
-                             (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
-                             PLAYLIST_APPEND );
+                    playlist_BothAddInput( p_sys->p_playlist, p_input,
+                                           p_sys->p_item_in_category,
+                                           PLAYLIST_APPEND, PLAYLIST_END );
 
                     FREENULL( psz_name );
                     FREENULL( psz_mt )
index 89dcd9a814f6a5b807ed929ec10957d1a92a80e5..f57c8ee6696873e1049edf9549be5670cd103f7b 100644 (file)
@@ -39,7 +39,6 @@
 struct demux_sys_t
 {
     playlist_item_t *p_item_in_category;
-    int i_parent_id;
     input_item_t **pp_tracklist;
     int i_tracklist_entries;
     int i_identifier;
@@ -54,7 +53,7 @@ static int Demux( demux_t * );
  */
 int E_(Import_xspf)( vlc_object_t *p_this )
 {
-    DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".xspf", "xspf-open", 
+    DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".xspf", "xspf-open",
                                       "using XSPF playlist reader" );
     return VLC_SUCCESS;
 }
@@ -75,9 +74,9 @@ int Demux( demux_t *p_demux )
     xml_t *p_xml = NULL;
     xml_reader_t *p_xml_reader = NULL;
     char *psz_name = NULL;
+    input_item_t *p_input;
     INIT_PLAYLIST_STUFF;
     p_demux->p_sys->p_item_in_category = p_item_in_category;
-    p_demux->p_sys->i_parent_id = i_parent_id;
     p_demux->p_sys->pp_tracklist = NULL;
     p_demux->p_sys->i_tracklist_entries = 0;
     p_demux->p_sys->i_identifier = -1;
@@ -481,11 +480,9 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
                 if( !strcmp( psz_name, psz_element ) )
                 {
                     FREE_ATT();
-                    /* Add it */
-                    playlist_AddWhereverNeeded( p_playlist, p_new_input,
-                              p_item, p_demux->p_sys->p_item_in_category,
-                              (p_demux->p_sys->i_parent_id >0 ) ? VLC_TRUE:
-                              VLC_FALSE, PLAYLIST_APPEND );
+                    playlist_BothAddInput( p_playlist, p_new_input,
+                                           p_demux->p_sys->p_item_in_category,
+                                           PLAYLIST_APPEND, PLAYLIST_END );
                     if( p_demux->p_sys->i_identifier <
                         p_demux->p_sys->i_tracklist_entries )
                     {
index affd8016471d47a9093124daa889c9f89c44b8af..74db1a5b7b43e923224df2daea1578aed348cab9 100644 (file)
@@ -436,8 +436,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
                     char psz_uri[1024];
                     memset( psz_uri, 0, 1024 );
                     snprintf( psz_uri, 1024, "dvdnav:%s", psz_device );
-                    playlist_PlaylistAdd( p_playlist, psz_uri, psz_device,
-                                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+                    playlist_Add( p_playlist, psz_uri, psz_device,
+                        PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, VLC_TRUE );
                 }
                 UpdatePlaylist();
             }
@@ -749,8 +749,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
 
                 if( p_playlist )
                 {
-                    playlist_PlaylistAdd( p_playlist, path.Path(), NULL,
-                                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+                    playlist_Add( p_playlist, path.Path(), NULL,
+                       PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, VLC_TRUE );
                 }
             }
 
index 203a268978deb4908268d9109ebdbe18a9e3cdcf..b517aecb4c6fa620866029dfc4edecc39cd7579c 100644 (file)
@@ -58,8 +58,8 @@
                                     [o_urlString fileSystemRepresentation],
                                     [[[NSFileManager defaultManager]
                                     displayNameAtPath: o_urlString] UTF8String] );
-            playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_INSERT,
-                                                                PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
+                               PLAYLIST_END, VLC_TRUE );
 
 
             o_url = [NSURL fileURLWithPath: o_urlString];
index 9b3cecb6905c73730f7665599c4bb4e721f1139b..545c80a2159f82dcfecf0136c0fe34714104aec7 100644 (file)
@@ -1011,8 +1011,8 @@ NSLog( @"expandable" );
         }
 
         /* Add the item */
-        playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_INSERT,
-                        i_position == -1 ? PLAYLIST_END : i_position + i_item );
+        playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
+             i_position == -1 ? PLAYLIST_END : i_position + i_item, VLC_TRUE );
 
         if( i_item == 0 && !b_enqueue )
         {
index 0dadbc206f97c34915a8e256f59d2225c8d7168d..9d950b35ade6d33c515a5f9b95994c8e584caced 100644 (file)
@@ -1314,7 +1314,8 @@ static VLCWizard *_o_sharedInstance = nil;
                 @"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \
                 UTF8String] );
 
-            playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, 
+                       PLAYLIST_END, VLC_TRUE );
 
             if( x == 0 )
             {
index 47457438aa1180ec2037aa8f54cd1d1359b9384d..fbb945056614bdb3ba4b656530eb8eae024fa89d 100644 (file)
@@ -84,8 +84,8 @@ void PlaylistDialog::dropEvent(QDropEvent *event)
      foreach( QUrl url, mimeData->urls() ) {
         QString s = url.toString();
         if( s.length() > 0 ) {
-            playlist_PlaylistAdd( THEPL, qtu(s), NULL,
-                                  PLAYLIST_APPEND, PLAYLIST_END );
+            playlist_Add( THEPL, qtu(s), NULL,
+                          PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE );
         }
      }
      event->acceptProposedAction();
index d35805a3d068948aaa491efa408745afe17833a0..adca9a3ccd510001a69a8dd85aa551cfb1cd5321 100644 (file)
@@ -207,8 +207,8 @@ void DialogsProvider::simplePLAppendDialog()
     foreach( file, files )
     {
         const char * psz_utf8 = qtu( file );
-        playlist_PlaylistAdd( THEPL, psz_utf8, NULL,
-                     PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END );
+        playlist_Add( THEPL, psz_utf8, NULL,
+                PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END, VLC_TRUE );
     }
 }
 
@@ -219,8 +219,9 @@ void DialogsProvider::simpleMLAppendDialog()
     foreach( file, files )
     {
         const char * psz_utf8 =  qtu( file );
-        playlist_MLAdd( THEPL, psz_utf8, psz_utf8,
-                        PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END );
+        playlist_Add( THEPL, psz_utf8, psz_utf8,
+                      PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END,
+                      VLC_TRUE);
     }
 }
 
@@ -232,10 +233,10 @@ void DialogsProvider::simpleOpenDialog()
     {
         const char * psz_utf8 = qtu( files[i] );
         /* Play the first one, parse and enqueue the other ones */
-        playlist_PlaylistAdd( THEPL, psz_utf8, NULL,
-                     PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
-                     ( i ? PLAYLIST_PREPARSE : 0 ),
-                     PLAYLIST_END );
+        playlist_Add( THEPL, psz_utf8, NULL,
+                      PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
+                      ( i ? PLAYLIST_PREPARSE : 0 ),
+                      PLAYLIST_END, VLC_TRUE );
     }
 }
 
@@ -246,8 +247,7 @@ void DialogsProvider::openPlaylist()
     for( size_t i = 0 ; i< files.size(); i++ )
     {
         const char * psz_utf8 = qtu( files[i] );
-        /* Play the first one, parse and enqueue the other ones */
-        playlist_Import( THEPL, psz_utf8, THEPL->p_root_category, VLC_FALSE );
+        playlist_Import( THEPL, psz_utf8 );
     }
 }
 
@@ -258,8 +258,7 @@ void DialogsProvider::openDirectory()
     const char *psz_utf8 = qtu( dir );
     input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, NULL,
                                                0, NULL, -1 );
-    playlist_PlaylistAddInput( THEPL, p_input,
-                               PLAYLIST_APPEND, PLAYLIST_END );
+    playlist_AddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE);
     input_Read( THEPL, p_input, VLC_FALSE );
 }
 void DialogsProvider::openMLDirectory()
@@ -269,7 +268,8 @@ void DialogsProvider::openMLDirectory()
     const char *psz_utf8 = qtu( dir );
     input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, NULL,
                                                0, NULL, -1 );
-    playlist_MLAddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END );
+    playlist_AddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END,
+                        VLC_FALSE );
     input_Read( THEPL, p_input, VLC_FALSE );
 }
 
index b9058efe8c8d150ec1b410b6875098ef77b92994..06672f2f42fd75e3ba06ec56e42dc9aa1345994c 100644 (file)
@@ -508,9 +508,9 @@ void MainInterface::dropEvent(QDropEvent *event)
      foreach( QUrl url, mimeData->urls() ) {
         QString s = url.toString();
         if( s.length() > 0 ) {
-            playlist_PlaylistAdd( THEPL, qtu(s), NULL,
-                                  PLAYLIST_APPEND | (first ? PLAYLIST_GO:0),
-                                  PLAYLIST_END );
+            playlist_Add( THEPL, qtu(s), NULL,
+                          PLAYLIST_APPEND | (first ? PLAYLIST_GO:0),
+                          PLAYLIST_END, VLC_TRUE );
             first = false;
         }
      }
index dbfdea032a835d9d045361e4475c865cb5147c98..632c468b0b9112ced1d32ea10e294c60bb5ffeb3 100644 (file)
@@ -37,13 +37,13 @@ void CmdAddItem::execute()
     if( m_playNow )
     {
         // Enqueue and play the item
-        playlist_PlaylistAdd( pPlaylist, m_name.c_str(), NULL,
-                              PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+        playlist_Add( pPlaylist, m_name.c_str(), NULL,
+                      PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, VLC_TRUE );
     }
     else
     {
         // Enqueue the item only
-        playlist_PlaylistAdd( pPlaylist, m_name.c_str(), NULL,
-                              PLAYLIST_APPEND, PLAYLIST_END );
+        playlist_Add( pPlaylist, m_name.c_str(), NULL,
+                      PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE );
     }
 }
index 96abdf6284f02170575064fcf64ee6478acb15b1..025c6b137611568f3e6ae90e907fd2dc00e77b15 100644 (file)
@@ -93,11 +93,7 @@ void CmdPlaylistLoad::execute()
 {
     playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
     if( pPlaylist != NULL )
-    {
-        /*FIXME: Where do we want ot insert ?*/
-        playlist_Import( pPlaylist, m_file.c_str(),
-                         pPlaylist->p_local_category, VLC_TRUE );
-    }
+        playlist_Import( pPlaylist, m_file.c_str() );
 }
 
 
index 655aa061cdfb3b83754252ce624952a34e33780d..d18e8bb7ad6d7c6fe5ac17c9df16a7db990123b8 100644 (file)
@@ -450,13 +450,13 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
         {
             char *psz_utf8 = wxFromLocale( paths[i] );
             if( event.GetInt() )
-                playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
+                playlist_Add( p_playlist, psz_utf8, NULL,
                               PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
                               (i ? PLAYLIST_PREPARSE : 0 ),
-                              PLAYLIST_END );
+                              PLAYLIST_END, VLC_TRUE );
             else
-                playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
-                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
+                playlist_Add( p_playlist, psz_utf8, NULL,
+                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END , VLC_TRUE);
             wxLocaleFree( psz_utf8 );
         }
     }
@@ -481,9 +481,9 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
     {
         wxString path = p_dir_dialog->GetPath();
         char *psz_utf8 = wxFromLocale( path );
-        playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
+        playlist_Add( p_playlist, psz_utf8, NULL,
                       PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
-                      PLAYLIST_END );
+                      PLAYLIST_END, VLC_TRUE );
         wxLocaleFree( psz_utf8 );
     }
 
index dc10cfeec349c57986cf50ed19ce45aad1a4f18d..268308bd8ae3f2b579b5dd5fe3727ba437dc2bce 100644 (file)
@@ -1203,15 +1203,15 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 
         if( b_start )
         {
-            playlist_PlaylistAddInput( p_playlist, p_input,
-                                       PLAYLIST_APPEND | PLAYLIST_GO,
-                                       PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_input,
+                               PLAYLIST_APPEND | PLAYLIST_GO,
+                               PLAYLIST_END, VLC_TRUE );
         }
         else
         {
-            playlist_PlaylistAddInput( p_playlist, p_input,
+            playlist_AddInput( p_playlist, p_input,
                                        PLAYLIST_APPEND|PLAYLIST_PREPARSE,
-                                       PLAYLIST_END );
+                                       PLAYLIST_END, VLC_TRUE );
         }
     }
 
index e9e33750913671a1244747dc057b2136a737c2ff..d33886077cb04bb1ce055cc56ed9cd163cea08d0 100644 (file)
@@ -978,9 +978,7 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) )
 
     if( dialog.ShowModal() == wxID_OK )
     {
-        playlist_Import( p_playlist, dialog.GetPath().mb_str(),
-                         /*FIXME: where do we want to insert ? */
-                         p_playlist->p_local_category, VLC_TRUE );
+        playlist_Import( p_playlist, dialog.GetPath().mb_str() );
     }
 }
 
index 25f1d0a336a488cd83bd8ec9ff733c938083152b..a59a0a7fcd915fafb55b542c6b5416e16582ead4 100644 (file)
@@ -1640,8 +1640,8 @@ void WizardDialog::Run()
             snprintf( psz_ttl, 20, "ttl=%i",i_ttl );
             input_ItemAddOption( p_input, psz_ttl );
 
-            playlist_PlaylistAddInput( p_playlist, p_input,
-                                       PLAYLIST_GO, PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_input,
+                               PLAYLIST_GO, PLAYLIST_END, VLC_TRUE );
             vlc_object_release(p_playlist);
         }
         else
index 01f6d7be4407abc56086efab7b75c01665d47738..229fe0356dd4e61257e32f0c22da692cf127244b 100644 (file)
@@ -1303,9 +1303,9 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
     {
         char *psz_utf8 = wxDnDFromLocale( filenames[i] );
 
-        playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
+        playlist_Add( p_playlist, psz_utf8, NULL,
                       PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO),
-                      PLAYLIST_END );
+                      PLAYLIST_END, VLC_TRUE );
 
         wxDnDLocaleFree( psz_utf8 );
     }
index 6cf1693639f66af134c5148e6544ecb9653c96f9..3f46810e4ff7590a28094a6efa5dbe933fee5d9b 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 #include <vlc/vlc.h>
+#include <vlc_playlist.h>
 #include <vlc/input.h>
 #include <vlc_meta.h>
 
index dc521a41a78b50143b1fbca0d694da6867ce9842..89f04d2133b1db36ee784646e2d2e0067c00473b 100644 (file)
@@ -41,6 +41,7 @@
 #include <libvlc_internal.h>
 
 #include <vlc_error.h>
+#include <vlc_playlist.h>
 
 #include "audio_output.h"
 #include "vlc_video.h"
@@ -314,9 +315,9 @@ int VLC_AddTarget( int i_object, char const *psz_target,
 {
     int i_err;
     LIBVLC_PLAYLIST_FUNC;
-    i_err = playlist_PlaylistAddExt( p_libvlc->p_playlist, psz_target,
-                                     NULL,  i_mode, i_pos, -1,
-                                     ppsz_options, i_options );
+    i_err = playlist_AddExt( p_libvlc->p_playlist, psz_target,
+                             NULL,  i_mode, i_pos, -1,
+                             ppsz_options, i_options, VLC_TRUE );
     LIBVLC_PLAYLIST_FUNC_END;
     return i_err;
 }
index 1b2860e211c259654d3a00845ff85ca3fc9a8117..8fde1f56cb3e8caf78d4a4570e7612aadfe33b3d 100644 (file)
@@ -354,17 +354,17 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
                 }
                 if( i_opt || config_GetInt( p_this, "playlist-enqueue" ) )
                 {
-                  playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt],
+                  playlist_AddExt( p_playlist, ppsz_argv[i_opt],
                     NULL, PLAYLIST_APPEND ,
                     PLAYLIST_END, -1,
                     (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
-                    i_options );
+                    i_options, VLC_TRUE );
                 } else {
-                  playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt],
+                  playlist_AddExt( p_playlist, ppsz_argv[i_opt],
                     NULL, PLAYLIST_APPEND | PLAYLIST_GO,
                     PLAYLIST_END, -1,
                     (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
-                    i_options );
+                    i_options, VLC_TRUE );
                 }
 
                 i_opt += i_options;
index 2810d5522b10fe04590b8825215ae0f87733fe72..5cfbb264258addc81ecf398e8371a32182d423ca 100644 (file)
@@ -180,7 +180,7 @@ void playlist_LockClear( playlist_t *p_playlist )
  */
 int playlist_Add( playlist_t *p_playlist, const char *psz_uri,
                   const char *psz_name, int i_mode, int i_pos,
-                  vlc_bool_t b_playlist  )
+                  vlc_bool_t b_playlist )
 {
     return playlist_AddExt( p_playlist, psz_uri, psz_name,
                             i_mode, i_pos, -1, NULL, 0, b_playlist );
@@ -275,7 +275,8 @@ int playlist_BothAddInput( playlist_t *p_playlist,
     }
     for( i_top = 0 ; i_top < p_playlist->p_root_onelevel->i_children; i_top++ )
     {
-        if( p_playlist->p_root_onelevel->pp_children[i_top]->p_input->i_id == p_up->p_input->i_id )
+        if( p_playlist->p_root_onelevel->pp_children[i_top]->p_input->i_id ==
+                             p_up->p_input->i_id )
         {
             AddItem( p_playlist, p_item_one,
                      p_playlist->p_root_onelevel->pp_children[i_top], i_pos );
@@ -288,39 +289,6 @@ int playlist_BothAddInput( playlist_t *p_playlist,
     return VLC_SUCCESS;
 }
 
-/**
- * Add an item where it should be added, when adding from a node
- * (ex: directory access, playlist demuxers, services discovery, ... )
- * \param p_playlist the playlist
- * \param p_input the input to add
- * \param p_parent the direct node
- * \param p_item_in_category the item within category root (as returned by playlist_ItemToNode)
- * \param b_forced_parent Are we forced to add only to p_parent ?
- */
-void playlist_AddWhereverNeeded( playlist_t *p_playlist, input_item_t *p_input,
-                                 playlist_item_t *p_parent,
-                                 playlist_item_t *p_item_in_category,
-                                 vlc_bool_t b_forced_parent, int i_mode )
-{
-    /* If we have forced a parent :
-     *   - Just add the input to the forced parent (which should be p_parent)
-     * Else
-     *    - If we have item in category, add to it, and to onelevel (bothadd)
-     *    - If we don't, just add to p_parent
-     */
-    if( b_forced_parent == VLC_TRUE || !p_item_in_category  )
-    {
-        playlist_NodeAddInput( p_playlist, p_input, p_parent, i_mode,
-                               PLAYLIST_END );
-    }
-    else
-    {
-        playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
-                               i_mode, PLAYLIST_END );
-    }
-}
-
-
 /** Add an input item to a given node */
 playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
                                          input_item_t *p_input,
@@ -342,15 +310,6 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
     return p_item;
 }
 
-/** Add a playlist item to a given node */
-void playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
-                           playlist_item_t *p_parent, int i_mode, int i_pos )
-{
-    vlc_mutex_lock( &p_playlist->object_lock );
-    AddItem( p_playlist, p_item, p_parent, i_pos );
-    vlc_mutex_unlock( &p_playlist->object_lock );
-}
-
 /*****************************************************************************
  * Playlist item misc operations
  *****************************************************************************/
@@ -395,7 +354,9 @@ playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
                                             p_playlist, p_item->p_input->i_id,
                                             p_playlist->p_root_onelevel,
                                             VLC_TRUE );
+        assert( p_item_in_one );
         ChangeToNode( p_playlist, p_item_in_category );
+        /* Item in one is a root, change it to node */
         if( p_item_in_one->p_parent == p_playlist->p_root_onelevel )
             ChangeToNode( p_playlist, p_item_in_one );
         else
index aa898d7f5205b1b31c8ce74bc727c84278db4a38..6ec5ccfade05ab3310967faabe6a6fa8d666621a 100644 (file)
 #include "charset.h"
 #include <errno.h>
 
-/**
- * Import a playlist file at a given point of a given view
- * \param p_playlist the playlist to which the new items will be added
- * \param psz_filename the name of the playlistfile to import
- * \return VLC_SUCCESS on success
- */
-int playlist_Import( playlist_t * p_playlist, const char *psz_filename,
-                     playlist_item_t *p_root, vlc_bool_t b_only_there )
-{
-    char *psz_uri, *psz_opt;
-    input_item_t *p_input;
-
-    asprintf( &psz_uri, "file/playlist://%s", psz_filename );
-    p_input = input_ItemNewExt( p_playlist, psz_uri, "playlist", 0, NULL, -1 );
-    if( b_only_there )
-    {
-        asprintf( &psz_opt, "parent-item=%i", p_root->i_id );
-        input_ItemAddOption( p_input, psz_opt );
-        free( psz_opt );
-    }
-    playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_APPEND,
-                               PLAYLIST_END );
-    input_Read( p_playlist, p_input, VLC_TRUE );
-    free( psz_uri );
-    return VLC_SUCCESS;
-}
-
 /**
  * Export a node of the playlist to a certain type of playlistfile
  *