AudioOutput: add constructor and destructor
This commit is contained in:
@@ -126,10 +126,6 @@ struct AlsaOutput {
|
||||
return ao_base_init(&base, &alsa_output_plugin,
|
||||
param, error);
|
||||
}
|
||||
|
||||
void Deinit() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr Domain alsa_output_domain("alsa_output");
|
||||
@@ -189,7 +185,6 @@ alsa_finish(AudioOutput *ao)
|
||||
{
|
||||
AlsaOutput *ad = (AlsaOutput *)ao;
|
||||
|
||||
ad->Deinit();
|
||||
delete ad;
|
||||
|
||||
/* free libasound's config cache */
|
||||
|
||||
@@ -47,10 +47,6 @@ struct AoOutput {
|
||||
error);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
bool Configure(const config_param ¶m, Error &error);
|
||||
};
|
||||
|
||||
@@ -163,7 +159,6 @@ ao_output_init(const config_param ¶m, Error &error)
|
||||
}
|
||||
|
||||
if (!ad->Configure(param, error)) {
|
||||
ad->Deinitialize();
|
||||
delete ad;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -177,7 +172,6 @@ ao_output_finish(AudioOutput *ao)
|
||||
AoOutput *ad = (AoOutput *)ao;
|
||||
|
||||
ao_free_options(ad->options);
|
||||
ad->Deinitialize();
|
||||
delete ad;
|
||||
|
||||
ao_output_ref--;
|
||||
|
||||
@@ -55,10 +55,6 @@ struct FifoOutput {
|
||||
error);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
bool Create(Error &error);
|
||||
bool Check(Error &error);
|
||||
void Delete();
|
||||
@@ -195,7 +191,6 @@ fifo_output_init(const config_param ¶m, Error &error)
|
||||
}
|
||||
|
||||
if (!fifo_open(fd, error)) {
|
||||
fd->Deinitialize();
|
||||
delete fd;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -209,7 +204,6 @@ fifo_output_finish(AudioOutput *ao)
|
||||
FifoOutput *fd = (FifoOutput *)ao;
|
||||
|
||||
fd->Close();
|
||||
fd->Deinitialize();
|
||||
delete fd;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,10 +169,6 @@ public:
|
||||
|
||||
bool Init(const config_param ¶m, Error &error);
|
||||
|
||||
void Finish() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
bool Configure(const config_param ¶m, Error &error);
|
||||
|
||||
AudioOutput *InitAndConfigure(const config_param ¶m,
|
||||
@@ -180,10 +176,8 @@ public:
|
||||
if (!Init(param, error))
|
||||
return nullptr;
|
||||
|
||||
if (!Configure(param, error)) {
|
||||
Finish();
|
||||
if (!Configure(param, error))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &base;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,6 @@ httpd_output_finish(AudioOutput *ao)
|
||||
{
|
||||
HttpdOutput *httpd = HttpdOutput::Cast(ao);
|
||||
|
||||
httpd->Finish();
|
||||
delete httpd;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,10 +83,6 @@ struct JackOutput {
|
||||
return ao_base_init(&base, &jack_output_plugin, param,
|
||||
error_r);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr Domain jack_output_domain("jack_output");
|
||||
@@ -399,7 +395,6 @@ mpd_jack_finish(AudioOutput *ao)
|
||||
for (unsigned i = 0; i < jd->num_destination_ports; ++i)
|
||||
g_free(jd->destination_ports[i]);
|
||||
|
||||
jd->Deinitialize();
|
||||
delete jd;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@ struct NullOutput {
|
||||
return ao_base_init(&base, &null_output_plugin, param,
|
||||
error);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
};
|
||||
|
||||
static AudioOutput *
|
||||
@@ -59,7 +55,6 @@ null_finish(AudioOutput *ao)
|
||||
{
|
||||
NullOutput *nd = (NullOutput *)ao;
|
||||
|
||||
nd->Deinitialize();
|
||||
delete nd;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,6 @@ struct OpenALOutput {
|
||||
return ao_base_init(&base, &openal_output_plugin, param,
|
||||
error_r);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr Domain openal_output_domain("openal_output");
|
||||
@@ -157,7 +153,6 @@ openal_finish(AudioOutput *ao)
|
||||
{
|
||||
OpenALOutput *od = (OpenALOutput *)ao;
|
||||
|
||||
od->Deinitialize();
|
||||
delete od;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,6 @@ struct OssOutput {
|
||||
return ao_base_init(&base, &oss_output_plugin, param,
|
||||
error_r);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr Domain oss_output_domain("oss_output");
|
||||
@@ -222,7 +218,6 @@ oss_output_finish(AudioOutput *ao)
|
||||
{
|
||||
OssOutput *od = (OssOutput *)ao;
|
||||
|
||||
ao_base_finish(&od->base);
|
||||
delete od;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,10 +39,6 @@ struct PipeOutput {
|
||||
error);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
bool Configure(const config_param ¶m, Error &error);
|
||||
};
|
||||
|
||||
@@ -72,7 +68,6 @@ pipe_output_init(const config_param ¶m, Error &error)
|
||||
}
|
||||
|
||||
if (!pd->Configure(param, error)) {
|
||||
pd->Deinitialize();
|
||||
delete pd;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -85,7 +80,6 @@ pipe_output_finish(AudioOutput *ao)
|
||||
{
|
||||
PipeOutput *pd = (PipeOutput *)ao;
|
||||
|
||||
pd->Deinitialize();
|
||||
delete pd;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,6 @@ pulse_output_finish(AudioOutput *ao)
|
||||
{
|
||||
PulseOutput *po = (PulseOutput *)ao;
|
||||
|
||||
ao_base_finish(&po->base);
|
||||
delete po;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,10 +62,6 @@ struct RecorderOutput {
|
||||
error_r);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
bool Configure(const config_param ¶m, Error &error);
|
||||
|
||||
bool WriteToFile(const void *data, size_t length, Error &error);
|
||||
@@ -118,7 +114,6 @@ recorder_output_init(const config_param ¶m, Error &error)
|
||||
}
|
||||
|
||||
if (!recorder->Configure(param, error)) {
|
||||
recorder->Deinitialize();
|
||||
delete recorder;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -132,7 +127,6 @@ recorder_output_finish(AudioOutput *ao)
|
||||
RecorderOutput *recorder = (RecorderOutput *)ao;
|
||||
|
||||
encoder_finish(recorder->encoder);
|
||||
recorder->Deinitialize();
|
||||
delete recorder;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,10 +61,6 @@ public:
|
||||
error);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
void Configure(const config_param ¶m);
|
||||
|
||||
bool Open(AudioFormat &audio_format, Error &error);
|
||||
@@ -155,7 +151,6 @@ roar_finish(AudioOutput *ao)
|
||||
{
|
||||
RoarOutput *self = (RoarOutput *)ao;
|
||||
|
||||
self->Deinitialize();
|
||||
delete self;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,10 +72,6 @@ struct ShoutOutput final {
|
||||
error);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
|
||||
bool Configure(const config_param ¶m, Error &error);
|
||||
};
|
||||
|
||||
@@ -285,7 +281,6 @@ my_shout_init_driver(const config_param ¶m, Error &error)
|
||||
}
|
||||
|
||||
if (!sd->Configure(param, error)) {
|
||||
sd->Deinitialize();
|
||||
delete sd;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -369,7 +364,6 @@ my_shout_finish_driver(AudioOutput *ao)
|
||||
|
||||
encoder_finish(sd->encoder);
|
||||
|
||||
sd->Deinitialize();
|
||||
delete sd;
|
||||
|
||||
shout_init_count--;
|
||||
|
||||
@@ -61,10 +61,6 @@ struct SolarisOutput {
|
||||
return ao_base_init(&base, &solaris_output_plugin, param,
|
||||
error_r);
|
||||
}
|
||||
|
||||
void Deinitialize() {
|
||||
ao_base_finish(&base);
|
||||
}
|
||||
};
|
||||
|
||||
static bool
|
||||
@@ -95,7 +91,6 @@ solaris_output_finish(AudioOutput *ao)
|
||||
{
|
||||
SolarisOutput *so = (SolarisOutput *)ao;
|
||||
|
||||
so->Deinitialize();
|
||||
delete so;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ winmm_output_init(const config_param ¶m, Error &error)
|
||||
|
||||
const char *device = param.GetBlockValue("device");
|
||||
if (!get_device_id(device, &wo->device_id, error)) {
|
||||
ao_base_finish(&wo->base);
|
||||
delete wo;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -132,7 +131,6 @@ winmm_output_finish(AudioOutput *ao)
|
||||
{
|
||||
WinmmOutput *wo = (WinmmOutput *)ao;
|
||||
|
||||
ao_base_finish(&wo->base);
|
||||
delete wo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user