diff options
author | Max Kellermann <max@duempel.org> | 2014-08-26 21:52:28 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-26 22:27:04 +0200 |
commit | 0c2d767f6fca030a8da3202c05b3eb80ba176ef1 (patch) | |
tree | 481acab9b4a1fadf8e208142bde510167b406d7e /src/decoder/DecoderAPI.cxx | |
parent | 02e697032f7f375e67acc349ada6d849edf51aa3 (diff) | |
download | mpd-0c2d767f6fca030a8da3202c05b3eb80ba176ef1.tar.gz mpd-0c2d767f6fca030a8da3202c05b3eb80ba176ef1.tar.xz mpd-0c2d767f6fca030a8da3202c05b3eb80ba176ef1.zip |
DecoderAPI: use std::chrono::duration for decoder_seek*()
For type safety and code readability.
Diffstat (limited to 'src/decoder/DecoderAPI.cxx')
-rw-r--r-- | src/decoder/DecoderAPI.cxx | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx index 7349b00db..c9bdb46e8 100644 --- a/src/decoder/DecoderAPI.cxx +++ b/src/decoder/DecoderAPI.cxx @@ -204,37 +204,21 @@ decoder_command_finished(Decoder &decoder) dc.Unlock(); } -double decoder_seek_where(gcc_unused Decoder & decoder) +SongTime +decoder_seek_time(Decoder &decoder) { const DecoderControl &dc = decoder.dc; assert(dc.pipe != nullptr); if (decoder.initial_seek_running) - return dc.start_ms / 1000.; + return SongTime(dc.start_ms); assert(dc.command == DecoderCommand::SEEK); decoder.seeking = true; - return dc.seek_where; -} - -unsigned -decoder_seek_where_ms(Decoder &decoder) -{ - const DecoderControl &dc = decoder.dc; - - assert(dc.pipe != nullptr); - - if (decoder.initial_seek_running) - return dc.start_ms; - - assert(dc.command == DecoderCommand::SEEK); - - decoder.seeking = true; - - return unsigned(dc.seek_where * 1000); + return SongTime::FromS(dc.seek_where); } uint64_t |