MPD
0.20.18
|
#include <Playlist.hxx>
Public Member Functions | |
playlist (unsigned max_length, QueueListener &_listener) | |
~playlist () | |
uint32_t | GetVersion () const |
unsigned | GetLength () const |
unsigned | PositionToId (unsigned position) const |
gcc_pure int | GetCurrentPosition () const noexcept |
gcc_pure int | GetNextPosition () const noexcept |
gcc_pure const DetachedSong * | GetQueuedSong () const noexcept |
Returns the song object which is currently queued. More... | |
void | SyncWithPlayer (PlayerControl &pc) |
This is the "PLAYLIST" event handler. More... | |
void | BeginBulk () |
void | CommitBulk (PlayerControl &pc) |
void | Clear (PlayerControl &pc) |
void | TagModified (DetachedSong &&song) |
A tag in the play queue has been modified by the player thread. More... | |
unsigned | AppendSong (PlayerControl &pc, DetachedSong &&song) |
Throws PlaylistError if the queue would be too large. More... | |
unsigned | AppendURI (PlayerControl &pc, const SongLoader &loader, const char *uri_utf8) |
Throws #std::runtime_error on error. More... | |
void | DeletePosition (PlayerControl &pc, unsigned position) |
void | DeleteOrder (PlayerControl &pc, unsigned order) |
void | DeleteId (PlayerControl &pc, unsigned id) |
void | DeleteRange (PlayerControl &pc, unsigned start, unsigned end) |
Deletes a range of songs from the playlist. More... | |
void | StaleSong (PlayerControl &pc, const char *uri) |
Mark the given song as "stale", i.e. More... | |
void | Shuffle (PlayerControl &pc, unsigned start, unsigned end) |
void | MoveRange (PlayerControl &pc, unsigned start, unsigned end, int to) |
void | MoveId (PlayerControl &pc, unsigned id, int to) |
void | SwapPositions (PlayerControl &pc, unsigned song1, unsigned song2) |
void | SwapIds (PlayerControl &pc, unsigned id1, unsigned id2) |
void | SetPriorityRange (PlayerControl &pc, unsigned start_position, unsigned end_position, uint8_t priority) |
void | SetPriorityId (PlayerControl &pc, unsigned song_id, uint8_t priority) |
void | SetSongIdRange (PlayerControl &pc, unsigned id, SongTime start, SongTime end) |
Sets the start_time and end_time attributes on the song with the specified id. More... | |
void | AddSongIdTag (unsigned id, TagType tag_type, const char *value) |
void | ClearSongIdTag (unsigned id, TagType tag_type) |
void | Stop (PlayerControl &pc) |
void | PlayPosition (PlayerControl &pc, int position) |
Throws std::runtime_error or #Error on error. More... | |
void | PlayOrder (PlayerControl &pc, unsigned order) |
Throws std::runtime_error or #Error on error. More... | |
void | PlayId (PlayerControl &pc, int id) |
Throws std::runtime_error or #Error on error. More... | |
void | PlayNext (PlayerControl &pc) |
Throws std::runtime_error or #Error on error. More... | |
void | PlayPrevious (PlayerControl &pc) |
Throws std::runtime_error or #Error on error. More... | |
void | SeekSongOrder (PlayerControl &pc, unsigned song_order, SongTime seek_time) |
Throws std::runtime_error or #Error on error. More... | |
void | SeekSongPosition (PlayerControl &pc, unsigned sonag_position, SongTime seek_time) |
Throws std::runtime_error or #Error on error. More... | |
void | SeekSongId (PlayerControl &pc, unsigned song_id, SongTime seek_time) |
Throws std::runtime_error or #Error on error. More... | |
void | SeekCurrent (PlayerControl &pc, SignedSongTime seek_time, bool relative) |
Seek within the current song. More... | |
bool | GetRepeat () const |
void | SetRepeat (PlayerControl &pc, bool new_value) |
bool | GetRandom () const |
void | SetRandom (PlayerControl &pc, bool new_value) |
bool | GetSingle () const |
void | SetSingle (PlayerControl &pc, bool new_value) |
bool | GetConsume () const |
void | SetConsume (bool new_value) |
Data Fields | |
Queue | queue |
The song queue - it contains the "real" playlist. More... | |
QueueListener & | listener |
bool | playing |
This value is true if the player is currently playing (or should be playing). More... | |
bool | stop_on_error |
If true, then any error is fatal; if false, MPD will attempt to play the next song on non-fatal errors. More... | |
bool | bulk_edit |
If true, then a bulk edit has been initiated by BeginBulk(), and UpdateQueuedSong() and OnModified() will be postponed until CommitBulk() More... | |
bool | bulk_modified |
Has the queue been modified during bulk edit mode? More... | |
unsigned | error_count |
Number of errors since playback was started. More... | |
int | current |
The "current song pointer" (the order number). More... | |
int | queued |
The "next" song to be played (the order number), when the current one finishes. More... | |
Protected Member Functions | |
void | OnModified () |
Called by all editing methods after a modification. More... | |
void | SongStarted () |
Called when playback of a new song starts. More... | |
void | UpdateQueuedSong (PlayerControl &pc, const DetachedSong *prev) |
Updates the "queued song". More... | |
void | QueueSongOrder (PlayerControl &pc, unsigned order) |
Queue a song, addressed by its order number. More... | |
void | QueuedSongStarted (PlayerControl &pc) |
Called when the player thread has started playing the "queued" song, i.e. More... | |
void | ResumePlayback (PlayerControl &pc) |
The player has stopped for some reason. More... | |
void | DeleteInternal (PlayerControl &pc, unsigned song, const DetachedSong **queued_p) |
Definition at line 34 of file Playlist.hxx.
|
inline |
Definition at line 91 of file Playlist.hxx.
|
inline |
Definition at line 100 of file Playlist.hxx.
void playlist::AddSongIdTag | ( | unsigned | id, |
TagType | tag_type, | ||
const char * | value | ||
) |
unsigned playlist::AppendSong | ( | PlayerControl & | pc, |
DetachedSong && | song | ||
) |
Throws PlaylistError if the queue would be too large.
unsigned playlist::AppendURI | ( | PlayerControl & | pc, |
const SongLoader & | loader, | ||
const char * | uri_utf8 | ||
) |
Throws #std::runtime_error on error.
void playlist::BeginBulk | ( | ) |
void playlist::Clear | ( | PlayerControl & | pc | ) |
void playlist::ClearSongIdTag | ( | unsigned | id, |
TagType | tag_type | ||
) |
void playlist::CommitBulk | ( | PlayerControl & | pc | ) |
void playlist::DeleteId | ( | PlayerControl & | pc, |
unsigned | id | ||
) |
|
protected |
|
inline |
Definition at line 226 of file Playlist.hxx.
void playlist::DeletePosition | ( | PlayerControl & | pc, |
unsigned | position | ||
) |
void playlist::DeleteRange | ( | PlayerControl & | pc, |
unsigned | start, | ||
unsigned | end | ||
) |
Deletes a range of songs from the playlist.
start | the position of the first song to delete |
end | the position after the last song to delete |
|
inline |
Definition at line 354 of file Playlist.hxx.
|
noexcept |
|
inline |
Definition at line 107 of file Playlist.hxx.
|
noexcept |
|
noexcept |
Returns the song object which is currently queued.
Returns none if there is none (yet?) or if MPD isn't playing.
|
inline |
Definition at line 342 of file Playlist.hxx.
|
inline |
Definition at line 336 of file Playlist.hxx.
|
inline |
Definition at line 348 of file Playlist.hxx.
|
inline |
Definition at line 103 of file Playlist.hxx.
void playlist::MoveId | ( | PlayerControl & | pc, |
unsigned | id, | ||
int | to | ||
) |
void playlist::MoveRange | ( | PlayerControl & | pc, |
unsigned | start, | ||
unsigned | end, | ||
int | to | ||
) |
|
protected |
Called by all editing methods after a modification.
Updates the queue version and invokes QueueListener::OnQueueModified().
void playlist::PlayId | ( | PlayerControl & | pc, |
int | id | ||
) |
Throws std::runtime_error or #Error on error.
void playlist::PlayNext | ( | PlayerControl & | pc | ) |
Throws std::runtime_error or #Error on error.
void playlist::PlayOrder | ( | PlayerControl & | pc, |
unsigned | order | ||
) |
Throws std::runtime_error or #Error on error.
void playlist::PlayPosition | ( | PlayerControl & | pc, |
int | position | ||
) |
Throws std::runtime_error or #Error on error.
void playlist::PlayPrevious | ( | PlayerControl & | pc | ) |
Throws std::runtime_error or #Error on error.
|
inline |
Definition at line 111 of file Playlist.hxx.
|
protected |
Called when the player thread has started playing the "queued" song, i.e.
it has switched from one song to the next automatically.
|
protected |
Queue a song, addressed by its order number.
|
protected |
The player has stopped for some reason.
Check the error, and decide whether to re-start playback.
void playlist::SeekCurrent | ( | PlayerControl & | pc, |
SignedSongTime | seek_time, | ||
bool | relative | ||
) |
Seek within the current song.
Fails if MPD is not currently playing.
Throws std::runtime_error or #Error on error.
seek_time | the time |
relative | if true, then the specified time is relative to the current position |
void playlist::SeekSongId | ( | PlayerControl & | pc, |
unsigned | song_id, | ||
SongTime | seek_time | ||
) |
Throws std::runtime_error or #Error on error.
void playlist::SeekSongOrder | ( | PlayerControl & | pc, |
unsigned | song_order, | ||
SongTime | seek_time | ||
) |
Throws std::runtime_error or #Error on error.
void playlist::SeekSongPosition | ( | PlayerControl & | pc, |
unsigned | sonag_position, | ||
SongTime | seek_time | ||
) |
Throws std::runtime_error or #Error on error.
void playlist::SetConsume | ( | bool | new_value | ) |
void playlist::SetPriorityId | ( | PlayerControl & | pc, |
unsigned | song_id, | ||
uint8_t | priority | ||
) |
void playlist::SetPriorityRange | ( | PlayerControl & | pc, |
unsigned | start_position, | ||
unsigned | end_position, | ||
uint8_t | priority | ||
) |
void playlist::SetRandom | ( | PlayerControl & | pc, |
bool | new_value | ||
) |
void playlist::SetRepeat | ( | PlayerControl & | pc, |
bool | new_value | ||
) |
void playlist::SetSingle | ( | PlayerControl & | pc, |
bool | new_value | ||
) |
void playlist::SetSongIdRange | ( | PlayerControl & | pc, |
unsigned | id, | ||
SongTime | start, | ||
SongTime | end | ||
) |
Sets the start_time and end_time attributes on the song with the specified id.
void playlist::Shuffle | ( | PlayerControl & | pc, |
unsigned | start, | ||
unsigned | end | ||
) |
|
protected |
Called when playback of a new song starts.
Unlike QueuedSongStarted(), this also gets called when the user manually switches to another song. It may be used for playlist fixups.
The song being started is specified by the current attribute.
void playlist::StaleSong | ( | PlayerControl & | pc, |
const char * | uri | ||
) |
Mark the given song as "stale", i.e.
as not being available anymore. This gets called when a song is removed from the database. The method attempts to remove all instances of this song from the queue.
void playlist::Stop | ( | PlayerControl & | pc | ) |
void playlist::SwapIds | ( | PlayerControl & | pc, |
unsigned | id1, | ||
unsigned | id2 | ||
) |
void playlist::SwapPositions | ( | PlayerControl & | pc, |
unsigned | song1, | ||
unsigned | song2 | ||
) |
void playlist::SyncWithPlayer | ( | PlayerControl & | pc | ) |
This is the "PLAYLIST" event handler.
It is invoked by the player thread whenever it requests a new queued song, or when it exits.
void playlist::TagModified | ( | DetachedSong && | song | ) |
A tag in the play queue has been modified by the player thread.
Apply the given song's tag to the current song if the song matches.
|
protected |
Updates the "queued song".
Calculates the next song according to the current one (if MPD isn't playing, it takes the first song), and queues this song. Clears the old queued song if there was one.
prev | the song which was previously queued, as determined by playlist_get_queued_song() |
bool playlist::bulk_edit |
If true, then a bulk edit has been initiated by BeginBulk(), and UpdateQueuedSong() and OnModified() will be postponed until CommitBulk()
Definition at line 60 of file Playlist.hxx.
bool playlist::bulk_modified |
Has the queue been modified during bulk edit mode?
Definition at line 65 of file Playlist.hxx.
int playlist::current |
The "current song pointer" (the order number).
This is the song which is played when we get the "play" command. It is also the song which is currently being played.
Definition at line 79 of file Playlist.hxx.
unsigned playlist::error_count |
Number of errors since playback was started.
If this number exceeds the length of the playlist, MPD gives up, because all songs have been tried.
Definition at line 72 of file Playlist.hxx.
QueueListener& playlist::listener |
Definition at line 40 of file Playlist.hxx.
bool playlist::playing |
This value is true if the player is currently playing (or should be playing).
Definition at line 46 of file Playlist.hxx.
Queue playlist::queue |
The song queue - it contains the "real" playlist.
Definition at line 38 of file Playlist.hxx.
int playlist::queued |
The "next" song to be played (the order number), when the current one finishes.
The decoder thread may start decoding and buffering it, while the "current" song is still playing.
This variable is only valid if playing is true.
Definition at line 89 of file Playlist.hxx.
bool playlist::stop_on_error |
If true, then any error is fatal; if false, MPD will attempt to play the next song on non-fatal errors.
During seeking, this flag is set.
Definition at line 53 of file Playlist.hxx.