output/pulse: use AudioOutputWrapper::Init()
This commit is contained in:
parent
f649514183
commit
f016eef48a
|
@ -66,6 +66,7 @@ struct PulseOutput {
|
||||||
static bool TestDefaultDevice();
|
static bool TestDefaultDevice();
|
||||||
|
|
||||||
bool Configure(const config_param ¶m, Error &error);
|
bool Configure(const config_param ¶m, Error &error);
|
||||||
|
static PulseOutput *Create(const config_param ¶m, Error &error);
|
||||||
|
|
||||||
bool Enable(Error &error);
|
bool Enable(Error &error);
|
||||||
void Disable();
|
void Disable();
|
||||||
|
@ -381,21 +382,19 @@ PulseOutput::Configure(const config_param ¶m, Error &error)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AudioOutput *
|
PulseOutput *
|
||||||
pulse_output_init(const config_param ¶m, Error &error)
|
PulseOutput::Create(const config_param ¶m, Error &error)
|
||||||
{
|
{
|
||||||
PulseOutput *po;
|
|
||||||
|
|
||||||
setenv("PULSE_PROP_media.role", "music", true);
|
setenv("PULSE_PROP_media.role", "music", true);
|
||||||
setenv("PULSE_PROP_application.icon_name", "mpd", true);
|
setenv("PULSE_PROP_application.icon_name", "mpd", true);
|
||||||
|
|
||||||
po = new PulseOutput();
|
auto *po = new PulseOutput();
|
||||||
if (!po->Configure(param, error)) {
|
if (!po->Configure(param, error)) {
|
||||||
delete po;
|
delete po;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &po->base;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
@ -849,8 +848,7 @@ inline bool
|
||||||
PulseOutput::TestDefaultDevice()
|
PulseOutput::TestDefaultDevice()
|
||||||
{
|
{
|
||||||
const config_param empty;
|
const config_param empty;
|
||||||
PulseOutput *po = (PulseOutput *)
|
PulseOutput *po = PulseOutput::Create(empty, IgnoreError());
|
||||||
pulse_output_init(empty, IgnoreError());
|
|
||||||
if (po == nullptr)
|
if (po == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -870,7 +868,7 @@ typedef AudioOutputWrapper<PulseOutput> Wrapper;
|
||||||
const struct AudioOutputPlugin pulse_output_plugin = {
|
const struct AudioOutputPlugin pulse_output_plugin = {
|
||||||
"pulse",
|
"pulse",
|
||||||
pulse_output_test_default_device,
|
pulse_output_test_default_device,
|
||||||
pulse_output_init,
|
&Wrapper::Init,
|
||||||
&Wrapper::Finish,
|
&Wrapper::Finish,
|
||||||
&Wrapper::Enable,
|
&Wrapper::Enable,
|
||||||
&Wrapper::Disable,
|
&Wrapper::Disable,
|
||||||
|
|
Loading…
Reference in New Issue