VLC  3.0.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | 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...

Macros

#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 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)

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  {
  SORT_ID, SORT_TITLE, SORT_TITLE_NODES_FIRST, SORT_ARTIST,
  SORT_GENRE, SORT_DURATION, SORT_TITLE_NUMERIC, SORT_ALBUM,
  SORT_TRACK_NUMBER, SORT_DESCRIPTION, SORT_RATING, SORT_URI,
  SORT_RANDOM, 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_ServicesDiscoveryKillAll (playlist_t *p_playlist)
playlist_tplaylist_Create (vlc_object_t *)
 Create playlist.
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.
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_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 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.

Macro Definition Documentation

#define AOUT_VOLUME_DEFAULT   256

Referenced by playlist_VolumeUp().

#define AOUT_VOLUME_MAX   512
#define DEF (   s)    s,
#define PL_ASSERT_LOCKED   playlist_AssertLocked( p_playlist )
#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

Referenced by GoAndPreparse(), and IPCHelperThread().

#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,
 
)    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,
 
)    playlist_VolumeUp(a, -(b), c)
#define VLC_DEFINE_SORT_FUNCTIONS
Value:
DEF( SORT_TITLE )\
DEF( SORT_ARTIST )\
DEF( SORT_GENRE )\
DEF( SORT_DURATION )\
DEF( SORT_ALBUM )\
DEF( SORT_RATING )\
DEF( SORT_URI )

Referenced by cmp_d_SORT_URI().

Typedef Documentation

Helper structure to export to file part of the playlist.

Enumeration Type Documentation

anonymous enum
Enumerator:
SORT_ID 
SORT_TITLE 
SORT_TITLE_NODES_FIRST 
SORT_ARTIST 
SORT_GENRE 
SORT_DURATION 
SORT_TITLE_NUMERIC 
SORT_ALBUM 
SORT_TRACK_NUMBER 
SORT_DESCRIPTION 
SORT_RATING 
SORT_URI 
SORT_RANDOM 
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

playlist_item_t* get_current_status_item ( playlist_t p_playlist)

Accessor for status item and status nodes.

References PL_ASSERT_LOCKED, and 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)
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_playlistthe playlist to add into
psz_urithe mrl to add to the playlist
psz_namea text giving a name or description of this item
i_modethe mode used when adding
i_posthe 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_playlistTRUE for playlist, FALSE for media library
b_lockedTRUE 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_playlistthe playlist to add into
psz_urithe mrl to add to the playlist
psz_namea text giving a name or description of this item
i_modethe mode used when adding
i_posthe 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_durationlength of the item in milliseconds.
i_optionsthe number of options
ppsz_optionsan array of options
i_option_flagsoptions flags
b_playlistTRUE for playlist, FALSE for media library
b_lockedTRUE if the playlist is locked
Returns
VLC_SUCCESS or a VLC error code

< Not enough memory

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

Referenced by intf_InsertItem(), IPCHelperThread(), and playlist_Add().

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_playlistthe playlist to add into
p_inputthe input item to add
i_modethe mode used when adding
i_posthe 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_playlistTRUE for playlist, FALSE for media library
b_lockedTRUE if the playlist is locked
Returns
VLC_SUCCESS or VLC_ENOMEM or VLC_EGENERIC

< 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, VLC_ENOMEM, and VLC_SUCCESS.

Referenced by playlist_AddExt(), and playlist_Import().

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_nodethe node
psz_searchthe 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, PL_ASSERT_LOCKED, 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_lockedTRUE if playlist is locked when entering this function
p_playlistplaylist object
b_lockedTRUE 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_playlistthe playlist to do the command on
i_querythe command to do
b_lockedTRUE if playlist is locked when entering this function
variablenumber of arguments
Returns
VLC_SUCCESS or an error

References PL_LOCK_IF, PL_UNLOCK_IF, and PlaylistVAControl().

Referenced by input_item_add_subitem_tree(), libvlc_InternalPlay(), and playlist_NodeDelete().

playlist_t* playlist_Create ( vlc_object_t p_parent)
input_thread_t* playlist_CurrentInput ( playlist_t p_playlist)

Get current playing input.

The object is retained.

References PL_LOCK, pl_priv, PL_UNLOCK, and vlc_object_hold.

playlist_item_t* playlist_CurrentPlayingItem ( playlist_t )

References PL_ASSERT_LOCKED, and pl_priv.

static int playlist_CurrentSize ( playlist_t p_playlist)
inlinestatic

Tell the number of items in the current playing context.

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

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_LOCK, pl_priv, PL_UNLOCK, 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_playlistplaylist object
p_inputthe input to delete
b_lockedTRUE 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_playlistplaylist object
p_inputthe input to delete
p_rootroot playlist item
b_lockedTRUE 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_playlistplaylist object
i_idid of the item do delete
Returns
VLC_SUCCESS or an error

< Unspecified error

References PL_ASSERT_LOCKED, playlist_DeleteItem(), playlist_ItemGetById(), and VLC_EGENERIC.

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_playlistthe playlist to export
psz_filenamethe location where the exported file will be saved
p_export_rootthe root node to export
psz_typethe 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, unlikely, vlc_custom_create, VLC_EGENERIC, VLC_ENOMEM, vlc_fopen(), vlc_object_release, vlc_strerror_c(), and VLC_SUCCESS.

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_playlistthe playlist
p_rootthe root node
p_itemthe 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, playlist_item_t::i_nb_played, PL_ASSERT_LOCKED, 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_playlistthe playlist
p_rootthe root node
p_itemthe 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, playlist_item_t::i_nb_played, PL_ASSERT_LOCKED, 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_EGENERIC, 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_playlistthe playlist to insert into
p_parentthe receiving playlist node (can be an item)
p_nodethe root of input item tree, only it's contents will be inserted
i_posthe 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_flatTRUE 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)
inlinestatic

Tell if the playlist is empty.

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

Referenced by PlaylistVAControl().

bool playlist_IsServicesDiscoveryLoaded ( playlist_t ,
const char *   
)
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_playlistthe playlist object
p_itemthe input item
p_rootroot playlist item
b_items_onlyTRUE 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, ARRAY_VAL, and PL_ASSERT_LOCKED.

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(), playlist_item_array_t::i_size, and PL_ASSERT_LOCKED.

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_itemitem to delete
Returns
VLC_SUCCESS

< No error

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

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_ASSERT_LOCKED, pl_priv, playlist_LiveSearchClean(), playlist_LiveSearchUpdateInternal(), vlc_cond_signal(), and VLC_SUCCESS.

void playlist_Lock ( playlist_t )

References lock, pl_priv, and vlc_mutex_lock().

Referenced by playlist_Export().

int playlist_MLDump ( playlist_t p_playlist)

< Unspecified error

< Unspecified error

< Unspecified error

< No error

< Unspecified error

< No error

References asprintf(), config_CreateDir(), config_GetUserDir(), DIR_SEP, getpid(), msg_Err, playlist_t::p_media_library, playlist_Export(), VLC_DATA_DIR, VLC_EGENERIC, vlc_rename(), vlc_strerror_c(), VLC_SUCCESS, and vlc_unlink().

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)
inlinestatic
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_playlistthe playlist to operate on
p_itemthe playlist item to copy
p_parentthe parent item to copy into
i_posthe 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_ASSERT_LOCKED, 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_playlistthe playlist to add into
p_inputthe input item to add
p_parentthe parent item to add into
i_modethe mode used when addin
i_posthe 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_lockedTRUE if the playlist is locked
Returns
the new playlist item

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

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_playlistthe playlist
p_itemthe item to append
p_parentthe 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_playlistthe playlist
psz_namethe name of the node
p_parentthe parent node to attach to or NULL if no attach
i_posposition of the node in the parent, PLAYLIST_END to append to end.
p_flagsmiscellaneous flags
p_inputthe 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, PL_ASSERT_LOCKED, 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_playlistthe playlist
p_rootthe node
b_delete_itemsdo 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, PL_ASSERT_LOCKED, playlist_DeleteFromItemId(), playlist_NodeDelete(), playlist_item_t::pp_children, VLC_EGENERIC, and VLC_SUCCESS.

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_playlistthe playlist
p_itemthe item to remove
p_parentthe 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, PL_ASSERT_LOCKED, playlist_item_t::pp_children, REMOVE_ELEM, VLC_EGENERIC, and VLC_SUCCESS.

Referenced by playlist_NodeDelete().

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_playlistthe playlist
p_nodethe 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_playlistthe playlist object
i_item_idid of the item added
i_node_idid of the node in wich the item was added
b_signalTRUE 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_ASSERT_LOCKED, 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  ,
  ... 
)
void playlist_ServicesDiscoveryKillAll ( playlist_t p_playlist)
int playlist_ServicesDiscoveryRemove ( playlist_t ,
const char *   
)
int playlist_Status ( playlist_t )

References PL_ASSERT_LOCKED, and 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_playlistthe playlist
p_itemthe item to move
p_nodethe new parent of the item
i_newposthe 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_ASSERT_LOCKED, pl_priv, playlist_item_t::pp_children, REMOVE_ELEM, vlc_cond_signal(), VLC_EGENERIC, and VLC_SUCCESS.

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_playlistthe playlist
i_itemsthe number of indexes to move
pp_itemsthe array of indexes to move
p_nodethe target node
i_newposthe 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_ASSERT_LOCKED, pl_priv, playlist_item_t::pp_children, REMOVE_ELEM, vlc_cond_signal(), VLC_EGENERIC, and VLC_SUCCESS.

void playlist_Unlock ( playlist_t )

References lock, pl_priv, and vlc_mutex_unlock().

Referenced by playlist_Export().

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
valuehow much to increase (> 0) or decrease (< 0) the volume
volpif non-NULL, will contain contain the resulting volume

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

void ResetCurrentlyPlaying ( playlist_t p_playlist,
playlist_item_t p_cur 
)

Reset the currently playing playlist.

Parameters
p_playlistthe playlist structure
p_curthe 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_playlistthe playlist structure
p_curthe current playlist item
Returns
nothing

References ARRAY_VAL, playlist_t::current, playlist_t::i_current_index, playlist_item_array_t::i_size, PL_ASSERT_LOCKED, 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  
)