diff options
author | Max Kellermann <max@duempel.org> | 2014-12-27 18:56:23 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-27 18:56:23 +0100 |
commit | 5c0bc612fee3e87479ec9046f1b4ed495d6f9762 (patch) | |
tree | 46f7e5d6ace9763dff9ba3cef42a77b8a3eb0f5f /src/output | |
parent | 0e28b5324266cfe10e953a36a43331f139879463 (diff) | |
download | mpd-5c0bc612fee3e87479ec9046f1b4ed495d6f9762.tar.gz mpd-5c0bc612fee3e87479ec9046f1b4ed495d6f9762.tar.xz mpd-5c0bc612fee3e87479ec9046f1b4ed495d6f9762.zip |
output/pipe: add static method Create()
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/plugins/PipeOutputPlugin.cxx | 20 |
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 ¶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 |