#define _VLC__INPUT_H 1
#include <vlc_es.h>
-#include <vlc_playlist.h>
#include <vlc_meta.h>
struct vlc_meta_t;
#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);
#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;
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 */
/** 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;
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 * ) );
/********************************************************
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 *) );
/***********************************************************************
* 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 )
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 *);
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;
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
# 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
# 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
# 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.
((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; \
((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; \
((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; \
(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; \
(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; \
}
}
#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 );
}
*****************************************************************************/
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])
{
}
}
- 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 ) )
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 );
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 );
}
}
}
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 );
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 */ );
}
/****************************************************************************
}
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 );
}
}
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 );
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" ) &&
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" ) )
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
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 */
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;
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;
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;
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 );
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 )) )
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 );
playlist_t *p_playlist;
playlist_item_t *p_current;
playlist_item_t *p_item_in_category;
- int i_parent_id;
};
/*****************************************************************************
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 ) ) )
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;
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" );
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 );
}
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;
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 );
}
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;
-}
* 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 * );
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 );
-
int i_item = -1;
int i_new_item = 0;
int i_key_length;
+ input_item_t *p_input;
INIT_PLAYLIST_STUFF;
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
{
{
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;
}
char *psz_item_subtitle = NULL;
char *psz_item_summary = NULL;
int i_type;
+ input_item_t *p_input;
INIT_PLAYLIST_STUFF;
"%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 );
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;
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;
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 );
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 );
}
}
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;
}
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;
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 );
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 );
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 )
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;
*/
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;
}
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;
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 )
{
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();
}
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 );
}
}
[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];
}
/* 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 )
{
@"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 )
{
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();
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 );
}
}
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);
}
}
{
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 );
}
}
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 );
}
}
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()
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 );
}
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;
}
}
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 );
}
}
{
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() );
}
{
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 );
}
}
{
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 );
}
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 );
}
}
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() );
}
}
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
{
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 );
}
* 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>
#include <libvlc_internal.h>
#include <vlc_error.h>
+#include <vlc_playlist.h>
#include "audio_output.h"
#include "vlc_video.h"
{
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;
}
}
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;
*/
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 );
}
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 );
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,
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
*****************************************************************************/
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
#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
*