diff options
Diffstat (limited to 'src/output/Init.cxx')
-rw-r--r-- | src/output/Init.cxx | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/output/Init.cxx b/src/output/Init.cxx index c4e4a1880..ae34bf846 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -35,6 +35,7 @@ #include "filter/plugins/ChainFilterPlugin.hxx" #include "config/ConfigError.hxx" #include "config/ConfigGlobal.hxx" +#include "config/Block.hxx" #include "util/Error.hxx" #include "Log.hxx" @@ -95,15 +96,15 @@ audio_output_detect(Error &error) */ gcc_pure static MixerType -audio_output_mixer_type(const config_param ¶m) +audio_output_mixer_type(const ConfigBlock &block) { /* read the local "mixer_type" setting */ - const char *p = param.GetBlockValue("mixer_type"); + const char *p = block.GetBlockValue("mixer_type"); if (p != nullptr) return mixer_type_parse(p); /* try the local "mixer_enabled" setting next (deprecated) */ - if (!param.GetBlockValue("mixer_enabled", true)) + if (!block.GetBlockValue("mixer_enabled", true)) return MixerType::NONE; /* fall back to the global "mixer_type" setting (also @@ -114,7 +115,7 @@ audio_output_mixer_type(const config_param ¶m) static Mixer * audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao, - const config_param ¶m, + const ConfigBlock &block, const MixerPlugin *plugin, Filter &filter_chain, MixerListener &listener, @@ -122,26 +123,26 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao, { Mixer *mixer; - switch (audio_output_mixer_type(param)) { + switch (audio_output_mixer_type(block)) { case MixerType::NONE: case MixerType::UNKNOWN: return nullptr; case MixerType::NULL_: return mixer_new(event_loop, null_mixer_plugin, ao, listener, - param, error); + block, error); case MixerType::HARDWARE: if (plugin == nullptr) return nullptr; return mixer_new(event_loop, *plugin, ao, listener, - param, error); + block, error); case MixerType::SOFTWARE: mixer = mixer_new(event_loop, software_mixer_plugin, ao, listener, - config_param(), + ConfigBlock(), IgnoreError()); assert(mixer != nullptr); @@ -155,17 +156,17 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao, } bool -AudioOutput::Configure(const config_param ¶m, Error &error) +AudioOutput::Configure(const ConfigBlock &block, Error &error) { - if (!param.IsNull()) { - name = param.GetBlockValue(AUDIO_OUTPUT_NAME); + if (!block.IsNull()) { + name = block.GetBlockValue(AUDIO_OUTPUT_NAME); if (name == nullptr) { error.Set(config_domain, "Missing \"name\" configuration"); return false; } - const char *p = param.GetBlockValue(AUDIO_OUTPUT_FORMAT); + const char *p = block.GetBlockValue(AUDIO_OUTPUT_FORMAT); if (p != nullptr) { bool success = audio_format_parse(config_audio_format, @@ -180,9 +181,9 @@ AudioOutput::Configure(const config_param ¶m, Error &error) config_audio_format.Clear(); } - tags = param.GetBlockValue("tags", true); - always_on = param.GetBlockValue("always_on", false); - enabled = param.GetBlockValue("enabled", true); + tags = block.GetBlockValue("tags", true); + always_on = block.GetBlockValue("always_on", false); + enabled = block.GetBlockValue("enabled", true); /* set up the filter chain */ @@ -193,7 +194,7 @@ AudioOutput::Configure(const config_param ¶m, Error &error) if (config_get_bool(ConfigOption::VOLUME_NORMALIZATION, false)) { Filter *normalize_filter = - filter_new(&normalize_filter_plugin, config_param(), + filter_new(&normalize_filter_plugin, ConfigBlock(), IgnoreError()); assert(normalize_filter != nullptr); @@ -203,7 +204,7 @@ AudioOutput::Configure(const config_param ¶m, Error &error) Error filter_error; filter_chain_parse(*filter, - param.GetBlockValue(AUDIO_FILTERS, ""), + block.GetBlockValue(AUDIO_FILTERS, ""), filter_error); // It's not really fatal - Part of the filter chain has been set up already @@ -221,24 +222,24 @@ AudioOutput::Configure(const config_param ¶m, Error &error) static bool audio_output_setup(EventLoop &event_loop, AudioOutput &ao, MixerListener &mixer_listener, - const config_param ¶m, + const ConfigBlock &block, Error &error) { /* create the replay_gain filter */ const char *replay_gain_handler = - param.GetBlockValue("replay_gain_handler", "software"); + block.GetBlockValue("replay_gain_handler", "software"); if (strcmp(replay_gain_handler, "none") != 0) { ao.replay_gain_filter = filter_new(&replay_gain_filter_plugin, - param, IgnoreError()); + block, IgnoreError()); assert(ao.replay_gain_filter != nullptr); ao.replay_gain_serial = 0; ao.other_replay_gain_filter = filter_new(&replay_gain_filter_plugin, - param, + block, IgnoreError()); assert(ao.other_replay_gain_filter != nullptr); @@ -251,7 +252,7 @@ audio_output_setup(EventLoop &event_loop, AudioOutput &ao, /* set up the mixer */ Error mixer_error; - ao.mixer = audio_output_load_mixer(event_loop, ao, param, + ao.mixer = audio_output_load_mixer(event_loop, ao, block, ao.plugin.mixer_plugin, *ao.filter, mixer_listener, @@ -279,7 +280,7 @@ audio_output_setup(EventLoop &event_loop, AudioOutput &ao, /* the "convert" filter must be the last one in the chain */ - ao.convert_filter = filter_new(&convert_filter_plugin, config_param(), + ao.convert_filter = filter_new(&convert_filter_plugin, ConfigBlock(), IgnoreError()); assert(ao.convert_filter != nullptr); @@ -289,17 +290,17 @@ audio_output_setup(EventLoop &event_loop, AudioOutput &ao, } AudioOutput * -audio_output_new(EventLoop &event_loop, const config_param ¶m, +audio_output_new(EventLoop &event_loop, const ConfigBlock &block, MixerListener &mixer_listener, PlayerControl &pc, Error &error) { const AudioOutputPlugin *plugin; - if (!param.IsNull()) { + if (!block.IsNull()) { const char *p; - p = param.GetBlockValue(AUDIO_OUTPUT_TYPE); + p = block.GetBlockValue(AUDIO_OUTPUT_TYPE); if (p == nullptr) { error.Set(config_domain, "Missing \"type\" configuration"); @@ -325,12 +326,12 @@ audio_output_new(EventLoop &event_loop, const config_param ¶m, plugin->name); } - AudioOutput *ao = ao_plugin_init(plugin, param, error); + AudioOutput *ao = ao_plugin_init(plugin, block, error); if (ao == nullptr) return nullptr; if (!audio_output_setup(event_loop, *ao, mixer_listener, - param, error)) { + block, error)) { ao_plugin_finish(ao); return nullptr; } |