filter/Internal: rename struct AudioOutput to FilteredAudioOutput
Prepare to add an abstract class AudioOutput, to be implemented by plugins, to get rid of the C-style vtable.
This commit is contained in:
parent
fc04620519
commit
d0157af13e
|
@ -25,7 +25,7 @@
|
|||
|
||||
Mixer *
|
||||
mixer_new(EventLoop &event_loop,
|
||||
const MixerPlugin &plugin, AudioOutput &ao,
|
||||
const MixerPlugin &plugin, FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
class Mixer;
|
||||
class EventLoop;
|
||||
struct AudioOutput;
|
||||
struct FilteredAudioOutput;
|
||||
struct MixerPlugin;
|
||||
class MixerListener;
|
||||
struct ConfigBlock;
|
||||
|
@ -36,7 +36,8 @@ struct ConfigBlock;
|
|||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
Mixer *
|
||||
mixer_new(EventLoop &event_loop, const MixerPlugin &plugin, AudioOutput &ao,
|
||||
mixer_new(EventLoop &event_loop, const MixerPlugin &plugin,
|
||||
FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
const ConfigBlock &block);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define MPD_MIXER_PLUGIN_HXX
|
||||
|
||||
struct ConfigBlock;
|
||||
struct AudioOutput;
|
||||
struct FilteredAudioOutput;
|
||||
class Mixer;
|
||||
class MixerListener;
|
||||
class EventLoop;
|
||||
|
@ -39,11 +39,11 @@ struct MixerPlugin {
|
|||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*
|
||||
* @param ao the associated AudioOutput
|
||||
* @param ao the associated #AudioOutput
|
||||
* @param param the configuration section
|
||||
* @return a mixer object
|
||||
*/
|
||||
Mixer *(*init)(EventLoop &event_loop, AudioOutput &ao,
|
||||
Mixer *(*init)(EventLoop &event_loop, FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
const ConfigBlock &block);
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ AlsaMixer::Configure(const ConfigBlock &block)
|
|||
}
|
||||
|
||||
static Mixer *
|
||||
alsa_mixer_init(EventLoop &event_loop, gcc_unused AudioOutput &ao,
|
||||
alsa_mixer_init(EventLoop &event_loop, gcc_unused FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
};
|
||||
|
||||
static Mixer *
|
||||
haiku_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
|
||||
haiku_mixer_init(gcc_unused EventLoop &event_loop, FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
static Mixer *
|
||||
null_mixer_init(gcc_unused EventLoop &event_loop,
|
||||
gcc_unused AudioOutput &ao,
|
||||
gcc_unused FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,8 @@ OssMixer::Configure(const ConfigBlock &block)
|
|||
}
|
||||
|
||||
static Mixer *
|
||||
oss_mixer_init(gcc_unused EventLoop &event_loop, gcc_unused AudioOutput &ao,
|
||||
oss_mixer_init(gcc_unused EventLoop &event_loop,
|
||||
gcc_unused FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -161,7 +161,7 @@ pulse_mixer_on_change(PulseMixer &pm,
|
|||
}
|
||||
|
||||
static Mixer *
|
||||
pulse_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
|
||||
pulse_mixer_init(gcc_unused EventLoop &event_loop, FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
};
|
||||
|
||||
static Mixer *
|
||||
roar_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
|
||||
roar_mixer_init(gcc_unused EventLoop &event_loop, FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
static Mixer *
|
||||
software_mixer_init(gcc_unused EventLoop &event_loop,
|
||||
gcc_unused AudioOutput &ao,
|
||||
gcc_unused FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ winmm_volume_encode(int volume)
|
|||
}
|
||||
|
||||
static Mixer *
|
||||
winmm_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
|
||||
winmm_mixer_init(gcc_unused EventLoop &event_loop, FilteredAudioOutput &ao,
|
||||
MixerListener &listener,
|
||||
gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ static constexpr PeriodClock::Duration REOPEN_AFTER = std::chrono::seconds(10);
|
|||
|
||||
struct notify audio_output_client_notify;
|
||||
|
||||
AudioOutputControl::AudioOutputControl(AudioOutput *_output,
|
||||
AudioOutputControl::AudioOutputControl(FilteredAudioOutput *_output,
|
||||
AudioOutputClient &_client)
|
||||
:output(_output), client(_client),
|
||||
thread(BIND_THIS_METHOD(Task))
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
enum class ReplayGainMode : uint8_t;
|
||||
struct AudioOutput;
|
||||
struct FilteredAudioOutput;
|
||||
struct MusicChunk;
|
||||
struct ConfigBlock;
|
||||
class MusicPipe;
|
||||
|
@ -50,7 +50,7 @@ class AudioOutputClient;
|
|||
* Controller for an #AudioOutput and its output thread.
|
||||
*/
|
||||
class AudioOutputControl {
|
||||
AudioOutput *output;
|
||||
FilteredAudioOutput *output;
|
||||
|
||||
/**
|
||||
* The PlayerControl object which "owns" this output. This
|
||||
|
@ -209,7 +209,8 @@ public:
|
|||
*/
|
||||
mutable Mutex mutex;
|
||||
|
||||
AudioOutputControl(AudioOutput *_output, AudioOutputClient &_client);
|
||||
AudioOutputControl(FilteredAudioOutput *_output,
|
||||
AudioOutputClient &_client);
|
||||
|
||||
#ifndef NDEBUG
|
||||
~AudioOutputControl() {
|
||||
|
@ -303,16 +304,14 @@ public:
|
|||
void CommandAsync(Command cmd) noexcept;
|
||||
|
||||
/**
|
||||
* Sends a command to the #AudioOutput object and waits for
|
||||
* completion.
|
||||
* Sends a command to the object and waits for completion.
|
||||
*
|
||||
* Caller must lock the mutex.
|
||||
*/
|
||||
void CommandWait(Command cmd) noexcept;
|
||||
|
||||
/**
|
||||
* Lock the #AudioOutput object and execute the command
|
||||
* synchronously.
|
||||
* Lock the object and execute the command synchronously.
|
||||
*/
|
||||
void LockCommandWait(Command cmd) noexcept;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "mixer/MixerControl.hxx"
|
||||
#include "filter/FilterInternal.hxx"
|
||||
|
||||
AudioOutput::~AudioOutput()
|
||||
FilteredAudioOutput::~FilteredAudioOutput()
|
||||
{
|
||||
if (mixer != nullptr)
|
||||
mixer_free(mixer);
|
||||
|
@ -34,14 +34,14 @@ AudioOutput::~AudioOutput()
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::BeginDestroy() noexcept
|
||||
FilteredAudioOutput::BeginDestroy() noexcept
|
||||
{
|
||||
if (mixer != nullptr)
|
||||
mixer_auto_close(mixer);
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::FinishDestroy() noexcept
|
||||
FilteredAudioOutput::FinishDestroy() noexcept
|
||||
{
|
||||
ao_plugin_finish(this);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
#define AUDIO_OUTPUT_FORMAT "format"
|
||||
#define AUDIO_FILTERS "filters"
|
||||
|
||||
AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin,
|
||||
const ConfigBlock &block)
|
||||
FilteredAudioOutput::FilteredAudioOutput(const AudioOutputPlugin &_plugin,
|
||||
const ConfigBlock &block)
|
||||
:plugin(_plugin)
|
||||
{
|
||||
assert(plugin.finish != nullptr);
|
||||
|
@ -108,7 +108,7 @@ audio_output_mixer_type(const ConfigBlock &block) noexcept
|
|||
}
|
||||
|
||||
static Mixer *
|
||||
audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao,
|
||||
audio_output_load_mixer(EventLoop &event_loop, FilteredAudioOutput &ao,
|
||||
const ConfigBlock &block,
|
||||
const MixerPlugin *plugin,
|
||||
PreparedFilter &filter_chain,
|
||||
|
@ -148,7 +148,7 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao,
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::Configure(const ConfigBlock &block)
|
||||
FilteredAudioOutput::Configure(const ConfigBlock &block)
|
||||
{
|
||||
if (!block.IsNull()) {
|
||||
name = block.GetBlockValue(AUDIO_OUTPUT_NAME);
|
||||
|
@ -192,10 +192,10 @@ AudioOutput::Configure(const ConfigBlock &block)
|
|||
}
|
||||
|
||||
inline void
|
||||
AudioOutput::Setup(EventLoop &event_loop,
|
||||
const ReplayGainConfig &replay_gain_config,
|
||||
MixerListener &mixer_listener,
|
||||
const ConfigBlock &block)
|
||||
FilteredAudioOutput::Setup(EventLoop &event_loop,
|
||||
const ReplayGainConfig &replay_gain_config,
|
||||
MixerListener &mixer_listener,
|
||||
const ConfigBlock &block)
|
||||
{
|
||||
|
||||
/* create the replay_gain filter */
|
||||
|
@ -249,7 +249,7 @@ AudioOutput::Setup(EventLoop &event_loop,
|
|||
convert_filter.Set(convert_filter_prepare()));
|
||||
}
|
||||
|
||||
AudioOutput *
|
||||
FilteredAudioOutput *
|
||||
audio_output_new(EventLoop &event_loop,
|
||||
const ReplayGainConfig &replay_gain_config,
|
||||
const ConfigBlock &block,
|
||||
|
@ -278,7 +278,7 @@ audio_output_new(EventLoop &event_loop,
|
|||
plugin->name);
|
||||
}
|
||||
|
||||
AudioOutput *ao = ao_plugin_init(event_loop, *plugin, block);
|
||||
auto *ao = ao_plugin_init(event_loop, *plugin, block);
|
||||
assert(ao != nullptr);
|
||||
|
||||
try {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "util/StringBuffer.hxx"
|
||||
|
||||
void
|
||||
AudioOutput::Enable()
|
||||
FilteredAudioOutput::Enable()
|
||||
{
|
||||
try {
|
||||
ao_plugin_enable(*this);
|
||||
|
@ -40,13 +40,13 @@ AudioOutput::Enable()
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::Disable() noexcept
|
||||
FilteredAudioOutput::Disable() noexcept
|
||||
{
|
||||
ao_plugin_disable(*this);
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::ConfigureConvertFilter()
|
||||
FilteredAudioOutput::ConfigureConvertFilter()
|
||||
{
|
||||
try {
|
||||
convert_filter_set(convert_filter.Get(), out_audio_format);
|
||||
|
@ -57,7 +57,7 @@ AudioOutput::ConfigureConvertFilter()
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
|
||||
FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
|
||||
{
|
||||
out_audio_format = desired_audio_format;
|
||||
|
||||
|
@ -98,7 +98,7 @@ AudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::CloseOutput(bool drain) noexcept
|
||||
FilteredAudioOutput::CloseOutput(bool drain) noexcept
|
||||
{
|
||||
if (drain)
|
||||
ao_plugin_drain(*this);
|
||||
|
@ -109,21 +109,21 @@ AudioOutput::CloseOutput(bool drain) noexcept
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::OpenSoftwareMixer() noexcept
|
||||
FilteredAudioOutput::OpenSoftwareMixer() noexcept
|
||||
{
|
||||
if (mixer != nullptr && mixer->IsPlugin(software_mixer_plugin))
|
||||
software_mixer_set_filter(*mixer, volume_filter.Get());
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::CloseSoftwareMixer() noexcept
|
||||
FilteredAudioOutput::CloseSoftwareMixer() noexcept
|
||||
{
|
||||
if (mixer != nullptr && mixer->IsPlugin(software_mixer_plugin))
|
||||
software_mixer_set_filter(*mixer, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
AudioOutput::Close(bool drain) noexcept
|
||||
FilteredAudioOutput::Close(bool drain) noexcept
|
||||
{
|
||||
CloseOutput(drain);
|
||||
CloseSoftwareMixer();
|
||||
|
@ -133,13 +133,13 @@ AudioOutput::Close(bool drain) noexcept
|
|||
}
|
||||
|
||||
void
|
||||
AudioOutput::BeginPause() noexcept
|
||||
FilteredAudioOutput::BeginPause() noexcept
|
||||
{
|
||||
ao_plugin_cancel(*this);
|
||||
}
|
||||
|
||||
bool
|
||||
AudioOutput::IteratePause() noexcept
|
||||
FilteredAudioOutput::IteratePause() noexcept
|
||||
{
|
||||
try {
|
||||
return ao_plugin_pause(*this);
|
||||
|
|
|
@ -33,7 +33,7 @@ struct ConfigBlock;
|
|||
struct AudioOutputPlugin;
|
||||
struct ReplayGainConfig;
|
||||
|
||||
struct AudioOutput {
|
||||
struct FilteredAudioOutput {
|
||||
/**
|
||||
* The device's configured display name.
|
||||
*/
|
||||
|
@ -108,10 +108,10 @@ struct AudioOutput {
|
|||
/**
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
AudioOutput(const AudioOutputPlugin &_plugin,
|
||||
const ConfigBlock &block);
|
||||
FilteredAudioOutput(const AudioOutputPlugin &_plugin,
|
||||
const ConfigBlock &block);
|
||||
|
||||
~AudioOutput();
|
||||
~FilteredAudioOutput();
|
||||
|
||||
private:
|
||||
void Configure(const ConfigBlock &block);
|
||||
|
@ -188,7 +188,7 @@ extern struct notify audio_output_client_notify;
|
|||
/**
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
AudioOutput *
|
||||
FilteredAudioOutput *
|
||||
audio_output_new(EventLoop &event_loop,
|
||||
const ReplayGainConfig &replay_gain_config,
|
||||
const ConfigBlock &block,
|
||||
|
|
|
@ -49,7 +49,7 @@ MultipleOutputs::~MultipleOutputs()
|
|||
i->FinishDestroy();
|
||||
}
|
||||
|
||||
static AudioOutput *
|
||||
static FilteredAudioOutput *
|
||||
LoadOutput(EventLoop &event_loop,
|
||||
const ReplayGainConfig &replay_gain_config,
|
||||
MixerListener &mixer_listener,
|
||||
|
|
|
@ -42,7 +42,6 @@ class EventLoop;
|
|||
class MixerListener;
|
||||
class AudioOutputClient;
|
||||
struct MusicChunk;
|
||||
struct AudioOutput;
|
||||
struct ReplayGainConfig;
|
||||
|
||||
class MultipleOutputs {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "OutputPlugin.hxx"
|
||||
#include "Internal.hxx"
|
||||
|
||||
AudioOutput *
|
||||
FilteredAudioOutput *
|
||||
ao_plugin_init(EventLoop &event_loop,
|
||||
const AudioOutputPlugin &plugin,
|
||||
const ConfigBlock &block)
|
||||
|
@ -32,39 +32,39 @@ ao_plugin_init(EventLoop &event_loop,
|
|||
}
|
||||
|
||||
void
|
||||
ao_plugin_finish(AudioOutput *ao) noexcept
|
||||
ao_plugin_finish(FilteredAudioOutput *ao) noexcept
|
||||
{
|
||||
ao->plugin.finish(ao);
|
||||
}
|
||||
|
||||
void
|
||||
ao_plugin_enable(AudioOutput &ao)
|
||||
ao_plugin_enable(FilteredAudioOutput &ao)
|
||||
{
|
||||
if (ao.plugin.enable != nullptr)
|
||||
ao.plugin.enable(&ao);
|
||||
}
|
||||
|
||||
void
|
||||
ao_plugin_disable(AudioOutput &ao) noexcept
|
||||
ao_plugin_disable(FilteredAudioOutput &ao) noexcept
|
||||
{
|
||||
if (ao.plugin.disable != nullptr)
|
||||
ao.plugin.disable(&ao);
|
||||
}
|
||||
|
||||
void
|
||||
ao_plugin_open(AudioOutput &ao, AudioFormat &audio_format)
|
||||
ao_plugin_open(FilteredAudioOutput &ao, AudioFormat &audio_format)
|
||||
{
|
||||
ao.plugin.open(&ao, audio_format);
|
||||
}
|
||||
|
||||
void
|
||||
ao_plugin_close(AudioOutput &ao) noexcept
|
||||
ao_plugin_close(FilteredAudioOutput &ao) noexcept
|
||||
{
|
||||
ao.plugin.close(&ao);
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration
|
||||
ao_plugin_delay(AudioOutput &ao) noexcept
|
||||
ao_plugin_delay(FilteredAudioOutput &ao) noexcept
|
||||
{
|
||||
return ao.plugin.delay != nullptr
|
||||
? ao.plugin.delay(&ao)
|
||||
|
@ -72,34 +72,34 @@ ao_plugin_delay(AudioOutput &ao) noexcept
|
|||
}
|
||||
|
||||
void
|
||||
ao_plugin_send_tag(AudioOutput &ao, const Tag &tag)
|
||||
ao_plugin_send_tag(FilteredAudioOutput &ao, const Tag &tag)
|
||||
{
|
||||
if (ao.plugin.send_tag != nullptr)
|
||||
ao.plugin.send_tag(&ao, tag);
|
||||
}
|
||||
|
||||
size_t
|
||||
ao_plugin_play(AudioOutput &ao, const void *chunk, size_t size)
|
||||
ao_plugin_play(FilteredAudioOutput &ao, const void *chunk, size_t size)
|
||||
{
|
||||
return ao.plugin.play(&ao, chunk, size);
|
||||
}
|
||||
|
||||
void
|
||||
ao_plugin_drain(AudioOutput &ao)
|
||||
ao_plugin_drain(FilteredAudioOutput &ao)
|
||||
{
|
||||
if (ao.plugin.drain != nullptr)
|
||||
ao.plugin.drain(&ao);
|
||||
}
|
||||
|
||||
void
|
||||
ao_plugin_cancel(AudioOutput &ao) noexcept
|
||||
ao_plugin_cancel(FilteredAudioOutput &ao) noexcept
|
||||
{
|
||||
if (ao.plugin.cancel != nullptr)
|
||||
ao.plugin.cancel(&ao);
|
||||
}
|
||||
|
||||
bool
|
||||
ao_plugin_pause(AudioOutput &ao)
|
||||
ao_plugin_pause(FilteredAudioOutput &ao)
|
||||
{
|
||||
return ao.plugin.pause != nullptr && ao.plugin.pause(&ao);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
struct ConfigBlock;
|
||||
struct AudioFormat;
|
||||
struct Tag;
|
||||
struct AudioOutput;
|
||||
struct FilteredAudioOutput;
|
||||
struct MixerPlugin;
|
||||
class EventLoop;
|
||||
|
||||
|
@ -57,12 +57,12 @@ struct AudioOutputPlugin {
|
|||
* @param param the configuration section, or nullptr if there is
|
||||
* no configuration
|
||||
*/
|
||||
AudioOutput *(*init)(EventLoop &event_loop, const ConfigBlock &block);
|
||||
FilteredAudioOutput *(*init)(EventLoop &event_loop, const ConfigBlock &block);
|
||||
|
||||
/**
|
||||
* Free resources allocated by this device.
|
||||
*/
|
||||
void (*finish)(AudioOutput *data);
|
||||
void (*finish)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* Enable the device. This may allocate resources, preparing
|
||||
|
@ -70,13 +70,13 @@ struct AudioOutputPlugin {
|
|||
*
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
void (*enable)(AudioOutput *data);
|
||||
void (*enable)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* Disables the device. It is closed before this method is
|
||||
* called.
|
||||
*/
|
||||
void (*disable)(AudioOutput *data);
|
||||
void (*disable)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* Really open the device.
|
||||
|
@ -86,12 +86,12 @@ struct AudioOutputPlugin {
|
|||
* @param audio_format the audio format in which data is going
|
||||
* to be delivered; may be modified by the plugin
|
||||
*/
|
||||
void (*open)(AudioOutput *data, AudioFormat &audio_format);
|
||||
void (*open)(FilteredAudioOutput *data, AudioFormat &audio_format);
|
||||
|
||||
/**
|
||||
* Close the device.
|
||||
*/
|
||||
void (*close)(AudioOutput *data);
|
||||
void (*close)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* Returns a positive number if the output thread shall further
|
||||
|
@ -102,13 +102,13 @@ struct AudioOutputPlugin {
|
|||
*
|
||||
* @return the duration to wait
|
||||
*/
|
||||
std::chrono::steady_clock::duration (*delay)(AudioOutput *data) noexcept;
|
||||
std::chrono::steady_clock::duration (*delay)(FilteredAudioOutput *data) noexcept;
|
||||
|
||||
/**
|
||||
* Display metadata for the next chunk. Optional method,
|
||||
* because not all devices can display metadata.
|
||||
*/
|
||||
void (*send_tag)(AudioOutput *data, const Tag &tag);
|
||||
void (*send_tag)(FilteredAudioOutput *data, const Tag &tag);
|
||||
|
||||
/**
|
||||
* Play a chunk of audio data.
|
||||
|
@ -117,19 +117,19 @@ struct AudioOutputPlugin {
|
|||
*
|
||||
* @return the number of bytes played
|
||||
*/
|
||||
size_t (*play)(AudioOutput *data,
|
||||
size_t (*play)(FilteredAudioOutput *data,
|
||||
const void *chunk, size_t size);
|
||||
|
||||
/**
|
||||
* Wait until the device has finished playing.
|
||||
*/
|
||||
void (*drain)(AudioOutput *data);
|
||||
void (*drain)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* Try to cancel data which may still be in the device's
|
||||
* buffers.
|
||||
*/
|
||||
void (*cancel)(AudioOutput *data);
|
||||
void (*cancel)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* Pause the device. If supported, it may perform a special
|
||||
|
@ -142,7 +142,7 @@ struct AudioOutputPlugin {
|
|||
* @return false on error (output will be closed by caller),
|
||||
* true for continue to pause
|
||||
*/
|
||||
bool (*pause)(AudioOutput *data);
|
||||
bool (*pause)(FilteredAudioOutput *data);
|
||||
|
||||
/**
|
||||
* The mixer plugin associated with this output plugin. This
|
||||
|
@ -162,43 +162,43 @@ ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
|
|||
}
|
||||
|
||||
gcc_malloc
|
||||
AudioOutput *
|
||||
FilteredAudioOutput *
|
||||
ao_plugin_init(EventLoop &event_loop,
|
||||
const AudioOutputPlugin &plugin,
|
||||
const ConfigBlock &block);
|
||||
|
||||
void
|
||||
ao_plugin_finish(AudioOutput *ao) noexcept;
|
||||
ao_plugin_finish(FilteredAudioOutput *ao) noexcept;
|
||||
|
||||
void
|
||||
ao_plugin_enable(AudioOutput &ao);
|
||||
ao_plugin_enable(FilteredAudioOutput &ao);
|
||||
|
||||
void
|
||||
ao_plugin_disable(AudioOutput &ao) noexcept;
|
||||
ao_plugin_disable(FilteredAudioOutput &ao) noexcept;
|
||||
|
||||
void
|
||||
ao_plugin_open(AudioOutput &ao, AudioFormat &audio_format);
|
||||
ao_plugin_open(FilteredAudioOutput &ao, AudioFormat &audio_format);
|
||||
|
||||
void
|
||||
ao_plugin_close(AudioOutput &ao) noexcept;
|
||||
ao_plugin_close(FilteredAudioOutput &ao) noexcept;
|
||||
|
||||
gcc_pure
|
||||
std::chrono::steady_clock::duration
|
||||
ao_plugin_delay(AudioOutput &ao) noexcept;
|
||||
ao_plugin_delay(FilteredAudioOutput &ao) noexcept;
|
||||
|
||||
void
|
||||
ao_plugin_send_tag(AudioOutput &ao, const Tag &tag);
|
||||
ao_plugin_send_tag(FilteredAudioOutput &ao, const Tag &tag);
|
||||
|
||||
size_t
|
||||
ao_plugin_play(AudioOutput &ao, const void *chunk, size_t size);
|
||||
ao_plugin_play(FilteredAudioOutput &ao, const void *chunk, size_t size);
|
||||
|
||||
void
|
||||
ao_plugin_drain(AudioOutput &ao);
|
||||
ao_plugin_drain(FilteredAudioOutput &ao);
|
||||
|
||||
void
|
||||
ao_plugin_cancel(AudioOutput &ao) noexcept;
|
||||
ao_plugin_cancel(FilteredAudioOutput &ao) noexcept;
|
||||
|
||||
bool
|
||||
ao_plugin_pause(AudioOutput &ao);
|
||||
ao_plugin_pause(FilteredAudioOutput &ao);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,68 +30,68 @@ struct Tag;
|
|||
|
||||
template<class T>
|
||||
struct AudioOutputWrapper {
|
||||
static T &Cast(AudioOutput &ao) {
|
||||
static T &Cast(FilteredAudioOutput &ao) {
|
||||
return ContainerCast(ao, &T::base);
|
||||
}
|
||||
|
||||
static AudioOutput *Init(EventLoop &event_loop,
|
||||
const ConfigBlock &block) {
|
||||
static FilteredAudioOutput *Init(EventLoop &event_loop,
|
||||
const ConfigBlock &block) {
|
||||
T *t = T::Create(event_loop, block);
|
||||
return &t->base;
|
||||
}
|
||||
|
||||
static void Finish(AudioOutput *ao) {
|
||||
static void Finish(FilteredAudioOutput *ao) {
|
||||
T *t = &Cast(*ao);
|
||||
delete t;
|
||||
}
|
||||
|
||||
static void Enable(AudioOutput *ao) {
|
||||
static void Enable(FilteredAudioOutput *ao) {
|
||||
T &t = Cast(*ao);
|
||||
t.Enable();
|
||||
}
|
||||
|
||||
static void Disable(AudioOutput *ao) {
|
||||
static void Disable(FilteredAudioOutput *ao) {
|
||||
T &t = Cast(*ao);
|
||||
t.Disable();
|
||||
}
|
||||
|
||||
static void Open(AudioOutput *ao, AudioFormat &audio_format) {
|
||||
static void Open(FilteredAudioOutput *ao, AudioFormat &audio_format) {
|
||||
T &t = Cast(*ao);
|
||||
t.Open(audio_format);
|
||||
}
|
||||
|
||||
static void Close(AudioOutput *ao) {
|
||||
static void Close(FilteredAudioOutput *ao) {
|
||||
T &t = Cast(*ao);
|
||||
t.Close();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
static std::chrono::steady_clock::duration Delay(AudioOutput *ao) noexcept {
|
||||
static std::chrono::steady_clock::duration Delay(FilteredAudioOutput *ao) noexcept {
|
||||
T &t = Cast(*ao);
|
||||
return t.Delay();
|
||||
}
|
||||
|
||||
static void SendTag(AudioOutput *ao, const Tag &tag) {
|
||||
static void SendTag(FilteredAudioOutput *ao, const Tag &tag) {
|
||||
T &t = Cast(*ao);
|
||||
t.SendTag(tag);
|
||||
}
|
||||
|
||||
static size_t Play(AudioOutput *ao, const void *chunk, size_t size) {
|
||||
static size_t Play(FilteredAudioOutput *ao, const void *chunk, size_t size) {
|
||||
T &t = Cast(*ao);
|
||||
return t.Play(chunk, size);
|
||||
}
|
||||
|
||||
static void Drain(AudioOutput *ao) {
|
||||
static void Drain(FilteredAudioOutput *ao) {
|
||||
T &t = Cast(*ao);
|
||||
t.Drain();
|
||||
}
|
||||
|
||||
static void Cancel(AudioOutput *ao) {
|
||||
static void Cancel(FilteredAudioOutput *ao) {
|
||||
T &t = Cast(*ao);
|
||||
t.Cancel();
|
||||
}
|
||||
|
||||
static bool Pause(AudioOutput *ao) {
|
||||
static bool Pause(FilteredAudioOutput *ao) {
|
||||
T &t = Cast(*ao);
|
||||
return t.Pause();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class AlsaOutput final
|
|||
|
||||
friend struct AudioOutputWrapper<AlsaOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
Manual<PcmExport> pcm_export;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ static unsigned ao_output_ref;
|
|||
class AoOutput {
|
||||
friend struct AudioOutputWrapper<AoOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const size_t write_size;
|
||||
int driver;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
class FifoOutput {
|
||||
friend struct AudioOutputWrapper<FifoOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const AllocatedPath path;
|
||||
std::string path_utf8;
|
||||
|
|
|
@ -48,7 +48,7 @@ class HaikuOutput {
|
|||
friend int haiku_output_get_volume(HaikuOutput &haiku);
|
||||
friend bool haiku_output_set_volume(HaikuOutput &haiku, unsigned volume);
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
size_t write_size;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ static constexpr unsigned MAX_PORTS = 16;
|
|||
static constexpr size_t jack_sample_size = sizeof(jack_default_audio_sample_t);
|
||||
|
||||
struct JackOutput {
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
/**
|
||||
* libjack options passed to jack_client_open().
|
||||
|
@ -443,7 +443,7 @@ JackOutput::Disable()
|
|||
}
|
||||
}
|
||||
|
||||
static AudioOutput *
|
||||
static FilteredAudioOutput *
|
||||
mpd_jack_init(EventLoop &, const ConfigBlock &block)
|
||||
{
|
||||
jack_set_error_function(mpd_jack_error);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
class NullOutput {
|
||||
friend struct AudioOutputWrapper<NullOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const bool sync;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <memory>
|
||||
|
||||
struct OSXOutput {
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
/* configuration settings */
|
||||
OSType component_subtype;
|
||||
|
@ -103,7 +103,7 @@ OSXOutput::OSXOutput(const ConfigBlock &block)
|
|||
sync_sample_rate = block.GetBlockValue("sync_sample_rate", false);
|
||||
}
|
||||
|
||||
static AudioOutput *
|
||||
static FilteredAudioOutput *
|
||||
osx_output_init(EventLoop &, const ConfigBlock &block)
|
||||
{
|
||||
OSXOutput *oo = new OSXOutput(block);
|
||||
|
@ -128,7 +128,7 @@ osx_output_init(EventLoop &, const ConfigBlock &block)
|
|||
}
|
||||
|
||||
static void
|
||||
osx_output_finish(AudioOutput *ao)
|
||||
osx_output_finish(FilteredAudioOutput *ao)
|
||||
{
|
||||
OSXOutput *oo = (OSXOutput *)ao;
|
||||
|
||||
|
@ -514,7 +514,7 @@ osx_render(void *vdata,
|
|||
}
|
||||
|
||||
static void
|
||||
osx_output_enable(AudioOutput *ao)
|
||||
osx_output_enable(FilteredAudioOutput *ao)
|
||||
{
|
||||
char errormsg[1024];
|
||||
OSXOutput *oo = (OSXOutput *)ao;
|
||||
|
@ -550,7 +550,7 @@ osx_output_enable(AudioOutput *ao)
|
|||
}
|
||||
|
||||
static void
|
||||
osx_output_disable(AudioOutput *ao)
|
||||
osx_output_disable(FilteredAudioOutput *ao)
|
||||
{
|
||||
OSXOutput *oo = (OSXOutput *)ao;
|
||||
|
||||
|
@ -562,7 +562,7 @@ osx_output_disable(AudioOutput *ao)
|
|||
}
|
||||
|
||||
static void
|
||||
osx_output_close(AudioOutput *ao)
|
||||
osx_output_close(FilteredAudioOutput *ao)
|
||||
{
|
||||
OSXOutput *od = (OSXOutput *)ao;
|
||||
|
||||
|
@ -573,7 +573,7 @@ osx_output_close(AudioOutput *ao)
|
|||
}
|
||||
|
||||
static void
|
||||
osx_output_open(AudioOutput *ao, AudioFormat &audio_format)
|
||||
osx_output_open(FilteredAudioOutput *ao, AudioFormat &audio_format)
|
||||
{
|
||||
char errormsg[1024];
|
||||
OSXOutput *od = (OSXOutput *)ao;
|
||||
|
@ -663,14 +663,14 @@ osx_output_open(AudioOutput *ao, AudioFormat &audio_format)
|
|||
}
|
||||
|
||||
static size_t
|
||||
osx_output_play(AudioOutput *ao, const void *chunk, size_t size)
|
||||
osx_output_play(FilteredAudioOutput *ao, const void *chunk, size_t size)
|
||||
{
|
||||
OSXOutput *od = (OSXOutput *)ao;
|
||||
return od->ring_buffer->push((uint8_t *)chunk, size);
|
||||
}
|
||||
|
||||
static std::chrono::steady_clock::duration
|
||||
osx_output_delay(AudioOutput *ao) noexcept
|
||||
osx_output_delay(FilteredAudioOutput *ao) noexcept
|
||||
{
|
||||
OSXOutput *od = (OSXOutput *)ao;
|
||||
return od->ring_buffer->write_available()
|
||||
|
|
|
@ -39,7 +39,7 @@ class OpenALOutput {
|
|||
/* should be enough for buffer size = 2048 */
|
||||
static constexpr unsigned NUM_BUFFERS = 16;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const char *device_name;
|
||||
ALCdevice *device;
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
class OssOutput {
|
||||
friend struct AudioOutputWrapper<OssOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
#ifdef AFMT_S24_PACKED
|
||||
Manual<PcmExport> pcm_export;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class PipeOutput {
|
||||
friend struct AudioOutputWrapper<PipeOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const std::string cmd;
|
||||
FILE *fh;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
class PulseOutput {
|
||||
friend struct AudioOutputWrapper<PulseOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const char *name;
|
||||
const char *server;
|
||||
|
|
|
@ -45,7 +45,7 @@ static constexpr Domain recorder_domain("recorder");
|
|||
class RecorderOutput {
|
||||
friend struct AudioOutputWrapper<RecorderOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
/**
|
||||
* The configured encoder plugin.
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
class RoarOutput {
|
||||
friend struct AudioOutputWrapper<RoarOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const std::string host, name;
|
||||
|
||||
|
@ -54,7 +54,7 @@ class RoarOutput {
|
|||
public:
|
||||
RoarOutput(const ConfigBlock &block);
|
||||
|
||||
operator AudioOutput *() {
|
||||
operator FilteredAudioOutput *() {
|
||||
return &base;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
static constexpr unsigned DEFAULT_CONN_TIMEOUT = 2;
|
||||
|
||||
struct ShoutOutput final {
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
shout_t *shout_conn;
|
||||
shout_metadata_t *shout_meta;
|
||||
|
|
|
@ -47,7 +47,7 @@ static constexpr Domain sndio_output_domain("sndio_output");
|
|||
|
||||
class SndioOutput {
|
||||
friend struct AudioOutputWrapper<SndioOutput>;
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
const char *const device;
|
||||
const unsigned buffer_time; /* in ms */
|
||||
struct sio_hdl *sio_hdl;
|
||||
|
|
|
@ -53,7 +53,7 @@ struct audio_info {
|
|||
class SolarisOutput {
|
||||
friend struct AudioOutputWrapper<SolarisOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
/* configuration */
|
||||
const char *const device;
|
||||
|
|
|
@ -42,7 +42,7 @@ struct WinmmBuffer {
|
|||
class WinmmOutput {
|
||||
friend struct AudioOutputWrapper<WinmmOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
const UINT device_id;
|
||||
HWAVEOUT handle;
|
||||
|
|
|
@ -52,7 +52,7 @@ struct Tag;
|
|||
class HttpdOutput final : ServerSocket, DeferredMonitor {
|
||||
friend struct AudioOutputWrapper<HttpdOutput>;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
/**
|
||||
* True if the audio output is open and accepts client
|
||||
|
@ -160,7 +160,7 @@ public:
|
|||
static HttpdOutput *Create(EventLoop &event_loop,
|
||||
const ConfigBlock &block);
|
||||
|
||||
static constexpr HttpdOutput *Cast(AudioOutput *ao) {
|
||||
static constexpr HttpdOutput *Cast(FilteredAudioOutput *ao) {
|
||||
return &ContainerCast(*ao, &HttpdOutput::base);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class SlesOutput {
|
|||
static constexpr unsigned N_BUFFERS = 3;
|
||||
static constexpr size_t BUFFER_SIZE = 65536;
|
||||
|
||||
AudioOutput base;
|
||||
FilteredAudioOutput base;
|
||||
|
||||
SLES::Object engine_object, mix_object, play_object;
|
||||
SLES::Play play;
|
||||
|
@ -89,7 +89,7 @@ class SlesOutput {
|
|||
public:
|
||||
SlesOutput(const ConfigBlock &block);
|
||||
|
||||
operator AudioOutput *() {
|
||||
operator FilteredAudioOutput *() {
|
||||
return &base;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ try {
|
|||
EventLoop event_loop;
|
||||
|
||||
Mixer *mixer = mixer_new(event_loop, alsa_mixer_plugin,
|
||||
*(AudioOutput *)nullptr,
|
||||
*(FilteredAudioOutput *)nullptr,
|
||||
*(MixerListener *)nullptr,
|
||||
ConfigBlock());
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ filter_plugin_by_name(gcc_unused const char *name) noexcept
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static AudioOutput *
|
||||
static FilteredAudioOutput *
|
||||
load_audio_output(EventLoop &event_loop, const char *name)
|
||||
{
|
||||
const auto *param = config_find_block(ConfigBlockOption::AUDIO_OUTPUT,
|
||||
|
@ -63,7 +63,7 @@ load_audio_output(EventLoop &event_loop, const char *name)
|
|||
}
|
||||
|
||||
static void
|
||||
run_output(AudioOutput &ao, AudioFormat audio_format)
|
||||
run_output(FilteredAudioOutput &ao, AudioFormat audio_format)
|
||||
{
|
||||
/* open the audio output */
|
||||
|
||||
|
@ -127,7 +127,7 @@ try {
|
|||
|
||||
/* initialize the audio output */
|
||||
|
||||
AudioOutput *ao = load_audio_output(io_thread.GetEventLoop(), argv[2]);
|
||||
auto *ao = load_audio_output(io_thread.GetEventLoop(), argv[2]);
|
||||
|
||||
/* parse the audio format */
|
||||
|
||||
|
|
Loading…
Reference in New Issue