aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-31 14:23:06 +0200
committerMax Kellermann <max@duempel.org>2014-08-31 14:23:06 +0200
commit704be54c3a96c7a6bebdaa67711f7debe410a13f (patch)
tree1e8ad44c695916e3672765c0a159725bdb819804
parent2406152576b512c6fedb4eb3b6d3849448d84e6b (diff)
downloadmpd-704be54c3a96c7a6bebdaa67711f7debe410a13f.tar.gz
mpd-704be54c3a96c7a6bebdaa67711f7debe410a13f.tar.xz
mpd-704be54c3a96c7a6bebdaa67711f7debe410a13f.zip
PlaylistControl: move code to new method SeekSongOrder()
Diffstat (limited to '')
-rw-r--r--src/Playlist.hxx4
-rw-r--r--src/PlaylistControl.cxx22
2 files changed, 19 insertions, 7 deletions
diff --git a/src/Playlist.hxx b/src/Playlist.hxx
index b660ecb40..582b3648a 100644
--- a/src/Playlist.hxx
+++ b/src/Playlist.hxx
@@ -234,6 +234,10 @@ public:
void PlayPrevious(PlayerControl &pc);
+ PlaylistResult SeekSongOrder(PlayerControl &pc,
+ unsigned song_order,
+ float seek_time);
+
PlaylistResult SeekSongPosition(PlayerControl &pc,
unsigned song_position,
float seek_time);
diff --git a/src/PlaylistControl.cxx b/src/PlaylistControl.cxx
index 58971a4b4..df0496e7c 100644
--- a/src/PlaylistControl.cxx
+++ b/src/PlaylistControl.cxx
@@ -190,17 +190,12 @@ playlist::PlayPrevious(PlayerControl &pc)
}
PlaylistResult
-playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
+playlist::SeekSongOrder(PlayerControl &pc, unsigned i, float seek_time)
{
- if (!queue.IsValidPosition(song))
- return PlaylistResult::BAD_RANGE;
+ assert(queue.IsValidOrder(i));
const Song *queued_song = GetQueuedSong();
- unsigned i = queue.random
- ? queue.PositionToOrder(song)
- : song;
-
pc.ClearError();
stop_on_error = true;
error_count = 0;
@@ -229,6 +224,19 @@ playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
}
PlaylistResult
+playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
+{
+ if (!queue.IsValidPosition(song))
+ return PlaylistResult::BAD_RANGE;
+
+ unsigned i = queue.random
+ ? queue.PositionToOrder(song)
+ : song;
+
+ return SeekSongOrder(pc, i, seek_time);
+}
+
+PlaylistResult
playlist::SeekSongId(PlayerControl &pc, unsigned id, float seek_time)
{
int song = queue.IdToPosition(id);