aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-29 12:44:54 +0200
committerMax Kellermann <max@duempel.org>2014-08-29 13:20:58 +0200
commitca252804c6bbba163fe00d660f47ca4856e4874e (patch)
treece195df1192436d70d46ecfb2a190b191f070215 /src
parent7c25d83f1cc4c7db2d2d3f4506525dd056b885e8 (diff)
downloadmpd-ca252804c6bbba163fe00d660f47ca4856e4874e.tar.gz
mpd-ca252804c6bbba163fe00d660f47ca4856e4874e.tar.xz
mpd-ca252804c6bbba163fe00d660f47ca4856e4874e.zip
DecoderControl: use SignedSongTime for the song duration
Diffstat (limited to 'src')
-rw-r--r--src/PlayerThread.cxx4
-rw-r--r--src/decoder/DecoderAPI.cxx4
-rw-r--r--src/decoder/DecoderControl.hxx2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index c4db25e98..b8d0b43da 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -450,7 +450,7 @@ Player::CheckDecoderStartup()
return true;
pc.Lock();
- pc.total_time = real_song_duration(*dc.song, dc.total_time);
+ pc.total_time = real_song_duration(*dc.song, dc.total_time.ToDoubleS());
pc.audio_format = dc.in_audio_format;
pc.Unlock();
@@ -1001,7 +1001,7 @@ Player::Run()
calculate how many chunks will be required
for it */
cross_fade_chunks =
- pc.cross_fade.Calculate(dc.total_time,
+ pc.cross_fade.Calculate(dc.total_time.ToDoubleS(),
dc.replay_gain_db,
dc.replay_gain_prev_db,
dc.GetMixRampStart(),
diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx
index f34894b6a..bccd46b17 100644
--- a/src/decoder/DecoderAPI.cxx
+++ b/src/decoder/DecoderAPI.cxx
@@ -59,7 +59,9 @@ decoder_initialized(Decoder &decoder,
dc.out_audio_format = getOutputAudioFormat(audio_format);
dc.seekable = seekable;
- dc.total_time = total_time;
+ dc.total_time = total_time > 0
+ ? SignedSongTime::FromS(total_time)
+ : SignedSongTime::Negative();
FormatDebug(decoder_domain, "audio_format=%s, seekable=%s",
audio_format_to_string(dc.in_audio_format, &af_string),
diff --git a/src/decoder/DecoderControl.hxx b/src/decoder/DecoderControl.hxx
index d1a55e7b3..ed2b8c538 100644
--- a/src/decoder/DecoderControl.hxx
+++ b/src/decoder/DecoderControl.hxx
@@ -142,7 +142,7 @@ struct DecoderControl {
*/
SongTime end_time;
- float total_time;
+ SignedSongTime total_time;
/** the #MusicChunk allocator */
MusicBuffer *buffer;