From 5c0bc612fee3e87479ec9046f1b4ed495d6f9762 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 27 Dec 2014 18:56:23 +0100 Subject: output/pipe: add static method Create() --- src/output/plugins/PipeOutputPlugin.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') 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 ¶m, Error &error); + static AudioOutput *Create(const config_param ¶m, Error &error); + bool Open(AudioFormat &audio_format, Error &error); void Close() { @@ -67,17 +69,23 @@ PipeOutput::Configure(const config_param ¶m, Error &error) return true; } -static AudioOutput * -pipe_output_init(const config_param ¶m, Error &error) +inline AudioOutput * +PipeOutput::Create(const config_param ¶m, 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 ¶m, Error &error) +{ + return PipeOutput::Create(param, error); } static void -- cgit v1.2.3