summaryrefslogtreecommitdiff
path: root/src/queue
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-28 12:53:48 +0200
committerMax Kellermann <max@duempel.org>2014-08-28 13:03:18 +0200
commit127fe6ecf001a7bfb7f9a1d704d22c5a866896a5 (patch)
tree4aac35b7687d006999c4e1047da5bfa249f6002b /src/queue
parent888ab0c89c154b4bb30b626734ce6a14c42a8ed5 (diff)
PlaylistEdit: pass std::chrono::duration to SetSongIdRange()
Diffstat (limited to 'src/queue')
-rw-r--r--src/queue/Playlist.hxx4
-rw-r--r--src/queue/PlaylistEdit.cxx14
2 files changed, 9 insertions, 9 deletions
diff --git a/src/queue/Playlist.hxx b/src/queue/Playlist.hxx
index 75e861a82..581d2a73b 100644
--- a/src/queue/Playlist.hxx
+++ b/src/queue/Playlist.hxx
@@ -228,11 +228,11 @@ public:
unsigned song_id, uint8_t priority);
/**
- * Sets the start_ms and end_ms attributes on the song
+ * Sets the start_time and end_time attributes on the song
* with the specified id.
*/
bool SetSongIdRange(PlayerControl &pc, unsigned id,
- unsigned start_ms, unsigned end_ms,
+ SongTime start, SongTime end,
Error &error);
bool AddSongIdTag(unsigned id, TagType tag_type, const char *value,
diff --git a/src/queue/PlaylistEdit.cxx b/src/queue/PlaylistEdit.cxx
index d10edb942..20d459732 100644
--- a/src/queue/PlaylistEdit.cxx
+++ b/src/queue/PlaylistEdit.cxx
@@ -434,10 +434,10 @@ playlist::Shuffle(PlayerControl &pc, unsigned start, unsigned end)
bool
playlist::SetSongIdRange(PlayerControl &pc, unsigned id,
- unsigned start_ms, unsigned end_ms,
+ SongTime start, SongTime end,
Error &error)
{
- assert(end_ms == 0 || start_ms < end_ms);
+ assert(end.IsZero() || start < end);
int position = queue.IdToPosition(id);
if (position < 0) {
@@ -467,20 +467,20 @@ playlist::SetSongIdRange(PlayerControl &pc, unsigned id,
/* validate the offsets */
const unsigned duration = song.GetTag().time;
- if (start_ms / 1000u > duration) {
+ if (start.ToMS() / 1000u > duration) {
error.Set(playlist_domain,
int(PlaylistResult::BAD_RANGE),
"Invalid start offset");
return false;
}
- if (end_ms / 1000u > duration)
- end_ms = 0;
+ if (end.ToMS() / 1000u > duration)
+ end = SongTime::zero();
}
/* edit it */
- song.SetStartTime(SongTime::FromMS(start_ms));
- song.SetEndTime(SongTime::FromMS(end_ms));
+ song.SetStartTime(start);
+ song.SetEndTime(end);
/* announce the change to all interested subsystems */
UpdateQueuedSong(pc, nullptr);