Data Structures | Defines | Typedefs | Enumerations | Functions

Playlist

The VLC playlist system has a tree structure. More...

Data Structures

struct  playlist_private_t
struct  playlist_export_t
 Helper structure to export to file part of the playlist. More...
struct  playlist_item_t
 playlist item / node More...
struct  playlist_t
 Structure containing information about the playlist. More...
struct  playlist_add_t
 Helper to add an item. More...

Defines

#define pl_priv(pl)   ((playlist_private_t *)(pl))
#define VLC_DEFINE_SORT_FUNCTIONS
#define DEF(s)   s,
#define PLAYLIST_INSERT   0x0001
#define PLAYLIST_APPEND   0x0002
#define PLAYLIST_GO   0x0004
#define PLAYLIST_PREPARSE   0x0008
#define PLAYLIST_SPREPARSE   0x0010
#define PLAYLIST_NO_REBUILD   0x0020
#define PLAYLIST_END   -666
#define PL_LOCK   playlist_Lock( p_playlist )
#define PL_UNLOCK   playlist_Unlock( p_playlist )
#define PL_ASSERT_LOCKED   playlist_AssertLocked( p_playlist )
#define pl_Get(a)   pl_Get( VLC_OBJECT(a) )
#define playlist_Play(p)   playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )
#define playlist_Pause(p)   playlist_Control(p,PLAYLIST_PAUSE, pl_Unlocked )
#define playlist_Stop(p)   playlist_Control(p,PLAYLIST_STOP, pl_Unlocked )
#define playlist_Next(p)   playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, 1)
#define playlist_Prev(p)   playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, -1)
#define playlist_Skip(p, i)   playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, (i) )
#define AOUT_VOLUME_DEFAULT   256
#define AOUT_VOLUME_MAX   512
#define playlist_VolumeDown(a, b, c)   playlist_VolumeUp(a, -(b), c)
#define pl_CurrentInput(a)   __pl_CurrentInput( VLC_OBJECT(a) )
 Small helper tp get current playing input or NULL.

Typedefs

typedef struct vlc_sd_internal_t vlc_sd_internal_t
typedef struct playlist_private_t playlist_private_t
typedef struct playlist_export_t playlist_export_t
 Helper structure to export to file part of the playlist.

Enumerations

enum  playlist_item_flags_e {
  PLAYLIST_SAVE_FLAG = 0x0001, PLAYLIST_SKIP_FLAG = 0x0002, PLAYLIST_DBL_FLAG = 0x0004, PLAYLIST_RO_FLAG = 0x0008,
  PLAYLIST_REMOVE_FLAG = 0x0010, PLAYLIST_EXPANDED_FLAG = 0x0020, PLAYLIST_SUBITEM_STOP_FLAG = 0x0040
}
enum  playlist_status_t { PLAYLIST_STOPPED, PLAYLIST_RUNNING, PLAYLIST_PAUSED }
 

Playlist status.

More...
enum  { DEF, NUM_SORT_FNS = SORT_RANDOM }
enum  { ORDER_NORMAL = 0, ORDER_REVERSE = 1 }
enum  pl_locked_state { pl_Locked = true, pl_Unlocked = false }

Functions

void playlist_Destroy (playlist_t *)
 Destroy playlist.
void playlist_Activate (playlist_t *)
 Creates the main playlist thread.
playlist_item_tplaylist_ItemNewFromInput (playlist_t *p_playlist, input_item_t *p_input)
playlist_item_tget_current_status_item (playlist_t *p_playlist)
 Accessor for status item and status nodes.
playlist_item_tget_current_status_node (playlist_t *p_playlist)
void set_current_status_item (playlist_t *, playlist_item_t *)
void set_current_status_node (playlist_t *, playlist_item_t *)
int playlist_MLLoad (playlist_t *p_playlist)
int playlist_MLDump (playlist_t *p_playlist)
void playlist_SendAddNotify (playlist_t *p_playlist, int i_item_id, int i_node_id, bool b_signal)
 Send a notification that an item has been added to a node.
playlist_item_tplaylist_NodeAddInput (playlist_t *, input_item_t *, playlist_item_t *, int, int, bool)
 Add an input item to a given node.
int playlist_InsertInputItemTree (playlist_t *, playlist_item_t *, input_item_node_t *, int, bool)
 Insert a tree of input items into a given playlist node.
playlist_item_tplaylist_ItemFindFromInputAndRoot (playlist_t *p_playlist, input_item_t *p_input, playlist_item_t *p_root, bool)
 Find an item within a root, given its input id.
int playlist_DeleteFromInputInParent (playlist_t *, input_item_t *, playlist_item_t *, bool)
 Delete input item.
int playlist_DeleteFromItemId (playlist_t *, int)
 Delete playlist item.
int playlist_ItemRelease (playlist_item_t *)
 Release an item.
int playlist_NodeEmpty (playlist_t *, playlist_item_t *, bool)
 Remove all the children of a node.
int playlist_DeleteItem (playlist_t *p_playlist, playlist_item_t *, bool)
void ResetCurrentlyPlaying (playlist_t *p_playlist, playlist_item_t *p_cur)
 Reset the currently playing playlist.
void ResyncCurrentIndex (playlist_t *p_playlist, playlist_item_t *p_cur)
 Synchronise the current index of the playlist to match the index of the current item.
playlist_tpl_Get (vlc_object_t *)
void playlist_Lock (playlist_t *)
void playlist_Unlock (playlist_t *)
void playlist_AssertLocked (playlist_t *)
void playlist_Deactivate (playlist_t *)
 Stops the playlist forever (but do not destroy it yet).
int playlist_Control (playlist_t *p_playlist, int i_query, bool b_locked,...)
 Do a playlist action.
input_thread_tplaylist_CurrentInput (playlist_t *p_playlist)
 Get current playing input.
mtime_t playlist_GetNodeDuration (playlist_item_t *)
 Get the duration of all items in a node.
void playlist_Clear (playlist_t *, bool)
 Clear the playlist.
int playlist_PreparseEnqueue (playlist_t *, input_item_t *)
 Enqueue an input item for preparsing.
int playlist_AskForArtEnqueue (playlist_t *, input_item_t *)
 Request the art for an input item to be fetched.
int playlist_TreeMove (playlist_t *, playlist_item_t *, playlist_item_t *, int)
 Moves an item.
int playlist_TreeMoveMany (playlist_t *, int, playlist_item_t **, playlist_item_t *, int)
 Moves an array of items.
int playlist_RecursiveNodeSort (playlist_t *, playlist_item_t *, int, int)
 Sort a node recursively.
playlist_item_tplaylist_CurrentPlayingItem (playlist_t *)
int playlist_Status (playlist_t *)
int playlist_Export (playlist_t *p_playlist, const char *psz_name, playlist_item_t *p_export_root, const char *psz_type)
 Export a node of the playlist to a certain type of playlistfile.
int playlist_Import (playlist_t *p_playlist, const char *psz_file)
 Open a playlist file, add its content to the current playlist.
int playlist_ServicesDiscoveryAdd (playlist_t *, const char *)
 Add a list of comma-separated service discovery modules.
int playlist_ServicesDiscoveryRemove (playlist_t *, const char *)
 Remove a services discovery module by name.
bool playlist_IsServicesDiscoveryLoaded (playlist_t *, const char *)
 Check whether a given SD is loaded.
int playlist_ServicesDiscoveryControl (playlist_t *, const char *, int,...)
 Query a services discovery.
int playlist_DeleteFromInput (playlist_t *, input_item_t *, bool)
 Delete from input.
int playlist_Add (playlist_t *, const char *, const char *, int, int, bool, bool)
 Playlist add.
int playlist_AddExt (playlist_t *, const char *, const char *, int, int, mtime_t, int, const char *const *, unsigned, bool, bool)
 Add a MRL into the playlist or the media library, duration and options given.
int playlist_AddInput (playlist_t *, input_item_t *, int, int, bool, bool)
 Add an input item to the playlist node.
int playlist_NodeAddCopy (playlist_t *, playlist_item_t *, playlist_item_t *, int)
 Copy an item (and all its children, if any) into another node.
playlist_item_tplaylist_ItemGetById (playlist_t *, int)
 Search a playlist item by its playlist_item id.
playlist_item_tplaylist_ItemGetByInput (playlist_t *, input_item_t *)
 Search an item by its input_item_t The playlist have to be locked.
int playlist_LiveSearchUpdate (playlist_t *, playlist_item_t *, const char *, bool)
 Launch the recursive search in the playlist.
playlist_item_tplaylist_NodeCreate (playlist_t *, const char *, playlist_item_t *p_parent, int i_pos, int i_flags, input_item_t *)
 Create a playlist node.
int playlist_NodeAppend (playlist_t *, playlist_item_t *, playlist_item_t *)
 Adds an item to the children of a node.
int playlist_NodeInsert (playlist_t *, playlist_item_t *, playlist_item_t *, int)
int playlist_NodeRemoveItem (playlist_t *, playlist_item_t *, playlist_item_t *)
 Deletes an item from the children of a node.
playlist_item_tplaylist_ChildSearchName (playlist_item_t *, const char *)
 Search a child of a node by its name.
int playlist_NodeDelete (playlist_t *, playlist_item_t *, bool, bool)
 Remove all the children of a node and removes the node.
playlist_item_tplaylist_GetNextLeaf (playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed)
 Finds the next item to play.
playlist_item_tplaylist_GetPrevLeaf (playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed)
 Finds the previous item to play.
audio_output_tplaylist_GetAout (playlist_t *)
float playlist_VolumeGet (playlist_t *)
int playlist_VolumeSet (playlist_t *, float)
int playlist_VolumeUp (playlist_t *, int, float *)
 Raises the volume.
int playlist_MuteSet (playlist_t *, bool)
int playlist_MuteGet (playlist_t *)
static int playlist_MuteToggle (playlist_t *pl)
void playlist_EnableAudioFilter (playlist_t *, const char *, bool)
static input_thread_t__pl_CurrentInput (vlc_object_t *p_this)
static bool playlist_IsEmpty (playlist_t *p_playlist)
 Tell if the playlist is empty.
static int playlist_CurrentSize (playlist_t *p_playlist)
 Tell the number of items in the current playing context.

Detailed Description

The VLC playlist system has a tree structure.

This allows advanced categorization, like for SAP streams (which are grouped by "sap groups").

The base structure for all playlist operations is the input_item_t. This contains all information needed to play a stream and get info, ie, mostly, mrl and metadata. This structure contains a unique i_id field. ids are not recycled when an item is destroyed.

Input items are not used directly, but through playlist items. The playlist items are themselves in a tree structure. They only contain a link to the input item, a unique id and a few flags. the playlist item id is NOT the same as the input item id. Several playlist items can be attached to a single input item. The input item is refcounted and is automatically destroyed when it is not used anymore.

The top-level items are the main media sources and include: playlist, media library, SAP, Shoutcast, devices, ...

It is envisioned that a third tree will appear: VLM, but it's not done yet

The playlist also stores, for utility purposes, an array of all input items, an array of all playlist items and an array of all playlist items and nodes (both are represented by the same structure).

So, here is an example:

 * Inputs array
 *  - input 1 -> name = foo 1 uri = ...
 *  - input 2 -> name = foo 2 uri = ...
 *
 * Playlist items tree
 * - playlist (id 1)
 *    - category 1 (id 2)
 *      - foo 2 (id 6 - input 2)
 * - media library (id 2)
 *    - foo 1 (id 5 - input 1)
 * 

Sometimes, an item creates subitems. This happens for the directory access for example. In that case, if the item is under the "playlist" top-level item and playlist is configured to be flat then the item will be deleted and replaced with new subitems. If the item is under another top-level item, it will be transformed to a node and removed from the list of all items without nodes.

For "standard" item addition, you can use playlist_Add, playlist_AddExt (more options) or playlist_AddInput if you already created your input item. This will add the item at the root of "Playlist" or of "Media library" in each of the two trees.

You can create nodes with playlist_NodeCreate and can create items from existing input items to be placed under any node with playlist_NodeAddInput.

To delete an item, use playlist_DeleteFromInput( p_item ) which will remove all occurrences of the input.

The playlist defines the following event variables:

The playlist contains rate-variable which is propagated to current input if available also rate-slower/rate-faster is in use

XXX Be really carefull, playlist_item_t->i_id and input_item_t->i_id are not the same. Yes, the situation is pretty bad.


Define Documentation

#define AOUT_VOLUME_DEFAULT   256
#define AOUT_VOLUME_MAX   512
#define DEF (   s  )     s,
#define PL_ASSERT_LOCKED   playlist_AssertLocked( p_playlist )
#define pl_CurrentInput (   a  )     __pl_CurrentInput( VLC_OBJECT(a) )

Small helper tp get current playing input or NULL.

Release the input after use.

#define pl_Get (   a  )     pl_Get( VLC_OBJECT(a) )
#define PL_LOCK   playlist_Lock( p_playlist )
#define pl_priv (   pl  )     ((playlist_private_t *)(pl))
#define PL_UNLOCK   playlist_Unlock( p_playlist )
#define PLAYLIST_APPEND   0x0002
#define PLAYLIST_END   -666
#define PLAYLIST_GO   0x0004
#define PLAYLIST_INSERT   0x0001
#define playlist_Next (   p  )     playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, 1)
#define PLAYLIST_NO_REBUILD   0x0020

Referenced by AddItem(), and playlist_NodeCreate().

#define playlist_Pause (   p  )     playlist_Control(p,PLAYLIST_PAUSE, pl_Unlocked )

Referenced by CorksCallback().

#define playlist_Play (   p  )     playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )
#define PLAYLIST_PREPARSE   0x0008
#define playlist_Prev (   p  )     playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, -1)
#define playlist_Skip (   p,
  i 
)    playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, (i) )
#define PLAYLIST_SPREPARSE   0x0010
#define playlist_Stop (   p  )     playlist_Control(p,PLAYLIST_STOP, pl_Unlocked )
#define playlist_VolumeDown (   a,
  b,
  c 
)    playlist_VolumeUp(a, -(b), c)
#define VLC_DEFINE_SORT_FUNCTIONS
Value:
DEF( SORT_ID )\
    DEF( SORT_TITLE )\
    DEF( SORT_TITLE_NODES_FIRST )\
    DEF( SORT_ARTIST )\
    DEF( SORT_GENRE )\
    DEF( SORT_DURATION )\
    DEF( SORT_TITLE_NUMERIC )\
    DEF( SORT_ALBUM )\
    DEF( SORT_TRACK_NUMBER )\
    DEF( SORT_DESCRIPTION )\
    DEF( SORT_RATING )\
    DEF( SORT_URI )

Typedef Documentation

Helper structure to export to file part of the playlist.


Enumeration Type Documentation

anonymous enum
Enumerator:
DEF 
NUM_SORT_FNS 
anonymous enum
Enumerator:
ORDER_NORMAL 
ORDER_REVERSE 
Enumerator:
pl_Locked 
pl_Unlocked 
Enumerator:
PLAYLIST_SAVE_FLAG 

Must it be saved.

PLAYLIST_SKIP_FLAG 

Must playlist skip after it ?

PLAYLIST_DBL_FLAG 

Is it disabled ?

PLAYLIST_RO_FLAG 

Write-enabled ?

PLAYLIST_REMOVE_FLAG 

Remove this item at the end.

PLAYLIST_EXPANDED_FLAG 

Expanded node.

PLAYLIST_SUBITEM_STOP_FLAG 

Must playlist stop if the item gets subitems ?

Playlist status.

Enumerator:
PLAYLIST_STOPPED 
PLAYLIST_RUNNING 
PLAYLIST_PAUSED 

Function Documentation

static input_thread_t* __pl_CurrentInput ( vlc_object_t p_this  )  [inline, static]

References pl_Get, and playlist_CurrentInput().

playlist_item_t* get_current_status_item ( playlist_t p_playlist  ) 

Accessor for status item and status nodes.

References pl_priv.

Referenced by input_item_add_subitem_tree(), NextItem(), playlist_ItemGetByInput(), playlist_NodeDelete(), and PlaylistVAControl().

playlist_item_t* get_current_status_node ( playlist_t p_playlist  ) 
playlist_t* pl_Get ( vlc_object_t  ) 
void playlist_Activate ( playlist_t  ) 

Creates the main playlist thread.

References msg_Err, pl_priv, Thread(), playlist_private_t::thread, vlc_clone(), and VLC_THREAD_PRIORITY_LOW.

Referenced by playlist_Create().

int playlist_Add ( playlist_t p_playlist,
const char *  psz_uri,
const char *  psz_name,
int  i_mode,
int  i_pos,
bool  b_playlist,
bool  b_locked 
)

Playlist add.

Add an item to the playlist or the media library

Parameters:
p_playlist the playlist to add into
psz_uri the mrl to add to the playlist
psz_name a text giving a name or description of this item
i_mode the mode used when adding
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 its size
b_playlist TRUE for playlist, FALSE for media library
b_locked TRUE if the playlist is locked
Returns:
VLC_SUCCESS or a VLC error code

References playlist_AddExt().

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,
int  i_options,
const char *const *  ppsz_options,
unsigned  i_option_flags,
bool  b_playlist,
bool  b_locked 
)

Add a MRL into the playlist or the media library, duration and options given.

Parameters:
p_playlist the playlist to add into
psz_uri the mrl to add to the playlist
psz_name a text giving a name or description of this item
i_mode the mode used when adding
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 its size
i_duration length of the item in milliseconds.
i_options the number of options
ppsz_options an array of options
i_option_flags options flags
b_playlist TRUE for playlist, FALSE for media library
b_locked TRUE if the playlist is locked
Returns:
VLC_SUCCESS or a VLC error code

< Not enough memory

References input_item_NewExt(), playlist_AddInput(), and vlc_gc_decref.

Referenced by GetFilenames(), IPCHelperThread(), libvlc_InternalInit(), playlist_Add(), and WMCOPYWNDPROC().

int playlist_AddInput ( playlist_t p_playlist,
input_item_t p_input,
int  i_mode,
int  i_pos,
bool  b_playlist,
bool  b_locked 
)

Add an input item to the playlist node.

Parameters:
p_playlist the playlist to add into
p_input the input item to add
i_mode the mode used when adding
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 its size
b_playlist TRUE for playlist, FALSE for media library
b_locked TRUE if the playlist is locked
Returns:
VLC_SUCCESS or VLC_ENOMEM or VLC_EGENERIC

< Unspecified error

< Not enough memory

< No error

References AddItem(), GoAndPreparse(), playlist_t::p_media_library, playlist_t::p_playing, PL_DEBUG, PL_LOCK_IF, pl_priv, PL_UNLOCK_IF, playlist_ItemNewFromInput(), input_item_t::psz_name, input_item_t::psz_uri, and vlc_object_alive.

Referenced by playlist_AddExt(), and playlist_Import().

int playlist_AskForArtEnqueue ( playlist_t ,
input_item_t  
)

Request the art for an input item to be fetched.

< Not enough memory

< No error

References playlist_private_t::p_fetcher, pl_priv, playlist_fetcher_Push(), and unlikely.

Referenced by PlayItem().

void playlist_AssertLocked ( playlist_t  ) 

References lock, pl_priv, and vlc_assert_locked.

playlist_item_t* playlist_ChildSearchName ( playlist_item_t p_node,
const char *  psz_search 
)

Search a child of a node by its name.

Parameters:
p_node the node
psz_search the name of the child to search
Returns:
the child item or NULL if not found or error

References playlist_item_t::i_children, playlist_item_t::p_input, playlist_item_t::p_playlist, playlist_item_t::pp_children, and input_item_t::psz_name.

Referenced by playlist_sd_item_added().

void playlist_Clear ( playlist_t p_playlist,
bool  b_locked 
)

Clear the playlist.

Parameters:
b_locked TRUE if playlist is locked when entering this function
p_playlist playlist object
b_locked TRUE if the playlist is locked
Returns:
nothing

References playlist_t::p_playing, PL_LOCK_IF, PL_UNLOCK_IF, and playlist_NodeEmpty().

int playlist_Control ( playlist_t p_playlist,
int  i_query,
bool  b_locked,
  ... 
)

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

Parameters:
p_playlist the playlist to do the command on
i_query the command to do
b_locked TRUE if playlist is locked when entering this function
variable number of arguments
Returns:
VLC_SUCCESS or an error

References PL_LOCK_IF, PL_UNLOCK_IF, and PlaylistVAControl().

Referenced by input_item_add_subitem_tree(), and playlist_NodeDelete().

input_thread_t* playlist_CurrentInput ( playlist_t p_playlist  ) 

Get current playing input.

The object is retained.

References pl_priv, and vlc_object_hold.

Referenced by __pl_CurrentInput(), and str_format_meta().

playlist_item_t* playlist_CurrentPlayingItem ( playlist_t  ) 

References pl_priv.

static int playlist_CurrentSize ( playlist_t p_playlist  )  [inline, static]

Tell the number of items in the current playing context.

References playlist_t::current, and playlist_item_array_t::i_size.

void playlist_Deactivate ( playlist_t p_playlist  ) 

Stops the playlist forever (but do not destroy it yet).

Any input is stopped.

Returns:
Nothing but waits for the playlist to be deactivated.

References playlist_private_t::killed, msg_Dbg, pl_priv, playlist_private_t::signal, playlist_private_t::thread, vlc_cond_signal(), and vlc_join().

Referenced by playlist_Destroy().

int playlist_DeleteFromInput ( playlist_t p_playlist,
input_item_t p_input,
bool  b_locked 
)

Delete from input.

Search anywhere in playlist for an an input item and delete it

Parameters:
p_playlist playlist object
p_input the input to delete
b_locked TRUE if the playlist is locked
Returns:
VLC_SUCCESS or VLC_ENOITEM

< No error

< No error

< Item not found

References DeleteFromInput(), playlist_t::p_root, PL_LOCK_IF, PL_UNLOCK_IF, VLC_ENOITEM, and VLC_SUCCESS.

int playlist_DeleteFromInputInParent ( playlist_t p_playlist,
input_item_t p_item,
playlist_item_t p_root,
bool  b_locked 
)

Delete input item.

Remove an input item when it appears from a root playlist item

Parameters:
p_playlist playlist object
p_input the input to delete
p_root root playlist item
b_locked TRUE if the playlist is locked
Returns:
VLC_SUCCESS or VLC_EGENERIC

References DeleteFromInput(), PL_LOCK_IF, and PL_UNLOCK_IF.

int playlist_DeleteFromItemId ( playlist_t p_playlist,
int  i_id 
)

Delete playlist item.

Remove a playlist item from the playlist, given its id This function is to be used only by the playlist

Parameters:
p_playlist playlist object
i_id id of the item do delete
Returns:
VLC_SUCCESS or an error

< Unspecified error

References playlist_DeleteItem(), and playlist_ItemGetById().

Referenced by playlist_NodeEmpty().

int playlist_DeleteItem ( playlist_t p_playlist,
playlist_item_t ,
bool   
)
void playlist_Destroy ( playlist_t p_playlist  ) 
void playlist_EnableAudioFilter ( playlist_t ,
const char *  ,
bool   
)
int playlist_Export ( playlist_t p_playlist,
const char *  psz_name,
playlist_item_t p_export_root,
const char *  psz_type 
)

Export a node of the playlist to a certain type of playlistfile.

Parameters:
p_playlist the playlist to export
psz_filename the location where the exported file will be saved
p_export_root the root node to export
psz_type the type of playlist file to create (m3u, pls, ..)
Returns:
VLC_SUCCESS on success

< Unspecified error

< Not enough memory

< Unspecified error

< No error

References module_need, module_unneed, msg_Dbg, msg_Err, playlist_export_t::p_file, playlist_item_t::p_input, playlist_export_t::p_root, playlist_Lock(), playlist_Unlock(), playlist_export_t::psz_filename, input_item_t::psz_name, vlc_custom_create, vlc_fopen(), and vlc_object_release.

Referenced by playlist_MLDump().

audio_output_t* playlist_GetAout ( playlist_t  ) 
playlist_item_t* playlist_GetNextLeaf ( playlist_t p_playlist,
playlist_item_t p_root,
playlist_item_t p_item,
bool  b_ena,
bool  b_unplayed 
)

Finds the next item to play.

Parameters:
p_playlist the playlist
p_root the root node
p_item the previous item (NULL if none )
Returns:
the next item to play, or NULL if none found

References GetNextItem(), playlist_item_t::i_children, playlist_item_t::i_flags, input_item_t::i_nb_played, playlist_item_t::p_input, PL_DEBUG2, PLAYLIST_DBL_FLAG, and PLI_NAME.

Referenced by NextItem(), and ResetCurrentlyPlaying().

mtime_t playlist_GetNodeDuration ( playlist_item_t  ) 
playlist_item_t* playlist_GetPrevLeaf ( playlist_t p_playlist,
playlist_item_t p_root,
playlist_item_t p_item,
bool  b_ena,
bool  b_unplayed 
)

Finds the previous item to play.

Parameters:
p_playlist the playlist
p_root the root node
p_item the previous item (NULL if none )
Returns:
the next item to play, or NULL if none found

References GetPrevItem(), playlist_item_t::i_children, playlist_item_t::i_flags, input_item_t::i_nb_played, playlist_item_t::p_input, PL_DEBUG2, PLAYLIST_DBL_FLAG, and PLI_NAME.

int playlist_Import ( playlist_t p_playlist,
const char *  psz_file 
)

Open a playlist file, add its content to the current playlist.

< Unspecified error

References input_item_NewExt(), input_Read, playlist_AddInput(), PLAYLIST_APPEND, PLAYLIST_END, VLC_INPUT_OPTION_TRUSTED, and vlc_path2uri().

int playlist_InsertInputItemTree ( playlist_t p_playlist,
playlist_item_t p_parent,
input_item_node_t p_node,
int  i_pos,
bool  b_flat 
)

Insert a tree of input items into a given playlist node.

Parameters:
p_playlist the playlist to insert into
p_parent the receiving playlist node (can be an item)
p_node the root of input item tree, only it's contents will be inserted
i_pos the position in the playlist where to insert. If this is PLAYLIST_END the items will be added at the end of the playlist regardless of its size
b_flat TRUE if the new tree contents should be flattened into a list
Returns:
the first new leaf inserted (in playing order)

References RecursiveAddIntoParent().

Referenced by input_item_add_subitem_tree(), and input_item_subitem_tree_added().

static bool playlist_IsEmpty ( playlist_t p_playlist  )  [inline, static]

Tell if the playlist is empty.

References playlist_item_array_t::i_size, and playlist_t::items.

Referenced by PlaylistVAControl().

bool playlist_IsServicesDiscoveryLoaded ( playlist_t ,
const char *   
)

Check whether a given SD is loaded.

References playlist_private_t::i_sds, pl_priv, playlist_private_t::pp_sds, and vlc_sd_internal_t::psz_name.

playlist_item_t* playlist_ItemFindFromInputAndRoot ( playlist_t p_playlist,
input_item_t p_item,
playlist_item_t p_root,
bool  b_items_only 
)

Find an item within a root, given its input id.

Parameters:
p_playlist the playlist object
p_item the input item
p_root root playlist item
b_items_only TRUE if we want the item himself
Returns:
the first found item, or NULL if not found

References playlist_item_t::i_children, playlist_item_t::p_input, playlist_ItemFindFromInputAndRoot(), and playlist_item_t::pp_children.

Referenced by DeleteFromInput(), playlist_ItemFindFromInputAndRoot(), and playlist_sd_item_removed().

playlist_item_t* playlist_ItemGetById ( playlist_t p_playlist,
int  i_id 
)

Search a playlist item by its playlist_item id.

The playlist have to be locked

Parameters:
p_playlist,: the playlist
i_id,: the id to find
Returns:
the item or NULL on failure

References playlist_t::all_items, ARRAY_BSEARCH, and ARRAY_VAL.

Referenced by playlist_DeleteFromItemId().

playlist_item_t* playlist_ItemGetByInput ( playlist_t p_playlist,
input_item_t p_item 
)

Search an item by its input_item_t The playlist have to be locked.

Parameters:
p_playlist,: the playlist
p_item,: the input_item_t to find
Returns:
the item, or NULL on failure

Todo:
Check if this is always incremental and whether we can bsearch

References playlist_t::all_items, ARRAY_VAL, get_current_status_item(), and playlist_item_array_t::i_size.

Referenced by input_item_add_subitem_tree().

playlist_item_t* playlist_ItemNewFromInput ( playlist_t p_playlist,
input_item_t p_input 
)
int playlist_ItemRelease ( playlist_item_t p_item  ) 

Release an item.

Parameters:
p_item item to delete
Returns:
VLC_SUCCESS

< No error

References ARRAY_APPEND, playlist_item_t::p_playlist, pl_priv, and uninstall_input_item_observer().

Referenced by playlist_NodeDelete().

int playlist_LiveSearchUpdate ( playlist_t p_playlist,
playlist_item_t p_root,
const char *  psz_string,
bool  b_recursive 
)

Launch the recursive search in the playlist.

Parameters:
p_playlist,: the playlist
p_root,: the current root item
psz_string,: the string to find
Returns:
VLC_SUCCESS

< No error

References pl_priv, playlist_LiveSearchClean(), playlist_LiveSearchUpdateInternal(), and vlc_cond_signal().

void playlist_Lock ( playlist_t  ) 

References lock, pl_priv, and vlc_mutex_lock().

Referenced by playlist_Export(), and Thread().

int playlist_MLDump ( playlist_t p_playlist  ) 

< Unspecified error

< Unspecified error

< No error

References config_CreateDir(), config_GetUserDir(), DIR_SEP, msg_Err, playlist_Export(), and VLC_DATA_DIR.

Referenced by playlist_Destroy().

int playlist_MLLoad ( playlist_t p_playlist  ) 
int playlist_MuteGet ( playlist_t  ) 
int playlist_MuteSet ( playlist_t ,
bool   
)
static int playlist_MuteToggle ( playlist_t pl  )  [inline, static]
int playlist_NodeAddCopy ( playlist_t p_playlist,
playlist_item_t p_item,
playlist_item_t p_parent,
int  i_pos 
)

Copy an item (and all its children, if any) into another node.

Parameters:
p_playlist the playlist to operate on
p_item the playlist item to copy
p_parent the parent item to copy into
i_pos the position in the parent item for the new copy; if this is PLAYLIST_END, the copy is appended after all parent's children
Returns:
the position in parent item just behind the last new item inserted

References playlist_item_t::i_children, playlist_item_t::p_parent, playlist_t::p_playing, pl_priv, PLAYLIST_END, and RecursiveInsertCopy().

playlist_item_t* playlist_NodeAddInput ( playlist_t ,
input_item_t ,
playlist_item_t ,
int  ,
int  ,
bool   
)

Add an input item to a given node.

Parameters:
p_playlist the playlist to add into
p_input the input item to add
p_parent the parent item to add into
i_mode the mode used when addin
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 its size
b_locked TRUE if the playlist is locked
Returns:
the new playlist item

References AddItem(), GoAndPreparse(), playlist_item_t::i_children, PL_LOCK_IF, PL_UNLOCK_IF, playlist_ItemNewFromInput(), and vlc_object_alive.

Referenced by playlist_sd_item_added(), RecursiveAddIntoParent(), and RecursiveInsertCopy().

int playlist_NodeAppend ( playlist_t p_playlist,
playlist_item_t p_item,
playlist_item_t p_parent 
)

Adds an item to the children of a node.

Parameters:
p_playlist the playlist
p_item the item to append
p_parent the parent node
Returns:
VLC_SUCCESS or an error

References playlist_NodeInsert().

Referenced by AddItem().

playlist_item_t* playlist_NodeCreate ( playlist_t p_playlist,
const char *  psz_name,
playlist_item_t p_parent,
int  i_pos,
int  i_flags,
input_item_t p_input 
)

Create a playlist node.

Parameters:
p_playlist the playlist
psz_name the name of the node
p_parent the parent node to attach to or NULL if no attach
i_pos position of the node in the parent, PLAYLIST_END to append to end.
p_flags miscellaneous flags
p_input the input_item to attach to or NULL if it has to be created
Returns:
the new node

References _, playlist_t::all_items, ARRAY_APPEND, playlist_item_t::i_children, playlist_item_t::i_flags, playlist_item_t::i_id, input_item_NewWithType(), ITEM_TYPE_NODE, PLAYLIST_END, playlist_ItemNewFromInput(), PLAYLIST_NO_REBUILD, playlist_NodeInsert(), playlist_SendAddNotify(), and vlc_gc_decref.

Referenced by playlist_Create(), playlist_sd_item_added(), playlist_ServicesDiscoveryAdd(), and RecursiveInsertCopy().

int playlist_NodeDelete ( playlist_t p_playlist,
playlist_item_t p_root,
bool  b_delete_items,
bool  b_force 
)
int playlist_NodeEmpty ( playlist_t p_playlist,
playlist_item_t p_root,
bool  b_delete_items 
)

Remove all the children of a node.

This function must be entered with the playlist lock

Parameters:
p_playlist the playlist
p_root the node
b_delete_items do we have to delete the children items ?
Returns:
VLC_SUCCESS or an error

< Unspecified error

< No error

References playlist_item_t::i_children, playlist_item_t::i_id, playlist_DeleteFromItemId(), playlist_NodeDelete(), and playlist_item_t::pp_children.

Referenced by playlist_Clear(), and playlist_sd_item_removeall().

int playlist_NodeInsert ( playlist_t ,
playlist_item_t ,
playlist_item_t ,
int   
)
int playlist_NodeRemoveItem ( playlist_t p_playlist,
playlist_item_t p_item,
playlist_item_t p_parent 
)

Deletes an item from the children of a node.

Parameters:
p_playlist the playlist
p_item the item to remove
p_parent the parent node
Returns:
VLC_SUCCESS or an error

< Unspecified error

< No error

< No error

References playlist_item_t::i_children, playlist_item_t::p_parent, playlist_item_t::pp_children, REMOVE_ELEM, and VLC_SUCCESS.

Referenced by playlist_NodeDelete().

int playlist_PreparseEnqueue ( playlist_t p_playlist,
input_item_t p_item 
)

Enqueue an input item for preparsing.

< Not enough memory

< No error

References playlist_private_t::p_preparser, pl_priv, playlist_preparser_Push(), and unlikely.

Referenced by GoAndPreparse().

int playlist_RecursiveNodeSort ( playlist_t p_playlist,
playlist_item_t p_node,
int  i_mode,
int  i_type 
)

Sort a node recursively.

This function must be entered with the playlist lock !

Parameters:
p_playlist the playlist
p_node the node to sort
i_mode,: a SORT_* constant indicating the field to sort on
i_type,: ORDER_NORMAL or ORDER_REVERSE (reversed order)
Returns:
VLC_SUCCESS on success

References find_sorting_fn(), pl_priv, and recursiveNodeSort().

void playlist_SendAddNotify ( playlist_t p_playlist,
int  i_item_id,
int  i_node_id,
bool  b_signal 
)

Send a notification that an item has been added to a node.

Parameters:
p_playlist the playlist object
i_item_id id of the item added
i_node_id id of the node in wich the item was added
b_signal TRUE if the function must send a signal
Returns:
nothing

References playlist_private_t::b_reset_currently_playing, playlist_add_t::i_item, playlist_add_t::i_node, pl_priv, playlist_private_t::signal, var_SetAddress, and vlc_cond_signal().

Referenced by AddItem(), and playlist_NodeCreate().

int playlist_ServicesDiscoveryAdd ( playlist_t ,
const char *   
)
int playlist_ServicesDiscoveryControl ( playlist_t ,
const char *  ,
int  ,
  ... 
)
int playlist_ServicesDiscoveryRemove ( playlist_t ,
const char *   
)
int playlist_Status ( playlist_t  ) 

References pl_priv.

int playlist_TreeMove ( playlist_t p_playlist,
playlist_item_t p_item,
playlist_item_t p_node,
int  i_newpos 
)

Moves an item.

This function must be entered with the playlist lock

Parameters:
p_playlist the playlist
p_item the item to move
p_node the new parent of the item
i_newpos the new position under this new parent
Returns:
VLC_SUCCESS or an error

< Unspecified error

< No error

References playlist_item_t::i_children, INSERT_ELEM, ItemIndex(), playlist_item_t::p_parent, pl_priv, playlist_item_t::pp_children, REMOVE_ELEM, and vlc_cond_signal().

int playlist_TreeMoveMany ( playlist_t p_playlist,
int  i_items,
playlist_item_t **  pp_items,
playlist_item_t p_node,
int  i_newpos 
)

Moves an array of items.

This function must be entered with the playlist lock

Parameters:
p_playlist the playlist
i_items the number of indexes to move
pp_items the array of indexes to move
p_node the target node
i_newpos the target position under this node
Returns:
VLC_SUCCESS or an error

< Unspecified error

< No error

References playlist_item_t::i_children, INSERT_ELEM, ItemIndex(), playlist_item_t::p_parent, pl_priv, playlist_item_t::pp_children, REMOVE_ELEM, and vlc_cond_signal().

void playlist_Unlock ( playlist_t  ) 

References lock, pl_priv, and vlc_mutex_unlock().

Referenced by playlist_Export(), and Thread().

float playlist_VolumeGet ( playlist_t  ) 
int playlist_VolumeSet ( playlist_t ,
float   
)
int playlist_VolumeUp ( playlist_t pl,
int  value,
float *  volp 
)

Raises the volume.

Parameters:
value how much to increase (> 0) or decrease (< 0) the volume
volp if non-NULL, will contain contain the resulting volume

References AOUT_VOLUME_DEFAULT, aout_VolumeGet(), aout_VolumeSet(), playlist_GetAout(), var_InheritInteger, and vlc_object_release.

void ResetCurrentlyPlaying ( playlist_t p_playlist,
playlist_item_t p_cur 
)

Reset the currently playing playlist.

Parameters:
p_playlist the playlist structure
p_cur the current playlist item
Returns:
nothing

FIXME: this is *slow*

References ARRAY_APPEND, ARRAY_RESET, ARRAY_VAL, playlist_private_t::b_reset_currently_playing, playlist_t::current, playlist_t::i_current_index, playlist_item_array_t::i_size, playlist_private_t::p_node, PL_DEBUG, pl_priv, playlist_GetNextLeaf(), PLI_NAME, playlist_private_t::status, var_GetBool, and vlc_lrand48().

Referenced by NextItem(), and RandomCallback().

void ResyncCurrentIndex ( playlist_t p_playlist,
playlist_item_t p_cur 
)

Synchronise the current index of the playlist to match the index of the current item.

Parameters:
p_playlist the playlist structure
p_cur the current playlist item
Returns:
nothing

References ARRAY_VAL, playlist_t::current, playlist_t::i_current_index, playlist_item_array_t::i_size, PL_DEBUG, and PLI_NAME.

Referenced by LoopRequest(), NextItem(), and RandomCallback().

void set_current_status_item ( playlist_t ,
playlist_item_t  
)
void set_current_status_node ( playlist_t ,
playlist_item_t  
)

References pl_priv, and PLAYLIST_REMOVE_FLAG.

Referenced by NextItem(), and playlist_Destroy().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines