output/Init: migrate Configure() from class Error to C++ exceptions
This commit is contained in:
parent
bbe7a37359
commit
cf2b814629
@ -58,9 +58,7 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin,
|
|||||||
assert(plugin.close != nullptr);
|
assert(plugin.close != nullptr);
|
||||||
assert(plugin.play != nullptr);
|
assert(plugin.play != nullptr);
|
||||||
|
|
||||||
Error error;
|
Configure(block);
|
||||||
if (!Configure(block, error))
|
|
||||||
throw std::runtime_error(error.GetMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const AudioOutputPlugin *
|
static const AudioOutputPlugin *
|
||||||
@ -155,16 +153,13 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao,
|
|||||||
gcc_unreachable();
|
gcc_unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
AudioOutput::Configure(const ConfigBlock &block, Error &error)
|
AudioOutput::Configure(const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
if (!block.IsNull()) {
|
if (!block.IsNull()) {
|
||||||
name = block.GetBlockValue(AUDIO_OUTPUT_NAME);
|
name = block.GetBlockValue(AUDIO_OUTPUT_NAME);
|
||||||
if (name == nullptr) {
|
if (name == nullptr)
|
||||||
error.Set(config_domain,
|
throw std::runtime_error("Missing \"name\" configuration");
|
||||||
"Missing \"name\" configuration");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *p = block.GetBlockValue(AUDIO_OUTPUT_FORMAT);
|
const char *p = block.GetBlockValue(AUDIO_OUTPUT_FORMAT);
|
||||||
if (p != nullptr)
|
if (p != nullptr)
|
||||||
@ -208,10 +203,6 @@ AudioOutput::Configure(const ConfigBlock &block, Error &error)
|
|||||||
"Failed to initialize filter chain for '%s'",
|
"Failed to initialize filter chain for '%s'",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -291,7 +291,7 @@ struct AudioOutput {
|
|||||||
~AudioOutput();
|
~AudioOutput();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool Configure(const ConfigBlock &block, Error &error);
|
void Configure(const ConfigBlock &block);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void StartThread();
|
void StartThread();
|
||||||
|
Loading…
Reference in New Issue
Block a user