diff options
author | Max Kellermann <max@duempel.org> | 2014-08-28 06:54:19 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-28 13:03:18 +0200 |
commit | 6ad933982f68f5fcbd1b3179bf5fed26f63aa792 (patch) | |
tree | f0aee7be7dd2caba5a795602bf519739ed6cefc0 /src/PlayerThread.cxx | |
parent | 854258f37626d40271a821d4835e9cfb946c8ad8 (diff) | |
download | mpd-6ad933982f68f5fcbd1b3179bf5fed26f63aa792.tar.gz mpd-6ad933982f68f5fcbd1b3179bf5fed26f63aa792.tar.xz mpd-6ad933982f68f5fcbd1b3179bf5fed26f63aa792.zip |
DetachedSong: use std::chrono::duration for start_ms and end_ms
Diffstat (limited to '')
-rw-r--r-- | src/PlayerThread.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index 0aa8d105d..e527a80ba 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -291,12 +291,12 @@ Player::StartDecoder(MusicPipe &_pipe) assert(queued || pc.command == PlayerCommand::SEEK); assert(pc.next_song != nullptr); - unsigned start_ms = pc.next_song->GetStartMS(); + SongTime start_time = pc.next_song->GetStartTime(); if (pc.command == PlayerCommand::SEEK) - start_ms += pc.seek_time.ToMS(); + start_time += pc.seek_time; dc.Start(new DetachedSong(*pc.next_song), - start_ms, pc.next_song->GetEndMS(), + start_time.ToMS(), pc.next_song->GetEndTime().ToMS(), buffer, _pipe); } @@ -376,13 +376,13 @@ real_song_duration(const DetachedSong &song, double decoder_duration) back to Song::GetDuration() */ return song.GetDuration(); - const unsigned start_ms = song.GetStartMS(); - const unsigned end_ms = song.GetEndMS(); + const SongTime start_time = song.GetStartTime(); + const SongTime end_time = song.GetEndTime(); - if (end_ms > 0 && end_ms / 1000.0 < decoder_duration) - return (end_ms - start_ms) / 1000.0; + if (end_time.IsPositive() && end_time.ToDoubleS() < decoder_duration) + return (end_time - start_time).ToDoubleS(); - return decoder_duration - start_ms / 1000.0; + return decoder_duration - start_time.ToDoubleS(); } bool @@ -518,7 +518,7 @@ Player::SeekDecoder() { assert(pc.next_song != nullptr); - const unsigned start_ms = pc.next_song->GetStartMS(); + const SongTime start_time = pc.next_song->GetStartTime(); if (!dc.LockIsCurrentSong(*pc.next_song)) { /* the decoder is already decoding the "next" song - @@ -568,7 +568,7 @@ Player::SeekDecoder() where = total_time; } - if (!dc.Seek(where + SongTime::FromMS(start_ms))) { + if (!dc.Seek(where + start_time)) { /* decoder failure */ player_command_finished(pc); return false; |