Commit 147d301f authored by Max Kellermann's avatar Max Kellermann

MultipleOutputs: use SignedSongTime for elapsed_time

parent 75a89c59
...@@ -674,8 +674,8 @@ Player::ProcessCommand() ...@@ -674,8 +674,8 @@ Player::ProcessCommand()
pc.Lock(); pc.Lock();
} }
pc.elapsed_time = pc.outputs.GetElapsedTime() >= 0 pc.elapsed_time = !pc.outputs.GetElapsedTime().IsNegative()
? SongTime::FromS(pc.outputs.GetElapsedTime()) ? SongTime(pc.outputs.GetElapsedTime())
: elapsed_time; : elapsed_time;
pc.CommandFinished(); pc.CommandFinished();
......
...@@ -39,7 +39,7 @@ MultipleOutputs::MultipleOutputs(MixerListener &_mixer_listener) ...@@ -39,7 +39,7 @@ MultipleOutputs::MultipleOutputs(MixerListener &_mixer_listener)
:mixer_listener(_mixer_listener), :mixer_listener(_mixer_listener),
input_audio_format(AudioFormat::Undefined()), input_audio_format(AudioFormat::Undefined()),
buffer(nullptr), pipe(nullptr), buffer(nullptr), pipe(nullptr),
elapsed_time(-1) elapsed_time(SignedSongTime::Negative())
{ {
} }
...@@ -344,7 +344,7 @@ MultipleOutputs::Check() ...@@ -344,7 +344,7 @@ MultipleOutputs::Check()
if (chunk->length > 0 && chunk->times >= 0.0) if (chunk->length > 0 && chunk->times >= 0.0)
/* only update elapsed_time if the chunk /* only update elapsed_time if the chunk
provides a defined value */ provides a defined value */
elapsed_time = chunk->times; elapsed_time = SignedSongTime::FromS(chunk->times);
is_tail = chunk->next == nullptr; is_tail = chunk->next == nullptr;
if (is_tail) if (is_tail)
...@@ -428,7 +428,7 @@ MultipleOutputs::Cancel() ...@@ -428,7 +428,7 @@ MultipleOutputs::Cancel()
/* invalidate elapsed_time */ /* invalidate elapsed_time */
elapsed_time = -1.0; elapsed_time = SignedSongTime::Negative();
} }
void void
...@@ -449,7 +449,7 @@ MultipleOutputs::Close() ...@@ -449,7 +449,7 @@ MultipleOutputs::Close()
input_audio_format.Clear(); input_audio_format.Clear();
elapsed_time = -1.0; elapsed_time = SignedSongTime::Negative();
} }
void void
...@@ -470,7 +470,7 @@ MultipleOutputs::Release() ...@@ -470,7 +470,7 @@ MultipleOutputs::Release()
input_audio_format.Clear(); input_audio_format.Clear();
elapsed_time = -1.0; elapsed_time = SignedSongTime::Negative();
} }
void void
...@@ -478,5 +478,5 @@ MultipleOutputs::SongBorder() ...@@ -478,5 +478,5 @@ MultipleOutputs::SongBorder()
{ {
/* clear the elapsed_time pointer at the beginning of a new /* clear the elapsed_time pointer at the beginning of a new
song */ song */
elapsed_time = 0.0; elapsed_time = SignedSongTime::zero();
} }
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include "ReplayGainInfo.hxx" #include "ReplayGainInfo.hxx"
#include "Chrono.hxx"
#include "Compiler.h" #include "Compiler.h"
#include <vector> #include <vector>
...@@ -66,7 +67,7 @@ class MultipleOutputs { ...@@ -66,7 +67,7 @@ class MultipleOutputs {
* The "elapsed_time" stamp of the most recently finished * The "elapsed_time" stamp of the most recently finished
* chunk. * chunk.
*/ */
float elapsed_time; SignedSongTime elapsed_time;
public: public:
/** /**
...@@ -194,7 +195,7 @@ public: ...@@ -194,7 +195,7 @@ public:
* finished yet. * finished yet.
*/ */
gcc_pure gcc_pure
float GetElapsedTime() const { SignedSongTime GetElapsedTime() const {
return elapsed_time; return elapsed_time;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment