VLC  3.0.0-git
Modules | Files | Data Structures | Macros | Typedefs | Enumerations | Functions
VLC playlist

VLC playlist controls. More...

Collaboration diagram for VLC playlist:

Modules

 VLC playlist internals
 

Files

file  vlc_playlist.h
 VLC playlist control interface.
 

Data Structures

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   playlist_AssertLocked( 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_VolumeDown(a, b, c)   playlist_VolumeUp(a, -(b), c)
 

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...
 
void playlist_AssertLocked (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, bool 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...
 
mtime_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, bool b_playlist, 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_Add (playlist_t *, const char *, bool)
 Playlist add. More...
 
int playlist_AddExt (playlist_t *, const char *, const char *, bool, int, const char *const *, unsigned, bool)
 Add a MRL into the playlist or the media library, duration and options given. More...
 
int playlist_AddInput (playlist_t *, input_item_t *, bool, 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...
 
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. 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)
 
static bool playlist_IsEmpty (playlist_t *p_playlist)
 Tell if the playlist is empty. More...
 
static int playlist_CurrentSize (playlist_t *p_playlist)
 Tell the number of items in the current playing context. More...
 

Detailed Description

VLC playlist controls.

Macro Definition Documentation

◆ DEF

#define DEF (   s)    s,

◆ PL_ASSERT_LOCKED

#define PL_ASSERT_LOCKED   playlist_AssertLocked( p_playlist )

◆ PL_LOCK

#define PL_LOCK   playlist_Lock( p_playlist )

◆ PL_UNLOCK

#define PL_UNLOCK   playlist_Unlock( p_playlist )

◆ PLAYLIST_END

#define PLAYLIST_END   -1

◆ playlist_Next

#define playlist_Next (   p)    playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, 1)

◆ playlist_Pause

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

Referenced by CorksCallback().

◆ playlist_Play

#define playlist_Play (   p)    playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )

◆ playlist_Prev

#define playlist_Prev (   p)    playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, -1)

◆ playlist_Resume

#define playlist_Resume (   p)    playlist_Control(p, PLAYLIST_RESUME, pl_Unlocked)

Referenced by CorksCallback().

◆ playlist_Skip

#define playlist_Skip (   p,
 
)    playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, (i) )

◆ playlist_Stop

#define playlist_Stop (   p)    playlist_Control(p,PLAYLIST_STOP, pl_Unlocked )

◆ playlist_TogglePause

#define playlist_TogglePause (   p)    playlist_Control(p, PLAYLIST_TOGGLE_PAUSE, pl_Unlocked)

◆ playlist_VolumeDown

#define playlist_VolumeDown (   a,
  b,
 
)    playlist_VolumeUp(a, -(b), c)

◆ VLC_DEFINE_SORT_FUNCTIONS

#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 )\
DEF( SORT_DATE )
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
#define DEF(s)
Definition: vlc_playlist.h:187
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190
Definition: vlc_playlist.h:190

Typedef Documentation

◆ playlist_export_t

Helper structure to export to file part of the playlist.

Enumeration Type Documentation

◆ anonymous enum

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_DISC_NUMBER 
SORT_DATE 
SORT_RANDOM 
NUM_SORT_FNS 

◆ anonymous enum

anonymous enum
Enumerator
ORDER_NORMAL 
ORDER_REVERSE 

◆ anonymous enum

anonymous enum

Playlist commands.

Enumerator
PLAYLIST_PLAY 

No arg.

res=can fail

PLAYLIST_VIEWPLAY 

arg1= playlist_item_t*,

PLAYLIST_TOGGLE_PAUSE 

arg2 = playlist_item_t* , res=can fail

No arg res=can fail

PLAYLIST_STOP 

No arg res=can fail.

PLAYLIST_SKIP 

arg1=int, res=can fail

PLAYLIST_PAUSE 

No arg.

PLAYLIST_RESUME 

No arg.

◆ pl_locked_state

Enumerator
pl_Locked 
pl_Unlocked 

◆ playlist_item_flags_e

Enumerator
PLAYLIST_DBL_FLAG 

Is it disabled ?

PLAYLIST_RO_FLAG 

Write-enabled ?

PLAYLIST_SUBITEM_STOP_FLAG 

Must playlist stop if the item gets subitems ?

PLAYLIST_NO_INHERIT_FLAG 

Will children inherit flags the R/O flag ?

◆ playlist_status_t

Playlist status.

Enumerator
PLAYLIST_STOPPED 
PLAYLIST_RUNNING 
PLAYLIST_PAUSED 

Function Documentation

◆ playlist_Add()

int playlist_Add ( playlist_t p_playlist,
const char *  psz_uri,
bool  play_now 
)

Playlist add.

Add an item to the playlist

Parameters
p_playlistthe playlist to add into
psz_urithe mrl to add to the playlist
play_nowwhether to start playing immediately or not
Returns
VLC_SUCCESS or a VLC error code

References playlist_AddExt().

Referenced by playlist_ViewPlay().

◆ playlist_AddExt()

int playlist_AddExt ( playlist_t p_playlist,
const char *  psz_uri,
const char *  psz_name,
bool  play_now,
int  i_options,
const char *const *  ppsz_options,
unsigned  i_option_flags,
bool  b_playlist 
)

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
play_nowwhether to start playing immediately or not
i_optionsthe number of options
ppsz_optionsan array of options
i_option_flagsoptions flags
b_playlistTRUE for playlist, FALSE for media library
Returns
VLC_SUCCESS or a VLC error code

< Not enough memory

References input_item_AddOptions(), input_item_New, input_item_Release(), playlist_AddInput(), and VLC_ENOMEM.

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

◆ playlist_AddInput()

int playlist_AddInput ( playlist_t p_playlist,
input_item_t p_input,
bool  play_now,
bool  b_playlist 
)

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
b_playlistTRUE for playlist, FALSE for media library
Returns
VLC_SUCCESS or VLC_ENOMEM or VLC_EGENERIC

< No error

< Not enough memory

References likely, playlist_t::p_media_library, playlist_t::p_playing, PL_LOCK, PL_UNLOCK, PLAYLIST_END, playlist_NodeAddInput(), playlist_ViewPlay(), VLC_ENOMEM, and VLC_SUCCESS.

Referenced by playlist_AddExt(), playlist_Import(), and playlist_ViewPlay().

◆ playlist_AssertLocked()

void playlist_AssertLocked ( playlist_t )

References lock, pl_priv, and vlc_assert_locked.

◆ playlist_ChildSearchName()

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

Search a child of a node by its name.

Note
The playlist must be locked, and the result is only valid until the playlist is unlocked.
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::pp_children, and input_item_t::psz_name.

Referenced by playlist_sd_item_added(), and playlist_ViewPlay().

◆ playlist_Clear()

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_item_t::i_children, playlist_t::p_playing, PL_LOCK_IF, PL_UNLOCK_IF, playlist_NodeDelete(), and playlist_item_t::pp_children.

Referenced by playlist_ViewPlay().

◆ playlist_Control()

void 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

References playlist_vaControl().

Referenced by input_item_add_subitem_tree(), libvlc_InternalPlay(), playlist_NodeDeleteExplicit(), and playlist_ViewPlay().

◆ playlist_CurrentInput()

input_thread_t* playlist_CurrentInput ( playlist_t p_playlist)

Get current playing input.

The object is retained.

References PL_LOCK, PL_UNLOCK, and playlist_CurrentInputLocked().

Referenced by playlist_ViewPlay().

◆ playlist_CurrentInputLocked()

input_thread_t* playlist_CurrentInputLocked ( playlist_t p_playlist)

Get current playing input.

References PL_ASSERT_LOCKED, pl_priv, and vlc_object_hold.

Referenced by playlist_CurrentInput(), and playlist_ViewPlay().

◆ playlist_CurrentPlayingItem()

playlist_item_t* playlist_CurrentPlayingItem ( playlist_t )

References PL_ASSERT_LOCKED, and pl_priv.

Referenced by playlist_ViewPlay().

◆ playlist_CurrentSize()

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.

◆ playlist_Deactivate()

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().

◆ playlist_EnableAudioFilter()

void playlist_EnableAudioFilter ( playlist_t ,
const char *  ,
bool   
)

◆ playlist_Export()

int playlist_Export ( playlist_t p_playlist,
const char *  psz_name,
bool  b_playlist,
const char *  psz_type 
)

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

Parameters
b_playlisttrue for the playlist, false for the media library
psz_filenamethe location where the exported file will be saved
psz_typethe type of playlist file to create (m3u, pls, ..)
Returns
VLC_SUCCESS on success

< Not enough memory

< Unspecified error

< No error

References playlist_export_t::base_url, module_need, module_unneed, msg_Dbg, msg_Err, playlist_export_t::p_file, playlist_t::p_media_library, playlist_t::p_playing, playlist_export_t::p_root, playlist_Lock(), playlist_Unlock(), unlikely, vlc_custom_create, VLC_EGENERIC, VLC_ENOMEM, vlc_fopen(), vlc_object_release, vlc_path2uri(), vlc_strerror_c(), and VLC_SUCCESS.

Referenced by playlist_MLDump(), and playlist_ViewPlay().

◆ playlist_GetAout()

audio_output_t* playlist_GetAout ( playlist_t )

◆ playlist_GetNodeDuration()

mtime_t playlist_GetNodeDuration ( playlist_item_t )

◆ playlist_Import()

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_New, input_Read, playlist_AddInput(), var_Create, VLC_EGENERIC, vlc_object_create, vlc_object_release, vlc_path2uri(), and VLC_VAR_VOID.

Referenced by playlist_ViewPlay().

◆ playlist_IsEmpty()

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.

◆ playlist_IsServicesDiscoveryLoaded()

bool playlist_IsServicesDiscoveryLoaded ( playlist_t ,
const char *   
)

◆ playlist_ItemGetById()

playlist_item_t* playlist_ItemGetById ( playlist_t p_playlist,
int  id 
)

Finds a playlist item by ID.

Searches for a playlist item with the given ID.

Note
The playlist must be locked, and the result is only valid until the playlist is unlocked.
Warning
If an item with the given ID is deleted, it is unlikely but possible that another item will get the same ID. This can result in mismatches. Where holding a reference to an input item is a viable option, then playlist_ItemGetByInput() should be used instead - to avoid this issue.
Parameters
p_playlistthe playlist
idID to look for
Returns
the matching item or NULL if not found

References playlist_item_t::i_id, playlist_private_t::id_tree, p, PL_ASSERT_LOCKED, pl_priv, playlist_ItemCmpId(), and tfind().

Referenced by playlist_ViewPlay().

◆ playlist_ItemGetByInput()

playlist_item_t* playlist_ItemGetByInput ( playlist_t p_playlist,
const input_item_t item 
)

Finds a playlist item by input item.

Searches for a playlist item for the given input item.

Note
The playlist must be locked, and the result is only valid until the playlist is unlocked.
Parameters
p_playlistthe playlist
iteminput item to look for
Returns
the playlist item or NULL on failure

References playlist_private_t::input_tree, p, playlist_item_t::p_input, PL_ASSERT_LOCKED, pl_priv, playlist_ItemCmpInput(), and tfind().

Referenced by input_item_add_subitem_tree(), playlist_sd_item_added(), playlist_sd_item_removed(), and playlist_ViewPlay().

◆ playlist_LiveSearchUpdate()

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_playlistthe playlist
p_rootthe current root item
psz_stringthe string to find
Returns
VLC_SUCCESS

< No error

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

Referenced by playlist_ViewPlay().

◆ playlist_Lock()

void playlist_Lock ( playlist_t )

Locks the playlist.

This function locks the playlist. While the playlist is locked, no other thread can modify the playlist tree layout or current playing item and node.

Locking the playlist is necessary before accessing, either for reading or writing, any playlist item.

Note
Because of the potential for lock inversion / deadlocks, locking the playlist shall not be attemped while holding an input item lock. An input item lock can be acquired while holding the playlist lock.

While holding the playlist lock, a thread shall not attempt to:

  • probe, initialize or deinitialize a module or a plugin,
  • install or deinstall a variable or event callback,
  • set a variable or trigger a variable callback, with the sole exception of the playlist core triggering add/remove/leaf item callbacks,
  • invoke a module/plugin callback other than:
    • playlist export,
    • logger message callback.

References lock, pl_priv, and vlc_mutex_lock().

Referenced by intf_InsertItem(), playlist_Export(), playlist_IsServicesDiscoveryLoaded(), playlist_sd_item_added(), playlist_sd_item_removed(), playlist_ServicesDiscoveryAdd(), playlist_ServicesDiscoveryControl(), playlist_ServicesDiscoveryInternalRemove(), and playlist_ServicesDiscoveryRemove().

◆ playlist_MuteGet()

int playlist_MuteGet ( playlist_t )

◆ playlist_MuteSet()

int playlist_MuteSet ( playlist_t ,
bool   
)

◆ playlist_MuteToggle()

static int playlist_MuteToggle ( playlist_t pl)
inlinestatic

◆ playlist_NodeAddCopy()

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().

Referenced by playlist_ViewPlay().

◆ playlist_NodeAddInput()

playlist_item_t* playlist_NodeAddInput ( playlist_t p_playlist,
input_item_t p_input,
playlist_item_t p_parent,
int  i_pos 
)

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_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
Returns
the new playlist item

References ARRAY_APPEND, playlist_item_t::i_children, playlist_t::items, PL_ASSERT_LOCKED, playlist_ItemNewFromInput(), playlist_NodeInsert(), playlist_Preparse(), playlist_SendAddNotify(), and unlikely.

Referenced by intf_InsertItem(), playlist_AddInput(), playlist_sd_item_added(), playlist_ViewPlay(), RecursiveAddIntoParent(), and RecursiveInsertCopy().

◆ playlist_NodeCreate()

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

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_item_t::i_flags, input_item_NewExt(), input_item_Release(), ITEM_NET_UNKNOWN, ITEM_TYPE_NODE, PL_ASSERT_LOCKED, playlist_ItemNewFromInput(), playlist_NodeInsert(), and playlist_SendAddNotify().

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

◆ playlist_NodeDelete()

void playlist_NodeDelete ( playlist_t p_playlist,
playlist_item_t p_root 
)

Remove all the children of a node and removes the node.

Parameters
p_playlistthe playlist
p_rootthe node

< stop playlist playback if node is currently the one played

References PLAYLIST_DELETE_STOP_IF_CURRENT, and playlist_NodeDeleteExplicit().

Referenced by playlist_Clear(), and playlist_ViewPlay().

◆ playlist_RecursiveNodeSort()

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_modea SORT_* constant indicating the field to sort on
i_typeORDER_NORMAL or ORDER_REVERSE (reversed order)
Returns
VLC_SUCCESS on success

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

Referenced by playlist_ViewPlay().

◆ playlist_ServicesDiscoveryAdd()

int playlist_ServicesDiscoveryAdd ( playlist_t ,
const char *   
)

◆ playlist_ServicesDiscoveryControl()

int playlist_ServicesDiscoveryControl ( playlist_t ,
const char *  ,
int  ,
  ... 
)

◆ playlist_ServicesDiscoveryRemove()

int playlist_ServicesDiscoveryRemove ( playlist_t ,
const char *   
)

◆ playlist_Status()

int playlist_Status ( playlist_t )

◆ playlist_TreeMove()

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, ItemIndex(), playlist_item_t::p_parent, PL_ASSERT_LOCKED, pl_priv, playlist_item_t::pp_children, TAB_ERASE, TAB_INSERT, vlc_cond_signal(), VLC_EGENERIC, and VLC_SUCCESS.

Referenced by playlist_ViewPlay().

◆ playlist_TreeMoveMany()

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, ItemIndex(), playlist_item_t::p_parent, PL_ASSERT_LOCKED, pl_priv, playlist_item_t::pp_children, TAB_ERASE, TAB_INSERT, vlc_cond_signal(), VLC_EGENERIC, and VLC_SUCCESS.

Referenced by playlist_ViewPlay().

◆ playlist_Unlock()

void playlist_Unlock ( playlist_t )

Unlocks the playlist.

This function unlocks the playlist, allowing other threads to lock it. The calling thread must have called playlist_Lock() before.

This function invalidates all or any playlist item pointers. There are no ways to ensure that playlist items are not modified or deleted by another thread past this function call.

To retain a reference to a playlist item while not holding the playlist lock, a thread should take a reference to the input item within the playlist item before unlocking. If this is not practical, then the thread can store the playlist item ID (i_id) before unlocking. Either way, this will not ensure that the playlist item is not deleted, so the thread must be ready to handle that case later when calling playlist_ItemGetByInput() or playlist_ItemGetById().

Furthermore, if ID is used, then the playlist item might be deleted, and another item could be assigned the same ID. To avoid that problem, use the input item instead of the ID.

References lock, pl_priv, and vlc_mutex_unlock().

Referenced by intf_InsertItem(), playlist_Export(), playlist_IsServicesDiscoveryLoaded(), playlist_sd_item_added(), playlist_sd_item_removed(), playlist_ServicesDiscoveryAdd(), playlist_ServicesDiscoveryControl(), playlist_ServicesDiscoveryInternalRemove(), and playlist_ServicesDiscoveryRemove().

◆ playlist_ViewPlay()

static void playlist_ViewPlay ( playlist_t pl,
playlist_item_t node,
playlist_item_t item 
)
inlinestatic

◆ playlist_VolumeGet()

float playlist_VolumeGet ( playlist_t )

◆ playlist_VolumeSet()

int playlist_VolumeSet ( playlist_t ,
float   
)

◆ playlist_VolumeUp()

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_VolumeUpdate(), playlist_GetAout(), and vlc_object_release.

Referenced by playlist_ViewPlay().