aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-27 18:56:23 +0100
committerMax Kellermann <max@duempel.org>2014-12-27 18:56:23 +0100
commit5c0bc612fee3e87479ec9046f1b4ed495d6f9762 (patch)
tree46f7e5d6ace9763dff9ba3cef42a77b8a3eb0f5f /src
parent0e28b5324266cfe10e953a36a43331f139879463 (diff)
downloadmpd-5c0bc612fee3e87479ec9046f1b4ed495d6f9762.tar.gz
mpd-5c0bc612fee3e87479ec9046f1b4ed495d6f9762.tar.xz
mpd-5c0bc612fee3e87479ec9046f1b4ed495d6f9762.zip
output/pipe: add static method Create()
Diffstat (limited to 'src')
-rw-r--r--src/output/plugins/PipeOutputPlugin.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/output/plugins/PipeOutputPlugin.cxx b/src/output/plugins/PipeOutputPlugin.cxx
index 1be5340e8..e518a0115 100644
--- a/src/output/plugins/PipeOutputPlugin.cxx
+++ b/src/output/plugins/PipeOutputPlugin.cxx
@@ -39,6 +39,8 @@ struct PipeOutput {
bool Configure(const config_param &param, Error &error);
+ static AudioOutput *Create(const config_param &param, Error &error);
+
bool Open(AudioFormat &audio_format, Error &error);
void Close() {
@@ -67,17 +69,23 @@ PipeOutput::Configure(const config_param &param, Error &error)
return true;
}
-static AudioOutput *
-pipe_output_init(const config_param &param, Error &error)
+inline AudioOutput *
+PipeOutput::Create(const config_param &param, Error &error)
{
- PipeOutput *pd = new PipeOutput();
+ PipeOutput *po = new PipeOutput();
- if (!pd->Configure(param, error)) {
- delete pd;
+ if (!po->Configure(param, error)) {
+ delete po;
return nullptr;
}
- return &pd->base;
+ return &po->base;
+}
+
+static AudioOutput *
+pipe_output_init(const config_param &param, Error &error)
+{
+ return PipeOutput::Create(param, error);
}
static void