mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
* Remove some unneeded complexity in playlist and directory
* Remove some unneeded wrappers and locking
This commit is contained in:
parent
d1b0d5205f
commit
673861da5c
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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; \
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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;
|
||||
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);
|
||||
|
||||
char *psz_name = strdup (p_access->psz_path);
|
||||
if (psz_name == NULL)
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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 */ );
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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" ) )
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 )
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -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() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -27,33 +27,6 @@
|
||||
#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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user