VLC  4.0.0-dev
Data Structures | Macros | Typedefs | Enumerations | Functions
vlc_playlist_legacy.h File Reference

VLC playlist control interface. More...

Include dependency graph for vlc_playlist_legacy.h:

Go to the source code of this file.

Data Structures

struct  playlist_item_array_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...
 

Macros

#define VLC_DEFINE_SORT_FUNCTIONS
 
#define DEF(s)   s,
 
#define PLAYLIST_END   -1
 
#define PL_LOCK   playlist_Lock( p_playlist )
 
#define PL_UNLOCK   playlist_Unlock( p_playlist )
 
#define PL_ASSERT_LOCKED   assert(playlist_Locked(p_playlist))
 
#define playlist_Play(p)   playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )
 
#define playlist_TogglePause(p)   playlist_Control(p, PLAYLIST_TOGGLE_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 playlist_Pause(p)   playlist_Control(p, PLAYLIST_PAUSE, pl_Unlocked)
 
#define playlist_Resume(p)   playlist_Control(p, PLAYLIST_RESUME, pl_Unlocked)
 
#define playlist_AssertLocked(pl)   (assert(playlist_Locked(pl)), pl)
 
#define playlist_VolumeDown(a, b, c)   playlist_VolumeUp(a, -(b), c)
 
#define playlist_IsEmpty(p_playlist)   (playlist_AssertLocked(p_playlist)->items.i_size == 0)
 Tell if the playlist is empty. More...
 
#define playlist_CurrentSize(p_playlist)   (playlist_AssertLocked(p_playlist)->current.i_size)
 Tell the number of items in the current playing context. More...
 

Typedefs

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

Enumerations

enum  playlist_item_flags_e { PLAYLIST_DBL_FLAG = 0x04, PLAYLIST_RO_FLAG = 0x08, PLAYLIST_SUBITEM_STOP_FLAG = 0x40, PLAYLIST_NO_INHERIT_FLAG = 0x80 }
 
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_DISC_NUMBER, SORT_DATE, SORT_RANDOM, NUM_SORT_FNS =SORT_RANDOM
}
 
enum  { ORDER_NORMAL = 0, ORDER_REVERSE = 1 }
 
enum  pl_locked_state { pl_Locked = true, pl_Unlocked = false }
 
enum  {
  PLAYLIST_PLAY, PLAYLIST_VIEWPLAY, PLAYLIST_TOGGLE_PAUSE, PLAYLIST_STOP,
  PLAYLIST_SKIP, PLAYLIST_PAUSE, PLAYLIST_RESUME
}
 Playlist commands. More...
 

Functions

void playlist_Lock (playlist_t *)
 Locks the playlist. More...
 
void playlist_Unlock (playlist_t *)
 Unlocks the playlist. More...
 
bool playlist_Locked (const playlist_t *)
 
void playlist_Deactivate (playlist_t *)
 Stops the playlist forever (but do not destroy it yet). More...
 
void playlist_Control (playlist_t *p_playlist, int i_query, int b_locked,...)
 Do a playlist action. More...
 
static void playlist_ViewPlay (playlist_t *pl, playlist_item_t *node, playlist_item_t *item)
 
input_thread_tplaylist_CurrentInput (playlist_t *p_playlist)
 Get current playing input. More...
 
input_thread_tplaylist_CurrentInputLocked (playlist_t *p_playlist)
 Get current playing input. More...
 
vlc_tick_t playlist_GetNodeDuration (playlist_item_t *)
 Get the duration of all items in a node. More...
 
void playlist_Clear (playlist_t *, bool)
 Clear the playlist. More...
 
int playlist_TreeMove (playlist_t *, playlist_item_t *, playlist_item_t *, int)
 Moves an item. More...
 
int playlist_TreeMoveMany (playlist_t *, int, playlist_item_t **, playlist_item_t *, int)
 Moves an array of items. More...
 
int playlist_RecursiveNodeSort (playlist_t *, playlist_item_t *, int, int)
 Sort a node recursively. More...
 
playlist_item_tplaylist_CurrentPlayingItem (playlist_t *)
 
int playlist_Status (playlist_t *)
 
int playlist_Export (playlist_t *p_playlist, const char *psz_name, const char *psz_type)
 Export a node of the playlist to a certain type of playlistfile. More...
 
int playlist_Import (playlist_t *p_playlist, const char *psz_file)
 Open a playlist file, add its content to the current playlist. More...
 
int playlist_ServicesDiscoveryAdd (playlist_t *, const char *)
 Add a service discovery module. More...
 
int playlist_ServicesDiscoveryRemove (playlist_t *, const char *)
 Remove a services discovery module by name. More...
 
bool playlist_IsServicesDiscoveryLoaded (playlist_t *, const char *)
 Check whether a given SD is loaded. More...
 
int playlist_ServicesDiscoveryControl (playlist_t *, const char *, int,...)
 Query a services discovery. More...
 
int playlist_SetRenderer (playlist_t *p_pl, vlc_renderer_item_t *p_item)
 Sets a renderer or remove the current one. More...
 
int playlist_Add (playlist_t *, const char *, bool)
 Playlist add. More...
 
int playlist_AddExt (playlist_t *, const char *, const char *, bool, int, const char *const *, unsigned)
 Add a MRL into the playlist or the media library, duration and options given. More...
 
int playlist_AddInput (playlist_t *, input_item_t *, bool)
 Add an input item to the playlist node. More...
 
playlist_item_tplaylist_NodeAddInput (playlist_t *, input_item_t *, playlist_item_t *, int)
 Add an input item to a given node. More...
 
int playlist_NodeAddCopy (playlist_t *, playlist_item_t *, playlist_item_t *, int)
 Copy an item (and all its children, if any) into another node. More...
 
playlist_item_tplaylist_ItemGetById (playlist_t *, int)
 Finds a playlist item by ID. More...
 
playlist_item_tplaylist_ItemGetByInput (playlist_t *, const input_item_t *)
 Finds a playlist item by input item. More...
 
int playlist_LiveSearchUpdate (playlist_t *, playlist_item_t *, const char *, bool)
 Launch the recursive search in the playlist. More...
 
playlist_item_tplaylist_NodeCreate (playlist_t *, const char *, playlist_item_t *p_parent, int i_pos, int i_flags)
 Create a playlist node. More...
 
playlist_item_tplaylist_ChildSearchName (playlist_item_t *, const char *)
 Search a child of a node by its name. More...
 
void playlist_NodeDelete (playlist_t *, playlist_item_t *)
 Remove all the children of a node and removes the node. More...
 
struct audio_outputplaylist_GetAout (playlist_t *)
 
float playlist_VolumeGet (playlist_t *)
 
int playlist_VolumeSet (playlist_t *, float)
 
int playlist_VolumeUp (playlist_t *, int, float *)
 Raises the volume. More...
 
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)
 

Detailed Description

VLC playlist control interface.

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 playlist_item_t. This is essentially a node within the playlist tree. Each playlist item references an input_item_t which contains the input stream info, such as location, name and meta-data.

A playlist item is uniquely identified by its input item: playlist_ItemGetByInput(). A single input item cannot be used by more than one playlist item at a time; if necessary, a copy of the input item can be made instead.

The same playlist tree is visible to all user interfaces. To arbitrate access, a lock is used, see playlist_Lock() and playlist_Unlock().

Under the playlist root item node, the top-level items are the main media sources and include:

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

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" 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_NodeDelete( p_item ).

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.