Commit cf2b8146 authored by Max Kellermann's avatar Max Kellermann

output/Init: migrate Configure() from class Error to C++ exceptions

parent bbe7a373
...@@ -58,9 +58,7 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin, ...@@ -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, ...@@ -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) ...@@ -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 { ...@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment