OutputInit: allow "init" to throw exception
This commit is contained in:
parent
a249a630c0
commit
0c464b24ad
@ -454,6 +454,9 @@ private:
|
|||||||
*/
|
*/
|
||||||
extern struct notify audio_output_client_notify;
|
extern struct notify audio_output_client_notify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws #std::runtime_error on error.
|
||||||
|
*/
|
||||||
AudioOutput *
|
AudioOutput *
|
||||||
audio_output_new(EventLoop &event_loop, const ConfigBlock &block,
|
audio_output_new(EventLoop &event_loop, const ConfigBlock &block,
|
||||||
MixerListener &mixer_listener,
|
MixerListener &mixer_listener,
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include "config/ConfigOption.hxx"
|
#include "config/ConfigOption.hxx"
|
||||||
#include "notify.hxx"
|
#include "notify.hxx"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ MultipleOutputs::~MultipleOutputs()
|
|||||||
static AudioOutput *
|
static AudioOutput *
|
||||||
LoadOutput(EventLoop &event_loop, MixerListener &mixer_listener,
|
LoadOutput(EventLoop &event_loop, MixerListener &mixer_listener,
|
||||||
PlayerControl &pc, const ConfigBlock &block)
|
PlayerControl &pc, const ConfigBlock &block)
|
||||||
{
|
try {
|
||||||
Error error;
|
Error error;
|
||||||
AudioOutput *output = audio_output_new(event_loop, block,
|
AudioOutput *output = audio_output_new(event_loop, block,
|
||||||
mixer_listener,
|
mixer_listener,
|
||||||
@ -66,6 +68,13 @@ LoadOutput(EventLoop &event_loop, MixerListener &mixer_listener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
} catch (const std::runtime_error &e) {
|
||||||
|
if (block.line > 0)
|
||||||
|
FormatFatalError("line %i: %s",
|
||||||
|
block.line,
|
||||||
|
e.what());
|
||||||
|
else
|
||||||
|
FatalError(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -50,6 +50,8 @@ struct AudioOutputPlugin {
|
|||||||
* Configure and initialize the device, but do not open it
|
* Configure and initialize the device, but do not open it
|
||||||
* yet.
|
* yet.
|
||||||
*
|
*
|
||||||
|
* Throws #std::runtime_error on error.
|
||||||
|
*
|
||||||
* @param param the configuration section, or nullptr if there is
|
* @param param the configuration section, or nullptr if there is
|
||||||
* no configuration
|
* no configuration
|
||||||
* @return nullptr on error, or an opaque pointer to the plugin's
|
* @return nullptr on error, or an opaque pointer to the plugin's
|
||||||
|
Loading…
Reference in New Issue
Block a user