aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-31 15:01:12 +0200
committerMax Kellermann <max@duempel.org>2014-08-31 15:03:34 +0200
commit6e04d66a354c02910ebd849f2233e52de8b6e3c4 (patch)
tree99665a9e8c728828f24e18f5bc475f9ac86b892f /src/queue
parent26bef5d20944d60b7bda1b1e6fc421e5d49e38b8 (diff)
parent86e8b3b4bd213f6013a0a2e8e0a9dd6d279494c1 (diff)
downloadmpd-6e04d66a354c02910ebd849f2233e52de8b6e3c4.tar.gz
mpd-6e04d66a354c02910ebd849f2233e52de8b6e3c4.tar.xz
mpd-6e04d66a354c02910ebd849f2233e52de8b6e3c4.zip
Merge tag 'v0.18.13'
Diffstat (limited to 'src/queue')
-rw-r--r--src/queue/Playlist.hxx4
-rw-r--r--src/queue/PlaylistControl.cxx29
2 files changed, 24 insertions, 9 deletions
diff --git a/src/queue/Playlist.hxx b/src/queue/Playlist.hxx
index 581d2a73b..ea19d9bba 100644
--- a/src/queue/Playlist.hxx
+++ b/src/queue/Playlist.hxx
@@ -251,6 +251,10 @@ public:
void PlayPrevious(PlayerControl &pc);
+ PlaylistResult SeekSongOrder(PlayerControl &pc,
+ unsigned song_order,
+ SongTime seek_time);
+
PlaylistResult SeekSongPosition(PlayerControl &pc,
unsigned song_position,
SongTime seek_time);
diff --git a/src/queue/PlaylistControl.cxx b/src/queue/PlaylistControl.cxx
index df6b6ed0f..f7e80dc46 100644
--- a/src/queue/PlaylistControl.cxx
+++ b/src/queue/PlaylistControl.cxx
@@ -190,18 +190,12 @@ playlist::PlayPrevious(PlayerControl &pc)
}
PlaylistResult
-playlist::SeekSongPosition(PlayerControl &pc,
- unsigned song, SongTime seek_time)
+playlist::SeekSongOrder(PlayerControl &pc, unsigned i, SongTime seek_time)
{
- if (!queue.IsValidPosition(song))
- return PlaylistResult::BAD_RANGE;
+ assert(queue.IsValidOrder(i));
const DetachedSong *queued_song = GetQueuedSong();
- unsigned i = queue.random
- ? queue.PositionToOrder(song)
- : song;
-
pc.ClearError();
stop_on_error = true;
error_count = 0;
@@ -229,6 +223,20 @@ playlist::SeekSongPosition(PlayerControl &pc,
}
PlaylistResult
+playlist::SeekSongPosition(PlayerControl &pc, unsigned song,
+ SongTime 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, SongTime seek_time)
{
int song = queue.IdToPosition(id);
@@ -257,5 +265,8 @@ playlist::SeekCurrent(PlayerControl &pc,
seek_time = SignedSongTime::zero();
}
- return SeekSongPosition(pc, current, SongTime(seek_time));
+ if (seek_time.IsNegative())
+ seek_time = SignedSongTime::zero();
+
+ return SeekSongOrder(pc, current, SongTime(seek_time));
}