aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-29 00:53:49 +0100
committerMax Kellermann <max@duempel.org>2014-01-29 08:10:36 +0100
commitcb7366f47245bf259cef0b8c863eb3b724cff683 (patch)
treee1bb8b9f96124a6ee94effaec898408a5547ffe6 /src/output
parentbf803e241f4f1210e7ed1e71895a561de81d7a94 (diff)
downloadmpd-cb7366f47245bf259cef0b8c863eb3b724cff683.tar.gz
mpd-cb7366f47245bf259cef0b8c863eb3b724cff683.tar.xz
mpd-cb7366f47245bf259cef0b8c863eb3b724cff683.zip
AudioOutput: make "plugin" a reference
Diffstat (limited to 'src/output')
-rw-r--r--src/output/Init.cxx12
-rw-r--r--src/output/Internal.hxx2
-rw-r--r--src/output/OutputControl.cxx6
-rw-r--r--src/output/OutputPlugin.cxx34
-rw-r--r--src/output/OutputThread.cxx20
5 files changed, 37 insertions, 37 deletions
diff --git a/src/output/Init.cxx b/src/output/Init.cxx
index a4a22e33a..3ba191ed7 100644
--- a/src/output/Init.cxx
+++ b/src/output/Init.cxx
@@ -47,7 +47,7 @@
#define AUDIO_FILTERS "filters"
AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin)
- :plugin(&_plugin),
+ :plugin(_plugin),
enabled(true), really_enabled(false),
open(false),
pause(false),
@@ -59,10 +59,10 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin)
other_replay_gain_filter(nullptr),
command(AO_COMMAND_NONE)
{
- assert(plugin->finish != nullptr);
- assert(plugin->open != nullptr);
- assert(plugin->close != nullptr);
- assert(plugin->play != nullptr);
+ assert(plugin.finish != nullptr);
+ assert(plugin.open != nullptr);
+ assert(plugin.close != nullptr);
+ assert(plugin.play != nullptr);
}
static const AudioOutputPlugin *
@@ -245,7 +245,7 @@ audio_output_setup(AudioOutput *ao, const config_param &param,
Error mixer_error;
ao->mixer = audio_output_load_mixer(ao, param,
- ao->plugin->mixer_plugin,
+ ao->plugin.mixer_plugin,
*ao->filter, mixer_error);
if (ao->mixer == nullptr && mixer_error.IsDefined())
FormatError(mixer_error,
diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx
index a8a37358e..5c5455648 100644
--- a/src/output/Internal.hxx
+++ b/src/output/Internal.hxx
@@ -69,7 +69,7 @@ struct AudioOutput {
/**
* The plugin which implements this output device.
*/
- const AudioOutputPlugin *const plugin;
+ const AudioOutputPlugin &plugin;
/**
* The #mixer object associated with this audio output device.
diff --git a/src/output/OutputControl.cxx b/src/output/OutputControl.cxx
index 5b4c4f487..a956faed3 100644
--- a/src/output/OutputControl.cxx
+++ b/src/output/OutputControl.cxx
@@ -104,7 +104,7 @@ void
audio_output_enable(AudioOutput *ao)
{
if (!ao->thread.IsDefined()) {
- if (ao->plugin->enable == nullptr) {
+ if (ao->plugin.enable == nullptr) {
/* don't bother to start the thread now if the
device doesn't even have a enable() method;
just assign the variable and we're done */
@@ -122,7 +122,7 @@ void
audio_output_disable(AudioOutput *ao)
{
if (!ao->thread.IsDefined()) {
- if (ao->plugin->disable == nullptr)
+ if (ao->plugin.disable == nullptr)
ao->really_enabled = false;
else
/* if there's no thread yet, the device cannot
@@ -248,7 +248,7 @@ audio_output_play(AudioOutput *ao)
void audio_output_pause(AudioOutput *ao)
{
- if (ao->mixer != nullptr && ao->plugin->pause == nullptr)
+ if (ao->mixer != nullptr && ao->plugin.pause == nullptr)
/* the device has no pause mode: close the mixer,
unless its "global" flag is set (checked by
mixer_auto_close()) */
diff --git a/src/output/OutputPlugin.cxx b/src/output/OutputPlugin.cxx
index 45b979d3c..33bb854d4 100644
--- a/src/output/OutputPlugin.cxx
+++ b/src/output/OutputPlugin.cxx
@@ -35,75 +35,75 @@ ao_plugin_init(const AudioOutputPlugin *plugin,
void
ao_plugin_finish(AudioOutput *ao)
{
- ao->plugin->finish(ao);
+ ao->plugin.finish(ao);
}
bool
ao_plugin_enable(AudioOutput *ao, Error &error_r)
{
- return ao->plugin->enable != nullptr
- ? ao->plugin->enable(ao, error_r)
+ return ao->plugin.enable != nullptr
+ ? ao->plugin.enable(ao, error_r)
: true;
}
void
ao_plugin_disable(AudioOutput *ao)
{
- if (ao->plugin->disable != nullptr)
- ao->plugin->disable(ao);
+ if (ao->plugin.disable != nullptr)
+ ao->plugin.disable(ao);
}
bool
ao_plugin_open(AudioOutput *ao, AudioFormat &audio_format,
Error &error)
{
- return ao->plugin->open(ao, audio_format, error);
+ return ao->plugin.open(ao, audio_format, error);
}
void
ao_plugin_close(AudioOutput *ao)
{
- ao->plugin->close(ao);
+ ao->plugin.close(ao);
}
unsigned
ao_plugin_delay(AudioOutput *ao)
{
- return ao->plugin->delay != nullptr
- ? ao->plugin->delay(ao)
+ return ao->plugin.delay != nullptr
+ ? ao->plugin.delay(ao)
: 0;
}
void
ao_plugin_send_tag(AudioOutput *ao, const Tag *tag)
{
- if (ao->plugin->send_tag != nullptr)
- ao->plugin->send_tag(ao, 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,
Error &error)
{
- return ao->plugin->play(ao, chunk, size, error);
+ return ao->plugin.play(ao, chunk, size, error);
}
void
ao_plugin_drain(AudioOutput *ao)
{
- if (ao->plugin->drain != nullptr)
- ao->plugin->drain(ao);
+ if (ao->plugin.drain != nullptr)
+ ao->plugin.drain(ao);
}
void
ao_plugin_cancel(AudioOutput *ao)
{
- if (ao->plugin->cancel != nullptr)
- ao->plugin->cancel(ao);
+ if (ao->plugin.cancel != nullptr)
+ ao->plugin.cancel(ao);
}
bool
ao_plugin_pause(AudioOutput *ao)
{
- return ao->plugin->pause != nullptr && ao->plugin->pause(ao);
+ return ao->plugin.pause != nullptr && ao->plugin.pause(ao);
}
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx
index 449198c8b..95702d183 100644
--- a/src/output/OutputThread.cxx
+++ b/src/output/OutputThread.cxx
@@ -65,7 +65,7 @@ ao_enable(AudioOutput *ao)
if (!success) {
FormatError(error,
"Failed to enable \"%s\" [%s]",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
return false;
}
@@ -157,7 +157,7 @@ ao_open(AudioOutput *ao)
ao_filter_open(ao, ao->in_audio_format, error);
if (!filter_audio_format.IsDefined()) {
FormatError(error, "Failed to open filter for \"%s\" [%s]",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
ao->fail_timer.Update();
return;
@@ -176,7 +176,7 @@ ao_open(AudioOutput *ao)
if (!success) {
FormatError(error, "Failed to open \"%s\" [%s]",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
ao_filter_close(ao);
ao->fail_timer.Update();
@@ -186,7 +186,7 @@ ao_open(AudioOutput *ao)
if (!convert_filter_set(ao->convert_filter, ao->out_audio_format,
error)) {
FormatError(error, "Failed to convert for \"%s\" [%s]",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
ao_filter_close(ao);
ao->fail_timer.Update();
@@ -197,7 +197,7 @@ ao_open(AudioOutput *ao)
FormatDebug(output_domain,
"opened plugin=%s name=\"%s\" audio_format=%s",
- ao->plugin->name, ao->name,
+ ao->plugin.name, ao->name,
audio_format_to_string(ao->out_audio_format, &af_string));
if (ao->in_audio_format != ao->out_audio_format)
@@ -229,7 +229,7 @@ ao_close(AudioOutput *ao, bool drain)
ao->mutex.lock();
FormatDebug(output_domain, "closed plugin=%s name=\"%s\"",
- ao->plugin->name, ao->name);
+ ao->plugin.name, ao->name);
}
static void
@@ -245,7 +245,7 @@ ao_reopen_filter(AudioOutput *ao)
error)) {
FormatError(error,
"Failed to open filter for \"%s\" [%s]",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
/* this is a little code duplication fro ao_close(),
but we cannot call this function because we must
@@ -342,7 +342,7 @@ ao_chunk_data(AudioOutput *ao, const struct music_chunk *chunk,
&length, error);
if (data == nullptr) {
FormatError(error, "\"%s\" [%s] failed to filter",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
return nullptr;
}
}
@@ -413,7 +413,7 @@ ao_filter_chunk(AudioOutput *ao, const struct music_chunk *chunk,
data = ao->filter->FilterPCM(data, length, &length, error);
if (data == nullptr) {
FormatError(error, "\"%s\" [%s] failed to filter",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
return nullptr;
}
@@ -462,7 +462,7 @@ ao_play_chunk(AudioOutput *ao, const struct music_chunk *chunk)
if (nbytes == 0) {
/* play()==0 means failure */
FormatError(error, "\"%s\" [%s] failed to play",
- ao->name, ao->plugin->name);
+ ao->name, ao->plugin.name);
ao_close(ao, false);