MPD  0.20.18
Data Fields
AudioOutputPlugin Struct Reference

A plugin which controls an audio output device. More...

#include <OutputPlugin.hxx>

Collaboration diagram for AudioOutputPlugin:
[legend]

Data Fields

const char * name
 the plugin's name More...
 
bool(* test_default_device )()
 Test if this plugin can provide a default output, in case none has been configured. More...
 
AudioOutput *(* init )(const ConfigBlock &block)
 Configure and initialize the device, but do not open it yet. More...
 
void(* finish )(AudioOutput *data)
 Free resources allocated by this device. More...
 
void(* enable )(AudioOutput *data)
 Enable the device. More...
 
void(* disable )(AudioOutput *data)
 Disables the device. More...
 
void(* open )(AudioOutput *data, AudioFormat &audio_format)
 Really open the device. More...
 
void(* close )(AudioOutput *data)
 Close the device. More...
 
std::chrono::steady_clock::duration(* delay )(AudioOutput *data) noexcept
 Returns a positive number if the output thread shall further delay the next call to play() or pause(), which will happen until this function returns 0. More...
 
void(* send_tag )(AudioOutput *data, const Tag &tag)
 Display metadata for the next chunk. More...
 
size_t(* play )(AudioOutput *data, const void *chunk, size_t size)
 Play a chunk of audio data. More...
 
void(* drain )(AudioOutput *data)
 Wait until the device has finished playing. More...
 
void(* cancel )(AudioOutput *data)
 Try to cancel data which may still be in the device's buffers. More...
 
bool(* pause )(AudioOutput *data)
 Pause the device. More...
 
const MixerPluginmixer_plugin
 The mixer plugin associated with this output plugin. More...
 

Detailed Description

A plugin which controls an audio output device.

Definition at line 38 of file OutputPlugin.hxx.

Field Documentation

◆ cancel

void(* AudioOutputPlugin::cancel) (AudioOutput *data)

Try to cancel data which may still be in the device's buffers.

Definition at line 131 of file OutputPlugin.hxx.

◆ close

void(* AudioOutputPlugin::close) (AudioOutput *data)

Close the device.

Definition at line 93 of file OutputPlugin.hxx.

◆ delay

std::chrono::steady_clock::duration(* AudioOutputPlugin::delay) (AudioOutput *data) noexcept
noexcept

Returns a positive number if the output thread shall further delay the next call to play() or pause(), which will happen until this function returns 0.

This should be implemented instead of doing a sleep inside the plugin, because this allows MPD to listen to commands meanwhile.

Returns
the duration to wait

Definition at line 104 of file OutputPlugin.hxx.

◆ disable

void(* AudioOutputPlugin::disable) (AudioOutput *data)

Disables the device.

It is closed before this method is called.

Definition at line 78 of file OutputPlugin.hxx.

◆ drain

void(* AudioOutputPlugin::drain) (AudioOutput *data)

Wait until the device has finished playing.

Definition at line 125 of file OutputPlugin.hxx.

◆ enable

void(* AudioOutputPlugin::enable) (AudioOutput *data)

Enable the device.

This may allocate resources, preparing for the device to be opened.

Throws #std::runtime_error on error.

Definition at line 72 of file OutputPlugin.hxx.

◆ finish

void(* AudioOutputPlugin::finish) (AudioOutput *data)

Free resources allocated by this device.

Definition at line 64 of file OutputPlugin.hxx.

◆ init

AudioOutput*(* AudioOutputPlugin::init) (const ConfigBlock &block)

Configure and initialize the device, but do not open it yet.

Throws #std::runtime_error on error.

Parameters
paramthe configuration section, or nullptr if there is no configuration

Definition at line 59 of file OutputPlugin.hxx.

◆ mixer_plugin

const MixerPlugin* AudioOutputPlugin::mixer_plugin

The mixer plugin associated with this output plugin.

This may be nullptr if no mixer plugin is implemented. When created, this mixer plugin gets the same ConfigParam as this audio output device.

Definition at line 152 of file OutputPlugin.hxx.

◆ name

const char* AudioOutputPlugin::name

the plugin's name

Definition at line 42 of file OutputPlugin.hxx.

◆ open

void(* AudioOutputPlugin::open) (AudioOutput *data, AudioFormat &audio_format)

Really open the device.

Throws #std::runtime_error on error.

Parameters
audio_formatthe audio format in which data is going to be delivered; may be modified by the plugin

Definition at line 88 of file OutputPlugin.hxx.

◆ pause

bool(* AudioOutputPlugin::pause) (AudioOutput *data)

Pause the device.

If supported, it may perform a special action, which keeps the device open, but does not play anything. Output plugins like "shout" might want to play silence during pause, so their clients won't be disconnected. Plugins which do not support pausing will simply be closed, and have to be reopened when unpaused.

Returns
false on error (output will be closed by caller), true for continue to pause

Definition at line 144 of file OutputPlugin.hxx.

◆ play

size_t(* AudioOutputPlugin::play) (AudioOutput *data, const void *chunk, size_t size)

Play a chunk of audio data.

Throws #std::runtime_error on error.

Returns
the number of bytes played

Definition at line 119 of file OutputPlugin.hxx.

◆ send_tag

void(* AudioOutputPlugin::send_tag) (AudioOutput *data, const Tag &tag)

Display metadata for the next chunk.

Optional method, because not all devices can display metadata.

Definition at line 110 of file OutputPlugin.hxx.

◆ test_default_device

bool(* AudioOutputPlugin::test_default_device) ()

Test if this plugin can provide a default output, in case none has been configured.

This method is optional.

Definition at line 48 of file OutputPlugin.hxx.


The documentation for this struct was generated from the following file: