20 #ifndef MPD_DECODER_CONTROL_HXX 21 #define MPD_DECODER_CONTROL_HXX 231 const std::lock_guard<Mutex> protect(
mutex);
241 const std::lock_guard<Mutex> protect(
mutex);
253 const std::lock_guard<Mutex> protect(
mutex);
277 std::rethrow_exception(
error);
284 const std::lock_guard<Mutex> protect(
mutex);
295 error = std::exception_ptr();
312 const std::lock_guard<Mutex> protect(
mutex);
323 void WaitCommandLocked() {
349 const std::lock_guard<Mutex> protect(
mutex);
351 SynchronousCommandLocked(cmd);
355 const std::lock_guard<Mutex> protect(
mutex);
void Wait()
Waits for a signal on the DecoderControl object.
void ClearError()
Clear the error condition and free the #Error object (if any).
gcc_pure const char * GetEnd() const noexcept
gcc_pure bool LockHasFailed() const noexcept
SignedSongTime total_time
std::exception_ptr error
The error that occurred in the decoder thread.
gcc_pure bool IsCurrentSong(const DetachedSong &_song) const noexcept
Check if the specified song is currently being decoded.
A queue of MusicChunk objects.
void CycleMixRamp()
Move mixramp_end to mixramp_prev_end and clear mixramp_start/mixramp_end.
const char * GetMixRampPreviousEnd() const
A time stamp within a song.
DetachedSong * song
The song currently being decoded.
void wait(PosixMutex &mutex)
void Signal()
Signals the object.
float replay_gain_prev_db
AudioFormat in_audio_format
the format of the song file
Cond cond
Trigger this object after you have modified command.
MixRampInfo previous_mix_ramp
Thread thread
The handle of the decoder thread.
gcc_pure bool LockIsIdle() const noexcept
SongTime end_time
The decoder will stop when it reaches this position.
void Seek(SongTime t)
Throws #std::runtime_error on error.
An allocator for MusicChunk objects.
void SetReady(const AudioFormat audio_format, bool _seekable, SignedSongTime _duration)
Transition this obejct from DecoderState::START to DecoderState::DECODE.
MusicBuffer * buffer
the MusicChunk allocator
gcc_pure bool LockIsStarting() const noexcept
gcc_pure bool LockIsCurrentSong(const DetachedSong &_song) const noexcept
void Unlock() const
Unlocks the object.
ReplayGainMode replay_gain_mode
gcc_pure const char * GetStart() const noexcept
void CommandFinishedLocked()
Marks the current command as "finished" and notifies the client (= player thread).
MusicPipe * pipe
The destination pipe for decoded chunks.
void SetMixRamp(MixRampInfo &&new_value)
DecoderControl(Mutex &_mutex, Cond &_client_cond, const AudioFormat _configured_audio_format, const ReplayGainConfig &_replay_gain_config)
void Lock() const
Locks the object.
The last "START" command failed, because there was an I/O error or because no decoder was able to dec...
void LockCheckRethrowError() const
Like CheckRethrowError(), but locks and unlocks the object.
Mutex & mutex
This lock protects state and command.
bool client_is_waiting
Is the client currently waiting for the DecoderThread? If false, the DecoderThread may omit invoking ...
bool IsStarting() const noexcept
bool HasFailed() const noexcept
const char * GetMixRampEnd() const
A variant of SongTime that is based on a signed integer.
const char * GetMixRampStart() const
void Start(DetachedSong *song, SongTime start_time, SongTime end_time, MusicBuffer &buffer, MusicPipe &pipe)
Start the decoder.
Cond & client_cond
The trigger of this object's client.
const AudioFormat configured_audio_format
The "audio_output_format" setting.
AudioFormat out_audio_format
the format being sent to the music pipe
const ReplayGainConfig replay_gain_config
void CheckRethrowError() const
Checks whether an error has occurred, and if so, rethrows it.
SongTime start_time
The initial seek position, e.g.
void WaitForDecoder()
Waits for a signal from the decoder thread.