diff options
author | Max Kellermann <max@duempel.org> | 2015-01-04 19:44:45 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-01-04 19:44:45 +0100 |
commit | f016eef48a787933fa1c9f872b70421b1d54c40c (patch) | |
tree | 5b46ee7636961e07f88dccfdadf19d93e5e1b2c8 /src | |
parent | f6495141833a5fa9abe18a244da998cae0830f01 (diff) | |
download | mpd-f016eef48a787933fa1c9f872b70421b1d54c40c.tar.gz mpd-f016eef48a787933fa1c9f872b70421b1d54c40c.tar.xz mpd-f016eef48a787933fa1c9f872b70421b1d54c40c.zip |
output/pulse: use AudioOutputWrapper::Init()
Diffstat (limited to 'src')
-rw-r--r-- | src/output/plugins/PulseOutputPlugin.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx index ecfd9658f..4c9fc2cc3 100644 --- a/src/output/plugins/PulseOutputPlugin.cxx +++ b/src/output/plugins/PulseOutputPlugin.cxx @@ -66,6 +66,7 @@ struct PulseOutput { static bool TestDefaultDevice(); bool Configure(const config_param ¶m, Error &error); + static PulseOutput *Create(const config_param ¶m, Error &error); bool Enable(Error &error); void Disable(); @@ -381,21 +382,19 @@ PulseOutput::Configure(const config_param ¶m, Error &error) return true; } -static AudioOutput * -pulse_output_init(const config_param ¶m, Error &error) +PulseOutput * +PulseOutput::Create(const config_param ¶m, Error &error) { - PulseOutput *po; - setenv("PULSE_PROP_media.role", "music", true); setenv("PULSE_PROP_application.icon_name", "mpd", true); - po = new PulseOutput(); + auto *po = new PulseOutput(); if (!po->Configure(param, error)) { delete po; return nullptr; } - return &po->base; + return po; } inline bool @@ -849,8 +848,7 @@ inline bool PulseOutput::TestDefaultDevice() { const config_param empty; - PulseOutput *po = (PulseOutput *) - pulse_output_init(empty, IgnoreError()); + PulseOutput *po = PulseOutput::Create(empty, IgnoreError()); if (po == nullptr) return false; @@ -870,7 +868,7 @@ typedef AudioOutputWrapper<PulseOutput> Wrapper; const struct AudioOutputPlugin pulse_output_plugin = { "pulse", pulse_output_test_default_device, - pulse_output_init, + &Wrapper::Init, &Wrapper::Finish, &Wrapper::Enable, &Wrapper::Disable, |