20 #ifndef MPD_OUTPUT_INTERNAL_HXX
21 #define MPD_OUTPUT_INTERNAL_HXX
373 if (enabled == really_enabled)
443 const std::lock_guard<Mutex> protect(mutex);
452 void CommandFinished();
474 void OpenOutputAndConvert(
AudioFormat audio_format);
476 void Close(
bool drain);
483 void CloseOutput(
bool drain);
498 bool FillSourceOrClose();
518 static void Task(
void *arg);
bool IsOpen() const
Caller must lock the mutex.
AudioOutputSource source
Source of audio data.
bool always_on
Shall this output always play something (i.e.
struct AudioOutput::Request request
void SetReplayGainMode(ReplayGainMode _mode)
PeriodClock fail_timer
If not nullptr, the device has failed, and this timer is used to estimate how long it should stay dis...
bool pause
Is the device paused? i.e.
gcc_pure bool LockIsChunkConsumed(const MusicChunk &chunk)
std::exception_ptr last_error
The error that occurred in the output thread.
const std::exception_ptr & GetLastError() const
Caller must lock the mutex.
Mixer * mixer
The mixer object associated with this audio output device.
AudioFormat audio_format
The AudioFormat requested by #Command::OPEN.
An interface between the AudioOutput and the #Player.
A queue of MusicChunk objects.
void EnableDisableAsync()
Attempt to enable or disable the device as specified by the enabled attribute; attempt to sync it wit...
AudioFormat config_audio_format
The configured audio format.
struct notify audio_output_client_notify
Notify object used by the thread's client, i.e.
Command command
The next command to be performed by the output thread.
An event loop that polls for events on file/socket descriptors.
void CloseWait()
Same LockCloseWait(), but expects the lock to be held by the caller.
bool LockUpdate(const AudioFormat audio_format, const MusicPipe &mp, bool force)
Opens or closes the device, depending on the "enabled" flag.
AudioOutput(const AudioOutputPlugin &_plugin, const ConfigBlock &block)
Throws #std::runtime_error on error.
bool open
Is the device (already) open and functional?
PreparedFilter * prepared_other_replay_gain_filter
The replay_gain_filter_plugin instance of this audio output, to be applied to the second chunk during...
void LockCommandWait(Command cmd)
Lock the AudioOutput object and execute the command synchronously.
Mutex mutex
This mutex protects open, fail_timer, #pipe.
Source of audio data to be played by an AudioOutput.
A helper class which observes calls to a PreparedFilter and allows the caller to access the Filter in...
void CommandWait(Command cmd)
Sends a command to the AudioOutput object and waits for completion.
FilterObserver volume_filter
The #VolumeFilter instance of this audio output.
Open the output, or reopen it if it is already open, adjusting for input AudioFormat changes...
void DisableAsync()
Disables the device, but don't wait for completion.
Thread thread
The thread handle, or nullptr if the output thread isn't running.
AudioFormat filter_audio_format
The AudioFormat which is emitted by the Filter, with config_audio_format already applied.
const char * GetName() const
bool tags
Will this output receive tags from the decoder? The default is true, but it may be configured to fals...
void LockAllowPlay()
Set the "allow_play" and signal the thread.
AudioOutputClient * client
The PlayerControl object which "owns" this output.
AudioOutput * audio_output_new(EventLoop &event_loop, const ReplayGainConfig &replay_gain_config, const ConfigBlock &block, MixerListener &mixer_listener, AudioOutputClient &client)
Throws #std::runtime_error on error.
AudioFormat out_audio_format
The audio_format which is really sent to the device.
bool woken_for_play
Has the OutputThread been woken up to play more chunks? This is set by audio_output_play() and reset ...
FilterObserver convert_filter
The convert_filter_plugin instance of this audio output.
PreparedFilter * prepared_filter
The filter object of this audio output.
void EnableAsync()
Enables the device, but don't wait for completion.
bool in_playback_loop
True while the OutputThread is inside ao_play().
void WaitForCommand()
Waits for command completion.
bool allow_play
When this flag is set, the output thread will not do any playback.
void CommandAsync(Command cmd)
Sends a command, but does not wait for completion.
const char * name
The device's configured display name.
An interface that listens on events from mixer plugins.
Additional data for command.
bool IsCommandFinished() const
Caller must lock the mutex.
void audio_output_free(AudioOutput *ao)
void SetReplayGainMode(ReplayGainMode _mode)
const MusicPipe * pipe
The MusicPipe passed to #Command::OPEN.
void Setup(EventLoop &event_loop, const ReplayGainConfig &replay_gain_config, MixerListener &mixer_listener, const ConfigBlock &block)
void ClearTailChunk(const MusicChunk &chunk)
bool IsEnabled() const
Caller must lock the mutex.
bool enabled
Has the user enabled this device?
This is a stopwatch which saves the timestamp of an event, and can check whether a specified time spa...
void ClearTailChunk(const MusicChunk &chunk)
Cond cond
This condition object wakes up the output thread after command has been set.
void LockRelease()
Closes the audio output, but if the "always_on" flag is set, put it into pause mode instead...
gcc_pure bool IsChunkConsumed(const MusicChunk &chunk) const
Did we already consumed this chunk?
Drains the internal (hardware) buffers of the device.
void LockCancelAsync()
Clear the "allow_play" flag and send the "CANCEL" command asynchronously.
const AudioOutputPlugin & plugin
The plugin which implements this output device.
bool really_enabled
Is this device actually enabled, i.e.
A plugin which controls an audio output device.
PreparedFilter * prepared_replay_gain_filter
The replay_gain_filter_plugin instance of this audio output.