Commit e6e82bda authored by zorglub's avatar zorglub

Add functions to use the media library

parent af1c0e0a
......@@ -245,76 +245,131 @@ VLC_EXPORT( int, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *))
VLC_EXPORT( int, playlist_AddSDModules, (playlist_t *, char *));
VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *));
/* Playlist sorting */
VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) );
VLC_EXPORT( int, playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
VLC_EXPORT( int, playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
/* Load/Save */
VLC_EXPORT( int, playlist_Import, ( playlist_t *, const char *, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( int, playlist_Export, ( playlist_t *, const char *, playlist_item_t *, const char * ) );
/********************************************************
* Item management
********************************************************/
/*************************** Item creation **************************/
/* Item management functions (act on items) */
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int , const char **, int, int) );
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
/** Create a new item, without adding it to the playlist
* \param p_obj a vlc object (anyone will do)
* \param psz_uri the mrl of the item
* \param psz_name a text giving a name or description of the item
* \return the new item or NULL on failure
*/
static inline playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
const char *psz_uri, const char *psz_name )
{
/* 0 = ITEM_TYPE_UNKNOWN */
return playlist_ItemNewWithType( p_obj, psz_uri, psz_name, 0, NULL, -1,0);
}
#define playlist_ItemNewFromInput(a,b) __playlist_ItemNewFromInput(VLC_OBJECT(a),b)
VLC_EXPORT( playlist_item_t *, __playlist_ItemNewFromInput, ( vlc_object_t *p_obj,input_item_t *p_input ) );
/*************************** Item deletion **************************/
VLC_EXPORT( int, playlist_ItemDelete, ( playlist_item_t * ) );
VLC_EXPORT( int, playlist_DeleteAllFromInput, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_DeleteFromInput, ( playlist_t *, int, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( int, playlist_DeleteFromItemId, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_LockDelete, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_LockDeleteAllFromInput, ( playlist_t *, int ) );
/* Item informations accessors */
/*************************** Item fields accessors **************************/
VLC_EXPORT( int, playlist_ItemSetName, (playlist_item_t *, char * ) );
VLC_EXPORT( int, playlist_ItemSetDuration, (playlist_item_t *, mtime_t ) );
VLC_EXPORT( void, playlist_ItemAddOption, (playlist_item_t *, const char *) );
/******************** Item addition ********************/
VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char *, int, int, vlc_bool_t ) );
VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int, vlc_bool_t ) );
VLC_EXPORT( int, playlist_AddInput, ( playlist_t *, input_item_t *,int , int, vlc_bool_t ) );
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 ) );
VLC_EXPORT(void, playlist_NodeDump, ( playlist_t *p_playlist, playlist_item_t *p_item, int i_level ) );
/** 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);
}
/** Counts the items of a view */
VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
/** 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 );
}
/* Node management */
VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, char *, playlist_item_t * p_parent ) );
VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_item_t *, int) );
VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( void, playlist_NodesCreateForSD, (playlist_t *, char *, playlist_item_t **, playlist_item_t ** ) );
/** 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 );
}
/* Tree walking - These functions are only for playlist, not plugins */
playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
playlist_item_t *p_root,
playlist_item_t *p_item );
playlist_item_t *playlist_GetNextEnabledLeaf( playlist_t *p_playlist,
playlist_item_t *p_root,
playlist_item_t *p_item );
playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
playlist_item_t *p_root,
playlist_item_t *p_item );
playlist_item_t *playlist_GetLastLeaf( playlist_t *p_playlist,
playlist_item_t *p_root );
/** 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 );
}
/* Simple add/remove functions */
VLC_EXPORT( int, playlist_PlaylistAdd, ( playlist_t *, const char *, const char *, int, int ) );
VLC_EXPORT( int, playlist_PlaylistAddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int ) );
VLC_EXPORT( int, playlist_PlaylistAddInput, ( playlist_t *, input_item_t *,int , int ) );
VLC_EXPORT( playlist_item_t *, playlist_NodeAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int ) );
VLC_EXPORT( void, playlist_NodeAddItem, ( playlist_t *, playlist_item_t *, playlist_item_t *,int , int ) );
VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int ) );
VLC_EXPORT( void, playlist_AddWhereverNeeded, (playlist_t* , input_item_t*, playlist_item_t*,playlist_item_t*,vlc_bool_t, int ) );
/** 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 );
}
void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id, int i_node_id );
/* Misc item operations (act on item+playlist) */
VLC_EXPORT( int, playlist_DeleteAllFromInput, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_DeleteFromInput, ( playlist_t *, int, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( int, playlist_DeleteFromItemId, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_LockDelete, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_LockDeleteAllFromInput, ( playlist_t *, int ) );
/********************** Misc item operations **********************/
VLC_EXPORT( playlist_item_t*, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
VLC_EXPORT( playlist_item_t*, playlist_LockItemToNode, (playlist_t *,playlist_item_t *) );
playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
int i_input_id, playlist_item_t *p_root );
/* Item search functions */
/********************************** Item search *************************/
VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) );
......@@ -340,14 +395,34 @@ static inline playlist_item_t *playlist_LockItemGetByInput(
VLC_EXPORT( int, playlist_LiveSearchUpdate, (playlist_t *, playlist_item_t *, const char *) );
/* Playlist sorting */
VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) );
VLC_EXPORT( int, playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
VLC_EXPORT( int, playlist_RecursiveNodeSort, ( playlist_t *, playlist_item_t *,int, int ) );
/********************************************************
* Tree management
********************************************************/
VLC_EXPORT(void, playlist_NodeDump, ( playlist_t *p_playlist, playlist_item_t *p_item, int i_level ) );
VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
/* 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 * ) );
/* Node management */
VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, char *, playlist_item_t * p_parent ) );
VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_item_t *, int) );
VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( playlist_item_t *, playlist_ChildSearchName, (playlist_item_t*, const char* ) );
VLC_EXPORT( int, playlist_NodeDelete, ( playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t ) );
VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( void, playlist_NodesCreateForSD, (playlist_t *, char *, playlist_item_t **, playlist_item_t ** ) );
/* Tree walking - These functions are only for playlist, not plugins */
playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
playlist_item_t *p_root,
playlist_item_t *p_item );
playlist_item_t *playlist_GetNextEnabledLeaf( playlist_t *p_playlist,
playlist_item_t *p_root,
playlist_item_t *p_item );
playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
playlist_item_t *p_root,
playlist_item_t *p_item );
playlist_item_t *playlist_GetLastLeaf( playlist_t *p_playlist,
playlist_item_t *p_root );
/***********************************************************************
* Inline functions
......
......@@ -265,14 +265,14 @@ struct module_symbols_t
int (*playlist_ServicesDiscoveryRemove_inner) (playlist_t *, const char *);
int (*playlist_AddSDModules_inner) (playlist_t *, char *);
vlc_bool_t (*playlist_IsServicesDiscoveryLoaded_inner) (playlist_t *,const char *);
playlist_item_t* (*__playlist_ItemNew_inner) (vlc_object_t *,const char *,const char *);
void *__playlist_ItemNew_deprecated;
void *__playlist_ItemCopy_deprecated;
playlist_item_t* (*playlist_ItemNewWithType_inner) (vlc_object_t *,const char *,const char *, int , const char **, int, int);
int (*playlist_ItemDelete_inner) (playlist_item_t *);
void *playlist_ItemAddParent_deprecated;
void *playlist_CopyParents_deprecated;
int (*playlist_ItemSetName_inner) (playlist_item_t *, char *);
int (*playlist_ItemSetDuration_inner) (playlist_item_t *, mtime_t);
void *playlist_ItemSetDuration_deprecated;
void *playlist_ViewInsert_deprecated;
void *playlist_ViewDelete_deprecated;
void *playlist_ViewFind_deprecated;
......@@ -287,8 +287,8 @@ struct module_symbols_t
playlist_item_t * (*playlist_ChildSearchName_inner) (playlist_item_t*, const char*);
int (*playlist_NodeDelete_inner) (playlist_t *, playlist_item_t *, vlc_bool_t , vlc_bool_t);
int (*playlist_NodeEmpty_inner) (playlist_t *, playlist_item_t *, vlc_bool_t);
void *playlist_Add_deprecated;
void *playlist_AddExt_deprecated;
int (*playlist_Add_inner) (playlist_t *, const char *, const char *, int, int, vlc_bool_t);
int (*playlist_AddExt_inner) (playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int, vlc_bool_t);
void *playlist_ItemAdd_deprecated;
void (*playlist_NodeAddItem_inner) (playlist_t *, playlist_item_t *, playlist_item_t *,int , int);
void *playlist_Delete_deprecated;
......@@ -306,7 +306,7 @@ struct module_symbols_t
playlist_item_t * (*playlist_ItemGetByInput_inner) (playlist_t *,input_item_t *);
void *playlist_LockItemGetByInput_deprecated;
void *playlist_GetPositionById_deprecated;
void (*playlist_ItemAddOption_inner) (playlist_item_t *, const char *);
void *playlist_ItemAddOption_deprecated;
void *playlist_Sort_deprecated;
void *playlist_Move_deprecated;
void *playlist_NodeGroup_deprecated;
......@@ -495,9 +495,9 @@ struct module_symbols_t
input_item_t * (*__input_ItemNewExt_inner) (vlc_object_t *, const char *, const char*, int, const char **, int);
input_item_t * (*input_ItemNewWithType_inner) (vlc_object_t *, const char *, const char *e, int, const char **, int, int);
playlist_item_t * (*playlist_NodeAddInput_inner) (playlist_t *, input_item_t *,playlist_item_t *,int , int);
int (*playlist_PlaylistAdd_inner) (playlist_t *, const char *, const char *, int, int);
int (*playlist_PlaylistAddExt_inner) (playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int);
int (*playlist_PlaylistAddInput_inner) (playlist_t *, input_item_t *,int , int);
void *playlist_PlaylistAdd_deprecated;
void *playlist_PlaylistAddExt_deprecated;
void *playlist_PlaylistAddInput_deprecated;
int (*playlist_BothAddInput_inner) (playlist_t *, input_item_t *,playlist_item_t *,int , int);
playlist_item_t * (*__playlist_ItemNewFromInput_inner) (vlc_object_t *p_obj,input_item_t *p_input);
input_item_t * (*input_ItemGetById_inner) (playlist_t *, int);
......@@ -524,6 +524,7 @@ struct module_symbols_t
vlc_bool_t (*__intf_UserProgressIsCancelled_inner) (vlc_object_t*, int);
int (*__intf_Progress_inner) (vlc_object_t*, const char*, const char*, float, int);
void (*__intf_ProgressUpdate_inner) (vlc_object_t*, int, const char*, float, int);
int (*playlist_AddInput_inner) (playlist_t *, input_item_t *,int , int, vlc_bool_t);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -771,11 +772,9 @@ struct module_symbols_t
# define playlist_ServicesDiscoveryRemove (p_symbols)->playlist_ServicesDiscoveryRemove_inner
# define playlist_AddSDModules (p_symbols)->playlist_AddSDModules_inner
# define playlist_IsServicesDiscoveryLoaded (p_symbols)->playlist_IsServicesDiscoveryLoaded_inner
# define __playlist_ItemNew (p_symbols)->__playlist_ItemNew_inner
# define playlist_ItemNewWithType (p_symbols)->playlist_ItemNewWithType_inner
# define playlist_ItemDelete (p_symbols)->playlist_ItemDelete_inner
# define playlist_ItemSetName (p_symbols)->playlist_ItemSetName_inner
# define playlist_ItemSetDuration (p_symbols)->playlist_ItemSetDuration_inner
# define playlist_NodeCreate (p_symbols)->playlist_NodeCreate_inner
# define playlist_NodeAppend (p_symbols)->playlist_NodeAppend_inner
# define playlist_NodeInsert (p_symbols)->playlist_NodeInsert_inner
......@@ -784,13 +783,14 @@ struct module_symbols_t
# define playlist_ChildSearchName (p_symbols)->playlist_ChildSearchName_inner
# define playlist_NodeDelete (p_symbols)->playlist_NodeDelete_inner
# define playlist_NodeEmpty (p_symbols)->playlist_NodeEmpty_inner
# define playlist_Add (p_symbols)->playlist_Add_inner
# define playlist_AddExt (p_symbols)->playlist_AddExt_inner
# define playlist_NodeAddItem (p_symbols)->playlist_NodeAddItem_inner
# define playlist_LockDelete (p_symbols)->playlist_LockDelete_inner
# define playlist_ItemToNode (p_symbols)->playlist_ItemToNode_inner
# define playlist_LockItemToNode (p_symbols)->playlist_LockItemToNode_inner
# define playlist_ItemGetById (p_symbols)->playlist_ItemGetById_inner
# define playlist_ItemGetByInput (p_symbols)->playlist_ItemGetByInput_inner
# define playlist_ItemAddOption (p_symbols)->playlist_ItemAddOption_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
......@@ -967,9 +967,6 @@ struct module_symbols_t
# define __input_ItemNewExt (p_symbols)->__input_ItemNewExt_inner
# define input_ItemNewWithType (p_symbols)->input_ItemNewWithType_inner
# define playlist_NodeAddInput (p_symbols)->playlist_NodeAddInput_inner
# define playlist_PlaylistAdd (p_symbols)->playlist_PlaylistAdd_inner
# define playlist_PlaylistAddExt (p_symbols)->playlist_PlaylistAddExt_inner
# define playlist_PlaylistAddInput (p_symbols)->playlist_PlaylistAddInput_inner
# define playlist_BothAddInput (p_symbols)->playlist_BothAddInput_inner
# define __playlist_ItemNewFromInput (p_symbols)->__playlist_ItemNewFromInput_inner
# define input_ItemGetById (p_symbols)->input_ItemGetById_inner
......@@ -990,6 +987,7 @@ struct module_symbols_t
# define __intf_UserProgressIsCancelled (p_symbols)->__intf_UserProgressIsCancelled_inner
# define __intf_Progress (p_symbols)->__intf_Progress_inner
# define __intf_ProgressUpdate (p_symbols)->__intf_ProgressUpdate_inner
# define playlist_AddInput (p_symbols)->playlist_AddInput_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1240,11 +1238,9 @@ struct module_symbols_t
((p_symbols)->playlist_ServicesDiscoveryRemove_inner) = playlist_ServicesDiscoveryRemove; \
((p_symbols)->playlist_AddSDModules_inner) = playlist_AddSDModules; \
((p_symbols)->playlist_IsServicesDiscoveryLoaded_inner) = playlist_IsServicesDiscoveryLoaded; \
((p_symbols)->__playlist_ItemNew_inner) = __playlist_ItemNew; \
((p_symbols)->playlist_ItemNewWithType_inner) = playlist_ItemNewWithType; \
((p_symbols)->playlist_ItemDelete_inner) = playlist_ItemDelete; \
((p_symbols)->playlist_ItemSetName_inner) = playlist_ItemSetName; \
((p_symbols)->playlist_ItemSetDuration_inner) = playlist_ItemSetDuration; \
((p_symbols)->playlist_NodeCreate_inner) = playlist_NodeCreate; \
((p_symbols)->playlist_NodeAppend_inner) = playlist_NodeAppend; \
((p_symbols)->playlist_NodeInsert_inner) = playlist_NodeInsert; \
......@@ -1253,13 +1249,14 @@ struct module_symbols_t
((p_symbols)->playlist_ChildSearchName_inner) = playlist_ChildSearchName; \
((p_symbols)->playlist_NodeDelete_inner) = playlist_NodeDelete; \
((p_symbols)->playlist_NodeEmpty_inner) = playlist_NodeEmpty; \
((p_symbols)->playlist_Add_inner) = playlist_Add; \
((p_symbols)->playlist_AddExt_inner) = playlist_AddExt; \
((p_symbols)->playlist_NodeAddItem_inner) = playlist_NodeAddItem; \
((p_symbols)->playlist_LockDelete_inner) = playlist_LockDelete; \
((p_symbols)->playlist_ItemToNode_inner) = playlist_ItemToNode; \
((p_symbols)->playlist_LockItemToNode_inner) = playlist_LockItemToNode; \
((p_symbols)->playlist_ItemGetById_inner) = playlist_ItemGetById; \
((p_symbols)->playlist_ItemGetByInput_inner) = playlist_ItemGetByInput; \
((p_symbols)->playlist_ItemAddOption_inner) = playlist_ItemAddOption; \
((p_symbols)->playlist_NodeSort_inner) = playlist_NodeSort; \
((p_symbols)->playlist_RecursiveNodeSort_inner) = playlist_RecursiveNodeSort; \
((p_symbols)->playlist_Import_inner) = playlist_Import; \
......@@ -1436,9 +1433,6 @@ struct module_symbols_t
((p_symbols)->__input_ItemNewExt_inner) = __input_ItemNewExt; \
((p_symbols)->input_ItemNewWithType_inner) = input_ItemNewWithType; \
((p_symbols)->playlist_NodeAddInput_inner) = playlist_NodeAddInput; \
((p_symbols)->playlist_PlaylistAdd_inner) = playlist_PlaylistAdd; \
((p_symbols)->playlist_PlaylistAddExt_inner) = playlist_PlaylistAddExt; \
((p_symbols)->playlist_PlaylistAddInput_inner) = playlist_PlaylistAddInput; \
((p_symbols)->playlist_BothAddInput_inner) = playlist_BothAddInput; \
((p_symbols)->__playlist_ItemNewFromInput_inner) = __playlist_ItemNewFromInput; \
((p_symbols)->input_ItemGetById_inner) = input_ItemGetById; \
......@@ -1459,18 +1453,19 @@ struct module_symbols_t
((p_symbols)->__intf_UserProgressIsCancelled_inner) = __intf_UserProgressIsCancelled; \
((p_symbols)->__intf_Progress_inner) = __intf_Progress; \
((p_symbols)->__intf_ProgressUpdate_inner) = __intf_ProgressUpdate; \
((p_symbols)->playlist_AddInput_inner) = playlist_AddInput; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__playlist_ItemNew_deprecated = NULL; \
(p_symbols)->__playlist_ItemCopy_deprecated = NULL; \
(p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
(p_symbols)->playlist_CopyParents_deprecated = NULL; \
(p_symbols)->playlist_ItemSetDuration_deprecated = NULL; \
(p_symbols)->playlist_ViewInsert_deprecated = NULL; \
(p_symbols)->playlist_ViewDelete_deprecated = NULL; \
(p_symbols)->playlist_ViewFind_deprecated = NULL; \
(p_symbols)->playlist_ViewUpdate_deprecated = NULL; \
(p_symbols)->playlist_ViewDump_deprecated = NULL; \
(p_symbols)->playlist_ViewEmpty_deprecated = NULL; \
(p_symbols)->playlist_Add_deprecated = NULL; \
(p_symbols)->playlist_AddExt_deprecated = NULL; \
(p_symbols)->playlist_ItemAdd_deprecated = NULL; \
(p_symbols)->playlist_Delete_deprecated = NULL; \
(p_symbols)->playlist_Disable_deprecated = NULL; \
......@@ -1482,6 +1477,7 @@ struct module_symbols_t
(p_symbols)->playlist_LockItemGetByPos_deprecated = NULL; \
(p_symbols)->playlist_LockItemGetByInput_deprecated = NULL; \
(p_symbols)->playlist_GetPositionById_deprecated = NULL; \
(p_symbols)->playlist_ItemAddOption_deprecated = NULL; \
(p_symbols)->playlist_Sort_deprecated = NULL; \
(p_symbols)->playlist_Move_deprecated = NULL; \
(p_symbols)->playlist_NodeGroup_deprecated = NULL; \
......@@ -1494,6 +1490,9 @@ struct module_symbols_t
(p_symbols)->stats_HandlerDestroy_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
(p_symbols)->playlist_ItemNewFromInput_deprecated = NULL; \
(p_symbols)->playlist_PlaylistAdd_deprecated = NULL; \
(p_symbols)->playlist_PlaylistAddExt_deprecated = NULL; \
(p_symbols)->playlist_PlaylistAddInput_deprecated = NULL; \
(p_symbols)->__intf_UserOkayCancel_deprecated = NULL; \
(p_symbols)->stats_TimerClean_deprecated = NULL; \
(p_symbols)->stats_TimersClean_deprecated = NULL; \
......
......@@ -37,42 +37,23 @@ int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
/*****************************************************************************
* Playlist item creation
*****************************************************************************/
/**
* Create a new item, without adding it to the playlist
*
* \param p_obj a vlc object (anyone will do)
* \param psz_uri the mrl of the item
* \param psz_name a text giving a name or description of the item
* \return the new item or NULL on failure
*/
playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
const char *psz_uri,
const char *psz_name )
{
return playlist_ItemNewWithType( p_obj, psz_uri,
psz_name, 0, NULL, -1,
ITEM_TYPE_UNKNOWN );
}
playlist_item_t * playlist_ItemNewWithType( vlc_object_t *p_obj,
const char *psz_uri,
const char *psz_name,
int i_options,
const char **ppsz_options,
int i_duration,
int i_type )
int i_duration, int i_type )
{
input_item_t *p_input;
if( psz_uri == NULL ) return NULL;
p_input = input_ItemNewWithType( p_obj, psz_uri,
psz_name, i_options, ppsz_options,
i_duration, i_type );
psz_name, i_options, ppsz_options,
i_duration, i_type );
return playlist_ItemNewFromInput( p_obj, p_input );
}
playlist_item_t *__playlist_ItemNewFromInput( vlc_object_t *p_obj,
input_item_t *p_input )
input_item_t *p_input )
{
/** FIXME !!!!! don't find playlist each time */
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_obj, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
......@@ -185,10 +166,7 @@ void playlist_LockClear( playlist_t *p_playlist )
/***************************************************************************
* Playlist item addition
***************************************************************************/
/**
* Add a MRL into the playlist.
*
/** Add an item to the playlist or the media library
* \param p_playlist the playlist to add into
* \param psz_uri the mrl to add to the playlist
* \param psz_name a text giving a name or description of this item
......@@ -196,17 +174,19 @@ void playlist_LockClear( playlist_t *p_playlist )
* \param i_pos the position in the playlist where to add. If this is
* PLAYLIST_END the item will be added at the end of the playlist
* regardless of it's size
* \param b_playlist TRUE for playlist, FALSE for media library
* \return The id of the playlist item
*/
int playlist_PlaylistAdd( playlist_t *p_playlist, const char *psz_uri,
const char *psz_name, int i_mode, int i_pos )
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 )
{
return playlist_PlaylistAddExt( p_playlist, psz_uri, psz_name,
i_mode, i_pos, -1, NULL, 0 );
return playlist_AddExt( p_playlist, psz_uri, psz_name,
i_mode, i_pos, -1, NULL, 0, b_playlist );
}
/**
* Add a MRL into the playlist, duration and options given
* Add a MRL into the playlist or the media library, duration and options given
*
* \param p_playlist the playlist to add into
* \param psz_uri the mrl to add to the playlist
......@@ -218,40 +198,44 @@ int playlist_PlaylistAdd( playlist_t *p_playlist, const char *psz_uri,
* \param i_duration length of the item in milliseconds.
* \param ppsz_options an array of options
* \param i_options the number of options
* \param b_playlist TRUE for playlist, FALSE for media library
* \return The id of the playlist item
*/
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 )
int playlist_AddExt( 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, vlc_bool_t b_playlist )
{
input_item_t *p_input = input_ItemNewExt( p_playlist, psz_uri, psz_name,
i_options, ppsz_options,
i_duration );
return playlist_PlaylistAddInput( p_playlist, p_input, i_mode, i_pos );
return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, b_playlist );
}
/** Add an input item to the playlist node */
int playlist_PlaylistAddInput( playlist_t* p_playlist, input_item_t *p_input,
int i_mode, int i_pos )
int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
int i_mode, int i_pos, vlc_bool_t b_playlist )
{
playlist_item_t *p_item_cat, *p_item_one;
msg_Dbg( p_playlist, "adding playlist item `%s' ( %s )",
p_input->psz_name, p_input->psz_uri );
PL_DEBUG( "adding item `%s' ( %s )", p_input->psz_name, p_input->psz_uri );
vlc_mutex_lock( &p_playlist->object_lock );
/* Add to ONELEVEL */
p_item_one = playlist_ItemNewFromInput( p_playlist, p_input );
if( p_item_one == NULL ) return VLC_EGENERIC;
AddItem( p_playlist, p_item_one ,p_playlist->p_local_onelevel, i_pos );
AddItem( p_playlist, p_item_one,
b_playlist ? p_playlist->p_local_onelevel :
p_playlist->p_ml_onelevel , i_pos );
/* Add to CATEGORY */
p_item_cat = playlist_ItemNewFromInput( p_playlist, p_input );
if( p_item_cat == NULL ) return VLC_EGENERIC;
AddItem( p_playlist, p_item_cat, p_playlist->p_local_category, i_pos );
AddItem( p_playlist, p_item_cat,
b_playlist ? p_playlist->p_local_category :
p_playlist->p_ml_category , i_pos );
GoAndPreparse( p_playlist, i_mode, p_item_cat, p_item_one );
......@@ -526,38 +510,6 @@ int playlist_ItemSetName( playlist_item_t *p_item, char *psz_name )
return VLC_EGENERIC;
}
/** Set the duration of a playlist item
* \param i_duration the new duration in microseconds
*/
int playlist_ItemSetDuration( playlist_item_t *p_item, mtime_t i_duration )
{
char psz_buffer[MSTRTIME_MAX_SIZE];
if( p_item )
{
p_item->p_input->i_duration = i_duration;
if( i_duration != -1 )
{
secstotimestr( psz_buffer, (int)(i_duration/1000000) );
}
else
{
memcpy( psz_buffer, "--:--:--", sizeof("--:--:--") );
}
vlc_input_item_AddInfo( p_item->p_input, _("General") , _("Duration"),
"%s", psz_buffer );
return VLC_SUCCESS;
}
return VLC_EGENERIC;
}
/** Add an option to a playlist item */
void playlist_ItemAddOption( playlist_item_t *p_item,
const char *psz_option)
{
vlc_input_item_AddOption( p_item->p_input, psz_option );
}
/***************************************************************************
* The following functions are local
***************************************************************************/
......@@ -604,13 +556,6 @@ void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
{
INSERT_ELEM( p_playlist->pp_items, p_playlist->i_size,
p_playlist->i_size, p_item );
#if 0
fprintf( stderr, "Adding input %s (id %i) - playlist item id %i "
"to node %s (id %i)\n",
p_item->p_input->psz_name, p_item->p_input->i_id,
p_item->i_id, p_node->p_input->psz_name,
p_node->i_id );
#endif
INSERT_ELEM( p_playlist->pp_all_items, p_playlist->i_all_size,
p_playlist->i_all_size, p_item );
p_playlist->i_enabled ++;
......@@ -693,8 +638,7 @@ int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
b_flag = VLC_TRUE;
}
msg_Dbg( p_playlist, "deleting playlist item `%s'",
p_item->p_input->psz_name );
PL_DEBUG( "deleting item `%s'", p_item->p_input->psz_name );
/* Remove the item from its parent */
playlist_NodeRemoveItem( p_playlist, p_item, p_item->p_parent );
......
Markdown is supported
0%