diff options
author | Max Kellermann <max@duempel.org> | 2014-08-29 13:13:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-29 13:20:58 +0200 |
commit | 147d301f102512b1a64c85e3896bdd466fb634af (patch) | |
tree | 28678be7dea3760074bd2e8ce2fed07cd8fc8aaf | |
parent | 75a89c59838ff764b55ba3ce359d59d031446b3d (diff) | |
download | mpd-147d301f102512b1a64c85e3896bdd466fb634af.tar.gz mpd-147d301f102512b1a64c85e3896bdd466fb634af.tar.xz mpd-147d301f102512b1a64c85e3896bdd466fb634af.zip |
MultipleOutputs: use SignedSongTime for elapsed_time
-rw-r--r-- | src/PlayerThread.cxx | 4 | ||||
-rw-r--r-- | src/output/MultipleOutputs.cxx | 12 | ||||
-rw-r--r-- | src/output/MultipleOutputs.hxx | 5 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index e4fc84da1..51d6ee0e8 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -674,8 +674,8 @@ Player::ProcessCommand() pc.Lock(); } - pc.elapsed_time = pc.outputs.GetElapsedTime() >= 0 - ? SongTime::FromS(pc.outputs.GetElapsedTime()) + pc.elapsed_time = !pc.outputs.GetElapsedTime().IsNegative() + ? SongTime(pc.outputs.GetElapsedTime()) : elapsed_time; pc.CommandFinished(); diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index fe51c6100..be99d5aa5 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -39,7 +39,7 @@ MultipleOutputs::MultipleOutputs(MixerListener &_mixer_listener) :mixer_listener(_mixer_listener), input_audio_format(AudioFormat::Undefined()), buffer(nullptr), pipe(nullptr), - elapsed_time(-1) + elapsed_time(SignedSongTime::Negative()) { } @@ -344,7 +344,7 @@ MultipleOutputs::Check() if (chunk->length > 0 && chunk->times >= 0.0) /* only update elapsed_time if the chunk provides a defined value */ - elapsed_time = chunk->times; + elapsed_time = SignedSongTime::FromS(chunk->times); is_tail = chunk->next == nullptr; if (is_tail) @@ -428,7 +428,7 @@ MultipleOutputs::Cancel() /* invalidate elapsed_time */ - elapsed_time = -1.0; + elapsed_time = SignedSongTime::Negative(); } void @@ -449,7 +449,7 @@ MultipleOutputs::Close() input_audio_format.Clear(); - elapsed_time = -1.0; + elapsed_time = SignedSongTime::Negative(); } void @@ -470,7 +470,7 @@ MultipleOutputs::Release() input_audio_format.Clear(); - elapsed_time = -1.0; + elapsed_time = SignedSongTime::Negative(); } void @@ -478,5 +478,5 @@ MultipleOutputs::SongBorder() { /* clear the elapsed_time pointer at the beginning of a new song */ - elapsed_time = 0.0; + elapsed_time = SignedSongTime::zero(); } diff --git a/src/output/MultipleOutputs.hxx b/src/output/MultipleOutputs.hxx index f8482037c..2c6536e2a 100644 --- a/src/output/MultipleOutputs.hxx +++ b/src/output/MultipleOutputs.hxx @@ -28,6 +28,7 @@ #include "AudioFormat.hxx" #include "ReplayGainInfo.hxx" +#include "Chrono.hxx" #include "Compiler.h" #include <vector> @@ -66,7 +67,7 @@ class MultipleOutputs { * The "elapsed_time" stamp of the most recently finished * chunk. */ - float elapsed_time; + SignedSongTime elapsed_time; public: /** @@ -194,7 +195,7 @@ public: * finished yet. */ gcc_pure - float GetElapsedTime() const { + SignedSongTime GetElapsedTime() const { return elapsed_time; } |