Commit c4acccac authored by Max Kellermann's avatar Max Kellermann

output/Init: add constructor overload which calls Configure()

parent 13001c01
...@@ -58,6 +58,15 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin) ...@@ -58,6 +58,15 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin)
assert(plugin.play != nullptr); assert(plugin.play != nullptr);
} }
AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin,
const ConfigBlock &block)
:AudioOutput(_plugin)
{
Error error;
if (!Configure(block, error))
throw std::runtime_error(error.GetMessage());
}
static const AudioOutputPlugin * static const AudioOutputPlugin *
audio_output_detect(Error &error) audio_output_detect(Error &error)
{ {
......
...@@ -283,6 +283,13 @@ struct AudioOutput { ...@@ -283,6 +283,13 @@ struct AudioOutput {
bool current_chunk_finished; bool current_chunk_finished;
AudioOutput(const AudioOutputPlugin &_plugin); AudioOutput(const AudioOutputPlugin &_plugin);
/**
* Throws #std::runtime_error on error.
*/
AudioOutput(const AudioOutputPlugin &_plugin,
const ConfigBlock &block);
~AudioOutput(); ~AudioOutput();
bool Configure(const ConfigBlock &block, Error &error); bool Configure(const ConfigBlock &block, Error &error);
......
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