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