output/Control: add method Configure()

Prepare to move some configuration settings from AudioOutput to
AudioOutputControl.
This commit is contained in:
Max Kellermann 2017-05-22 23:36:45 +02:00
parent e5847f1ddf
commit 2e65686fc0
3 changed files with 24 additions and 1 deletions

View File

@ -44,6 +44,12 @@ AudioOutputControl::AudioOutputControl(AudioOutput *_output)
{ {
} }
void
AudioOutputControl::Configure(const ConfigBlock &block)
{
(void)block;
}
const char * const char *
AudioOutputControl::GetName() const AudioOutputControl::GetName() const
{ {

View File

@ -38,6 +38,7 @@
enum class ReplayGainMode : uint8_t; enum class ReplayGainMode : uint8_t;
struct AudioOutput; struct AudioOutput;
struct MusicChunk; struct MusicChunk;
struct ConfigBlock;
class MusicPipe; class MusicPipe;
class Mutex; class Mutex;
class Mixer; class Mixer;
@ -158,6 +159,11 @@ public:
AudioOutputControl(const AudioOutputControl &) = delete; AudioOutputControl(const AudioOutputControl &) = delete;
AudioOutputControl &operator=(const AudioOutputControl &) = delete; AudioOutputControl &operator=(const AudioOutputControl &) = delete;
/**
* Throws #std::runtime_error on error.
*/
void Configure(const ConfigBlock &block);
gcc_pure gcc_pure
const char *GetName() const; const char *GetName() const;

View File

@ -75,7 +75,18 @@ LoadOutputControl(EventLoop &event_loop,
auto *output = LoadOutput(event_loop, replay_gain_config, auto *output = LoadOutput(event_loop, replay_gain_config,
mixer_listener, mixer_listener,
client, block); client, block);
return new AudioOutputControl(output); auto *control = new AudioOutputControl(output);
try {
control->Configure(block);
} catch (...) {
control->BeginDestroy();
control->FinishDestroy();
delete control;
throw;
}
return control;
} }
void void