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

This commit is contained in:
Max Kellermann 2016-10-28 22:41:07 +02:00
parent 13001c018c
commit c4acccac14
2 changed files with 16 additions and 0 deletions

View File

@ -58,6 +58,15 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin)
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 *
audio_output_detect(Error &error)
{

View File

@ -283,6 +283,13 @@ struct AudioOutput {
bool current_chunk_finished;
AudioOutput(const AudioOutputPlugin &_plugin);
/**
* Throws #std::runtime_error on error.
*/
AudioOutput(const AudioOutputPlugin &_plugin,
const ConfigBlock &block);
~AudioOutput();
bool Configure(const ConfigBlock &block, Error &error);