aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-25 19:21:22 +0100
committerMax Kellermann <max@duempel.org>2014-11-26 08:24:25 +0100
commit8aa4a66ba03e8d2726fb7fddac53a892c41f1711 (patch)
treeb97ceed147df07da0fee9a65e190282769d21ebd /src
parent2e7153d8d61548afdd84c2a0000af0571b84e62e (diff)
downloadmpd-8aa4a66ba03e8d2726fb7fddac53a892c41f1711.tar.gz
mpd-8aa4a66ba03e8d2726fb7fddac53a892c41f1711.tar.xz
mpd-8aa4a66ba03e8d2726fb7fddac53a892c41f1711.zip
Playlist: move playlist_song_started() into the class
Diffstat (limited to 'src')
-rw-r--r--src/queue/Playlist.cxx21
-rw-r--r--src/queue/Playlist.hxx6
2 files changed, 15 insertions, 12 deletions
diff --git a/src/queue/Playlist.cxx b/src/queue/Playlist.cxx
index b2fd673b4..40495b330 100644
--- a/src/queue/Playlist.cxx
+++ b/src/queue/Playlist.cxx
@@ -63,24 +63,21 @@ playlist_queue_song_order(playlist &playlist, PlayerControl &pc,
pc.EnqueueSong(new DetachedSong(song));
}
-/**
- * Called if the player thread has started playing the "queued" song.
- */
-static void
-playlist_song_started(playlist &playlist, PlayerControl &pc)
+inline void
+playlist::QueuedSongStarted(PlayerControl &pc)
{
assert(pc.next_song == nullptr);
- assert(playlist.queued >= -1);
+ assert(queued >= -1);
/* queued song has started: copy queued to current,
and notify the clients */
- int current = playlist.current;
- playlist.current = playlist.queued;
- playlist.queued = -1;
+ const int old_current = current;
+ current = queued;
+ queued = -1;
- if(playlist.queue.consume)
- playlist.DeleteOrder(pc, current);
+ if (queue.consume)
+ DeleteOrder(pc, old_current);
idle_add(IDLE_PLAYER);
}
@@ -185,7 +182,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
/* check if the player thread has already started
playing the queued song */
if (pc_next_song == nullptr && queued != -1)
- playlist_song_started(*this, pc);
+ QueuedSongStarted(pc);
pc.Lock();
pc_next_song = pc.next_song;
diff --git a/src/queue/Playlist.hxx b/src/queue/Playlist.hxx
index ea19d9bba..c78950044 100644
--- a/src/queue/Playlist.hxx
+++ b/src/queue/Playlist.hxx
@@ -145,6 +145,12 @@ protected:
*/
void UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev);
+ /**
+ * Called when the player thread has started playing the
+ * "queued" song.
+ */
+ void QueuedSongStarted(PlayerControl &pc);
+
public:
void BeginBulk();
void CommitBulk(PlayerControl &pc);