20 #ifndef MPD_PLAYER_CONTROL_HXX
21 #define MPD_PLAYER_CONTROL_HXX
194 unsigned buffer_chunks,
195 unsigned buffered_before_play,
227 const std::lock_guard<Mutex> protect(mutex);
262 client_cond.
wait(mutex);
280 const std::lock_guard<Mutex> protect(mutex);
297 const std::lock_guard<Mutex> protect(mutex);
308 void WaitCommandLocked() {
336 const std::lock_guard<Mutex> protect(mutex);
337 SynchronousCommand(cmd);
361 error = std::exception_ptr();
379 const std::lock_guard<Mutex> lock(mutex);
413 const std::lock_guard<Mutex> lock(mutex);
425 std::rethrow_exception(error);
432 const std::lock_guard<Mutex> protect(mutex);
457 tagged_song =
nullptr;
465 const std::lock_guard<Mutex> protect(mutex);
475 assert(song !=
nullptr);
476 assert(next_song ==
nullptr);
524 const std::lock_guard<Mutex> protect(mutex);
525 replay_gain_mode = _mode;
DetachedSong * ReadTaggedSong()
Read and clear the tagged_song attribute.
void SetOutputError(std::exception_ptr &&_error)
Set the error and set state to PlayerState::PAUSE.
DetachedSong * tagged_song
A copy of the current DetachedSong after its tags have been updated by the decoder (for example...
cancel pre-decoding PlayerControl.next_song; if the player has already started playing this song...
const AudioFormat configured_audio_format
The "audio_output_format" setting.
void LockSetBorderPause(bool border_pause)
Set the player's border_pause flag.
void ApplyEnabled() override
The AudioOutput has modified the "enabled" flag, and the client shall make the AudioOutput apply this...
An interface between the AudioOutput and the #Player.
The audio output has failed.
Mutex mutex
This lock protects command, state, error, tagged_song.
static constexpr SongTime zero()
DetachedSong * next_song
The next queued song.
A time stamp within a song.
void CommandFinished()
A command has been finished.
DetachedSong * LockReadTaggedSong()
Like ReadTaggedSong(), but locks and unlocks the object.
void LockEnqueueSong(DetachedSong *song)
PlayerError GetErrorType() const
void wait(PosixMutex &mutex)
void SetError(PlayerError type, std::exception_ptr &&_error)
Set the error.
void LockCommandFinished()
void LockSetReplayGainMode(ReplayGainMode _mode)
MultipleOutputs & outputs
std::exception_ptr error
The error that occurred in the player thread.
void Wait()
Waits for a signal on the object.
PlayerControl(PlayerListener &_listener, MultipleOutputs &_outputs, unsigned buffer_chunks, unsigned buffered_before_play, AudioFormat _configured_audio_format, const ReplayGainConfig &_replay_gain_config)
float GetMixRampDelay() const
void LockSeek(DetachedSong *song, SongTime t)
Makes the player thread seek the specified song to a position.
SignedSongTime total_time
void LockSetOutputError(std::exception_ptr &&_error)
bool LockWaitOutputConsumed(unsigned threshold)
Cond cond
Trigger this object after you have modified command.
double GetTotalPlayTime() const
void LockSetTaggedSong(const DetachedSong &song)
Set the tagged_song attribute to a newly allocated copy of the given DetachedSong.
void ChunksConsumed() override
Notify the client that we have consumed a few chunks.
gcc_pure player_status LockGetStatus() noexcept
void ClientWait()
The client calls this method to wait for command completion.
bool WaitOutputConsumed(unsigned threshold)
Checks if the size of the MusicPipe is below the #threshold.
void SetMixRampDb(float mixramp_db)
bool border_pause
If this flag is set, then the player will be auto-paused at the end of the song, before the next song...
void Signal()
Signals the object.
void LockCheckRethrowError() const
Like CheckRethrowError(), but locks and unlocks the object.
float GetCrossFade() const
void LockCancel()
see PlayerCommand::CANCEL
const unsigned buffered_before_play
At least one AudioOutput.enabled flag has been modified; commit those changes to the output threads...
ReplayGainMode replay_gain_mode
void LockSignal()
Signals the object.
PlayerListener & listener
const ReplayGainConfig replay_gain_config
Refresh status information in the PlayerControl struct, e.g.
void SetCrossFade(float cross_fade_seconds)
bool LockApplyBorderPause()
float GetMixRampDb() const
A variant of SongTime that is based on a signed integer.
Thread thread
The handle of the player thread.
PlayerControl.next_song has been updated.
float duration
The configured cross fade duration [s].
void SetMixRampDelay(float mixramp_delay_seconds)
void LockSetPause(bool pause_flag)
void ClientSignal()
Wake up the client waiting for command completion.
void CheckRethrowError() const
Checks whether an error has occurred, and if so, rethrows it.
void Play(DetachedSong *song)
Throws std::runtime_error or #Error on error.
float mixramp_delay
The configured MixRapm delay [s].
gcc_pure bool IsInside() const noexcept
Check if this thread is the current thread.
void Lock() const
Locks the object.
Cond client_cond
This object gets signalled when the player thread has finished the command.
SignedSongTime total_time
const unsigned buffer_chunks
void Unlock() const
Unlocks the object.
CrossFadeSettings cross_fade
PlayerState GetState() const