Playlist: move playlist_song_started() into the class
This commit is contained in:
parent
2e7153d8d6
commit
8aa4a66ba0
|
@ -63,24 +63,21 @@ playlist_queue_song_order(playlist &playlist, PlayerControl &pc,
|
||||||
pc.EnqueueSong(new DetachedSong(song));
|
pc.EnqueueSong(new DetachedSong(song));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
inline void
|
||||||
* Called if the player thread has started playing the "queued" song.
|
playlist::QueuedSongStarted(PlayerControl &pc)
|
||||||
*/
|
|
||||||
static void
|
|
||||||
playlist_song_started(playlist &playlist, PlayerControl &pc)
|
|
||||||
{
|
{
|
||||||
assert(pc.next_song == nullptr);
|
assert(pc.next_song == nullptr);
|
||||||
assert(playlist.queued >= -1);
|
assert(queued >= -1);
|
||||||
|
|
||||||
/* queued song has started: copy queued to current,
|
/* queued song has started: copy queued to current,
|
||||||
and notify the clients */
|
and notify the clients */
|
||||||
|
|
||||||
int current = playlist.current;
|
const int old_current = current;
|
||||||
playlist.current = playlist.queued;
|
current = queued;
|
||||||
playlist.queued = -1;
|
queued = -1;
|
||||||
|
|
||||||
if(playlist.queue.consume)
|
if (queue.consume)
|
||||||
playlist.DeleteOrder(pc, current);
|
DeleteOrder(pc, old_current);
|
||||||
|
|
||||||
idle_add(IDLE_PLAYER);
|
idle_add(IDLE_PLAYER);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +182,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
|
||||||
/* check if the player thread has already started
|
/* check if the player thread has already started
|
||||||
playing the queued song */
|
playing the queued song */
|
||||||
if (pc_next_song == nullptr && queued != -1)
|
if (pc_next_song == nullptr && queued != -1)
|
||||||
playlist_song_started(*this, pc);
|
QueuedSongStarted(pc);
|
||||||
|
|
||||||
pc.Lock();
|
pc.Lock();
|
||||||
pc_next_song = pc.next_song;
|
pc_next_song = pc.next_song;
|
||||||
|
|
|
@ -145,6 +145,12 @@ protected:
|
||||||
*/
|
*/
|
||||||
void UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev);
|
void UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the player thread has started playing the
|
||||||
|
* "queued" song.
|
||||||
|
*/
|
||||||
|
void QueuedSongStarted(PlayerControl &pc);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void BeginBulk();
|
void BeginBulk();
|
||||||
void CommitBulk(PlayerControl &pc);
|
void CommitBulk(PlayerControl &pc);
|
||||||
|
|
Loading…
Reference in New Issue