output/null: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann 2016-11-09 12:03:20 +01:00
parent df4616ae4a
commit d0aa154ea6

View File

@ -28,17 +28,14 @@ class NullOutput {
AudioOutput base; AudioOutput base;
bool sync; const bool sync;
Timer *timer; Timer *timer;
public: public:
NullOutput() NullOutput(const ConfigBlock &block)
:base(null_output_plugin) {} :base(null_output_plugin, block),
sync(block.GetBlockValue("sync", true)) {}
bool Initialize(const ConfigBlock &block, Error &error) {
return base.Configure(block, error);
}
static NullOutput *Create(const ConfigBlock &block, Error &error); static NullOutput *Create(const ConfigBlock &block, Error &error);
@ -78,18 +75,9 @@ public:
}; };
inline NullOutput * inline NullOutput *
NullOutput::Create(const ConfigBlock &block, Error &error) NullOutput::Create(const ConfigBlock &block, Error &)
{ {
NullOutput *nd = new NullOutput(); return new NullOutput(block);
if (!nd->Initialize(block, error)) {
delete nd;
return nullptr;
}
nd->sync = block.GetBlockValue("sync", true);
return nd;
} }
typedef AudioOutputWrapper<NullOutput> Wrapper; typedef AudioOutputWrapper<NullOutput> Wrapper;