* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#if !defined( __LIBVLC__ )
+ #error You are not libvlc or one of its plugins. You cannot include this file
+#endif
+
#ifndef _VLC_PLAYLIST_H_
#define _VLC_PLAYLIST_H_
+# ifdef __cplusplus
+extern "C" {
+# endif
+
#include <assert.h>
#include <vlc_input.h>
#include <stdio.h>
TYPEDEF_ARRAY(playlist_item_t*, playlist_item_array_t);
TYPEDEF_ARRAY(input_item_t*, input_item_array_t);
+
/**
* \file
* This file contain structures and function prototypes related
/** playlist item / node */
struct playlist_item_t
{
- input_item_t *p_input; /**< input item descriptor */
-
- /* Tree specific fields */
- int i_children; /**< Number of children
- -1 if not a node */
+ input_item_t *p_input; /**< Linked input item */
+ /** Number of children, -1 if not a node */
+ int i_children;
playlist_item_t **pp_children; /**< Children nodes/items */
playlist_item_t *p_parent; /**< Item parent */
int i_id; /**< Playlist item specific id */
-
uint8_t i_flags; /**< Flags */
};
* Prototypes
*****************************************************************************/
-/* Global thread */
-#define playlist_ThreadCreate(a) __playlist_ThreadCreate(VLC_OBJECT(a))
-void __playlist_ThreadCreate ( vlc_object_t * );
-int playlist_ThreadDestroy ( playlist_t * );
-
/* Helpers */
#define PL_LOCK vlc_mutex_lock( &p_playlist->object_lock );
#define PL_UNLOCK vlc_mutex_unlock( &p_playlist->object_lock );
#define playlist_Prev(p) playlist_Control(p,PLAYLIST_SKIP, VLC_FALSE, -1)
#define playlist_Skip(p,i) playlist_Control(p,PLAYLIST_SKIP, VLC_FALSE, i)
-VLC_EXPORT( int, playlist_Control, ( playlist_t *, int, vlc_bool_t, ... ) );
+/**
+ * Do a playlist action.
+ * If there is something in the playlist then you can do playlist actions.
+ * Possible queries are listed in vlc_common.h
+ * \param p_playlist the playlist to do the command on
+ * \param i_query the command to do
+ * \param b_locked TRUE if playlist is locked when entering this function
+ * \param variable number of arguments
+ * \return VLC_SUCCESS or an error
+ */
+VLC_EXPORT( int, playlist_Control, ( playlist_t *p_playlist, int i_query, vlc_bool_t b_locked, ... ) );
+/** Clear the playlist
+ * \param b_locked TRUE if playlist is locked when entering this function
+ */
VLC_EXPORT( void, playlist_Clear, ( playlist_t *, vlc_bool_t ) );
+/** Enqueue an input item for preparsing */
VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *) );
+
+/** Enqueue a playlist item and all of its children if any for preparsing */
VLC_EXPORT( int, playlist_PreparseEnqueueItem, (playlist_t *, playlist_item_t *) );
+/** Request the art for an input item to be fetched */
VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t *) );
-/* Services discovery */
+/********************** Services discovery ***********************/
+/** Add a list of comma-separated service discovery modules */
VLC_EXPORT( int, playlist_ServicesDiscoveryAdd, (playlist_t *, const char *));
+/** Remove a services discovery module by name */
VLC_EXPORT( int, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *));
-VLC_EXPORT( int, playlist_AddSDModules, (playlist_t *, char *));
+/** Check whether a given SD is loaded */
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 ) );
-/* Save a playlist file */
-VLC_EXPORT( int, playlist_Export, ( playlist_t *, const char *, playlist_item_t *, const char * ) );
+/**
+ * Export a node of the playlist to a certain type of playlistfile
+ * \param p_playlist the playlist to export
+ * \param psz_filename the location where the exported file will be saved
+ * \param p_export_root the root node to export
+ * \param psz_type the type of playlist file to create (m3u, pls, ..)
+ * \return VLC_SUCCESS on success
+ */
+VLC_EXPORT( int, playlist_Export, ( playlist_t *p_playlist, const char *psz_name, playlist_item_t *p_export_root, const char *psz_type ) );
/********************************************************
* Item management
VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int , const char *const *, 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_ItemNew( a , b, c ) \
+ playlist_ItemNewWithType( VLC_OBJECT(a) , b , c, 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_DeleteFromInput, ( playlist_t *, int, vlc_bool_t ) );
/*************************** Item fields accessors **************************/
VLC_EXPORT( int, playlist_ItemSetName, (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 *const *,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( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int, int*, int* ) );
+VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char *, int, int, vlc_bool_t, vlc_bool_t ) );
+VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char *const *,int, vlc_bool_t, vlc_bool_t ) );
+VLC_EXPORT( int, playlist_AddInput, ( playlist_t *, input_item_t *, int, int, vlc_bool_t, vlc_bool_t ) );
+VLC_EXPORT( playlist_item_t *, playlist_NodeAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int, vlc_bool_t ) );
+VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int, int*, int*, vlc_bool_t ) );
/********************** Misc item operations **********************/
VLC_EXPORT( playlist_item_t*, playlist_ItemToNode, (playlist_t *,playlist_item_t *, vlc_bool_t) );
vlc_bool_t );
/********************************** Item search *************************/
-VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int, vlc_bool_t) );
+VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int, vlc_bool_t ) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t *, vlc_bool_t ) );
+VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInputId, (playlist_t *, int, playlist_item_t *) );
VLC_EXPORT( int, playlist_LiveSearchUpdate, (playlist_t *, playlist_item_t *, const char *) );
VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
/* Node management */
-VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, const char *, playlist_item_t * p_parent ) );
+VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, const char *, playlist_item_t * p_parent, int i_flags ) );
VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_item_t *, int) );
VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeEmpty, ( playlist_t *, playlist_item_t *, vlc_bool_t ) );
VLC_EXPORT( void, playlist_NodesPairCreate, (playlist_t *, const char *, playlist_item_t **, playlist_item_t **, vlc_bool_t ) );
VLC_EXPORT( playlist_item_t *, playlist_GetPreferredNode, ( playlist_t *p_playlist, playlist_item_t *p_node ) );
+VLC_EXPORT( playlist_item_t *, playlist_GetNextLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, vlc_bool_t b_ena, vlc_bool_t b_unplayed ) );
+VLC_EXPORT( playlist_item_t *, playlist_GetPrevLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, vlc_bool_t b_ena, vlc_bool_t b_unplayed ) );
+VLC_EXPORT( playlist_item_t *, playlist_GetLastLeaf, ( playlist_t *p_playlist, playlist_item_t *p_root ) );
/***********************************************************************
* Inline functions
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 );
+ VLC_TRUE, VLC_FALSE );
input_Read( p_playlist, p_input, VLC_TRUE );
return VLC_SUCCESS;
}
}
/** @} */
+# ifdef __cplusplus
+}
+# endif
#endif