summaryrefslogtreecommitdiff
path: root/src/queue/Playlist.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-26 08:34:51 +0100
committerMax Kellermann <max@duempel.org>2014-11-26 08:34:51 +0100
commitac8c1d0a0145a420e88ee16d9e7584b0dfcfe82d (patch)
tree8e0557b4463871ccac794089a1627433da8cb37b /src/queue/Playlist.cxx
parent921d01b59d669ab727e2e6b14580ef064b344b0e (diff)
Playlist: move more functions into the class
Diffstat (limited to 'src/queue/Playlist.cxx')
-rw-r--r--src/queue/Playlist.cxx46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/queue/Playlist.cxx b/src/queue/Playlist.cxx
index 47b023637..0dc36f5e7 100644
--- a/src/queue/Playlist.cxx
+++ b/src/queue/Playlist.cxx
@@ -44,21 +44,18 @@ playlist::TagModified(DetachedSong &&song)
idle_add(IDLE_PLAYLIST);
}
-/**
- * Queue a song, addressed by its order number.
- */
-static void
-playlist_queue_song_order(playlist &playlist, PlayerControl &pc,
- unsigned order)
+inline void
+playlist::QueueSongOrder(PlayerControl &pc, unsigned order)
+
{
- assert(playlist.queue.IsValidOrder(order));
+ assert(queue.IsValidOrder(order));
- playlist.queued = order;
+ queued = order;
- const DetachedSong &song = playlist.queue.GetOrder(order);
+ const DetachedSong &song = queue.GetOrder(order);
FormatDebug(playlist_domain, "queue song %i:\"%s\"",
- playlist.queued, song.GetURI());
+ queued, song.GetURI());
pc.EnqueueSong(new DetachedSong(song));
}
@@ -137,7 +134,7 @@ playlist::UpdateQueuedSong(PlayerControl &pc, const DetachedSong *prev)
if (next_order >= 0) {
if (next_song != prev)
- playlist_queue_song_order(*this, pc, next_order);
+ QueueSongOrder(pc, next_order);
else
queued = next_order;
}
@@ -157,9 +154,6 @@ playlist::PlayOrder(PlayerControl &pc, int order)
current = order;
}
-static void
-playlist_resume_playback(playlist &playlist, PlayerControl &pc);
-
void
playlist::SyncWithPlayer(PlayerControl &pc)
{
@@ -178,7 +172,7 @@ playlist::SyncWithPlayer(PlayerControl &pc)
should be restarted with the next song. That can
happen if the playlist isn't filling the queue fast
enough */
- playlist_resume_playback(*this, pc);
+ ResumePlayback(pc);
else {
/* check if the player thread has already started
playing the queued song */
@@ -196,31 +190,27 @@ playlist::SyncWithPlayer(PlayerControl &pc)
}
}
-/**
- * The player has stopped for some reason. Check the error, and
- * decide whether to re-start playback
- */
-static void
-playlist_resume_playback(playlist &playlist, PlayerControl &pc)
+inline void
+playlist::ResumePlayback(PlayerControl &pc)
{
- assert(playlist.playing);
+ assert(playing);
assert(pc.GetState() == PlayerState::STOP);
const auto error = pc.GetErrorType();
if (error == PlayerError::NONE)
- playlist.error_count = 0;
+ error_count = 0;
else
- ++playlist.error_count;
+ ++error_count;
- if ((playlist.stop_on_error && error != PlayerError::NONE) ||
+ if ((stop_on_error && error != PlayerError::NONE) ||
error == PlayerError::OUTPUT ||
- playlist.error_count >= playlist.queue.GetLength())
+ error_count >= queue.GetLength())
/* too many errors, or critical error: stop
playback */
- playlist.Stop(pc);
+ Stop(pc);
else
/* continue playback at the next song */
- playlist.PlayNext(pc);
+ PlayNext(pc);
}
void