diff options
author | Max Kellermann <max@duempel.org> | 2015-01-21 22:13:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-01-21 23:56:33 +0100 |
commit | 4fa5538e2bed36903b403e1aaee2462d22b456dc (patch) | |
tree | 292b66e10e6b97e2363fde34a81c027a67d3a9fe /src/filter | |
parent | 84e74173de85a3897cfe67150297987f8c8bf52e (diff) |
config/Param: split block-specific attributes to new struct ConfigBlock
The old struct config_param remains only for top-level string options.
Diffstat (limited to 'src/filter')
-rw-r--r-- | src/filter/FilterConfig.cxx | 6 | ||||
-rw-r--r-- | src/filter/FilterPlugin.cxx | 12 | ||||
-rw-r--r-- | src/filter/FilterPlugin.hxx | 8 | ||||
-rw-r--r-- | src/filter/plugins/AutoConvertFilterPlugin.cxx | 4 | ||||
-rw-r--r-- | src/filter/plugins/ChainFilterPlugin.cxx | 2 | ||||
-rw-r--r-- | src/filter/plugins/ConvertFilterPlugin.cxx | 2 | ||||
-rw-r--r-- | src/filter/plugins/NormalizeFilterPlugin.cxx | 2 | ||||
-rw-r--r-- | src/filter/plugins/NullFilterPlugin.cxx | 2 | ||||
-rw-r--r-- | src/filter/plugins/ReplayGainFilterPlugin.cxx | 2 | ||||
-rw-r--r-- | src/filter/plugins/RouteFilterPlugin.cxx | 14 | ||||
-rw-r--r-- | src/filter/plugins/VolumeFilterPlugin.cxx | 2 |
11 files changed, 28 insertions, 28 deletions
diff --git a/src/filter/FilterConfig.cxx b/src/filter/FilterConfig.cxx index be2547751..c5f24362c 100644 --- a/src/filter/FilterConfig.cxx +++ b/src/filter/FilterConfig.cxx @@ -25,6 +25,7 @@ #include "config/ConfigOption.hxx" #include "config/ConfigGlobal.hxx" #include "config/ConfigError.hxx" +#include "config/Block.hxx" #include "util/Error.hxx" #include <algorithm> @@ -34,9 +35,8 @@ static bool filter_chain_append_new(Filter &chain, const char *template_name, Error &error) { - const struct config_param *cfg = - config_find_block(ConfigOption::AUDIO_FILTER, "name", - template_name); + const auto *cfg = config_find_block(ConfigBlockOption::AUDIO_FILTER, + "name", template_name); if (cfg == nullptr) { error.Format(config_domain, "filter template not found: %s", diff --git a/src/filter/FilterPlugin.cxx b/src/filter/FilterPlugin.cxx index 2d007e2db..93d1942a0 100644 --- a/src/filter/FilterPlugin.cxx +++ b/src/filter/FilterPlugin.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "FilterPlugin.hxx" #include "FilterRegistry.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "config/ConfigError.hxx" #include "util/Error.hxx" @@ -28,20 +28,20 @@ Filter * filter_new(const struct filter_plugin *plugin, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { assert(plugin != nullptr); assert(!error.IsDefined()); - return plugin->init(param, error); + return plugin->init(block, error); } Filter * -filter_configured_new(const config_param ¶m, Error &error) +filter_configured_new(const ConfigBlock &block, Error &error) { assert(!error.IsDefined()); - const char *plugin_name = param.GetBlockValue("plugin"); + const char *plugin_name = block.GetBlockValue("plugin"); if (plugin_name == nullptr) { error.Set(config_domain, "No filter plugin specified"); return nullptr; @@ -54,5 +54,5 @@ filter_configured_new(const config_param ¶m, Error &error) return nullptr; } - return filter_new(plugin, param, error); + return filter_new(plugin, block, error); } diff --git a/src/filter/FilterPlugin.hxx b/src/filter/FilterPlugin.hxx index 58a9c0c94..b60566c49 100644 --- a/src/filter/FilterPlugin.hxx +++ b/src/filter/FilterPlugin.hxx @@ -26,7 +26,7 @@ #ifndef MPD_FILTER_PLUGIN_HXX #define MPD_FILTER_PLUGIN_HXX -struct config_param; +struct ConfigBlock; class Filter; class Error; @@ -36,7 +36,7 @@ struct filter_plugin { /** * Allocates and configures a filter. */ - Filter *(*init)(const config_param ¶m, Error &error); + Filter *(*init)(const ConfigBlock &block, Error &error); }; /** @@ -50,7 +50,7 @@ struct filter_plugin { */ Filter * filter_new(const struct filter_plugin *plugin, - const config_param ¶m, Error &error); + const ConfigBlock &block, Error &error); /** * Creates a new filter, loads configuration and the plugin name from @@ -62,6 +62,6 @@ filter_new(const struct filter_plugin *plugin, * @return a new filter object, or nullptr on error */ Filter * -filter_configured_new(const config_param ¶m, Error &error); +filter_configured_new(const ConfigBlock &block, Error &error); #endif diff --git a/src/filter/plugins/AutoConvertFilterPlugin.cxx b/src/filter/plugins/AutoConvertFilterPlugin.cxx index 1c0c99799..52918080e 100644 --- a/src/filter/plugins/AutoConvertFilterPlugin.cxx +++ b/src/filter/plugins/AutoConvertFilterPlugin.cxx @@ -24,7 +24,7 @@ #include "filter/FilterInternal.hxx" #include "filter/FilterRegistry.hxx" #include "AudioFormat.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "util/ConstBuffer.hxx" #include <assert.h> @@ -70,7 +70,7 @@ AutoConvertFilter::Open(AudioFormat &in_audio_format, Error &error) if (in_audio_format != child_audio_format) { /* yes - create a convert_filter */ - const config_param empty; + const ConfigBlock empty; convert = filter_new(&convert_filter_plugin, empty, error); if (convert == nullptr) { filter->Close(); diff --git a/src/filter/plugins/ChainFilterPlugin.cxx b/src/filter/plugins/ChainFilterPlugin.cxx index c387881d8..b965295f7 100644 --- a/src/filter/plugins/ChainFilterPlugin.cxx +++ b/src/filter/plugins/ChainFilterPlugin.cxx @@ -70,7 +70,7 @@ private: static constexpr Domain chain_filter_domain("chain_filter"); static Filter * -chain_filter_init(gcc_unused const config_param ¶m, +chain_filter_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { return new ChainFilter(); diff --git a/src/filter/plugins/ConvertFilterPlugin.cxx b/src/filter/plugins/ConvertFilterPlugin.cxx index eea5f4b94..18053abd0 100644 --- a/src/filter/plugins/ConvertFilterPlugin.cxx +++ b/src/filter/plugins/ConvertFilterPlugin.cxx @@ -59,7 +59,7 @@ public: }; static Filter * -convert_filter_init(gcc_unused const config_param ¶m, +convert_filter_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { return new ConvertFilter(); diff --git a/src/filter/plugins/NormalizeFilterPlugin.cxx b/src/filter/plugins/NormalizeFilterPlugin.cxx index 41df4b7fc..77e8c1535 100644 --- a/src/filter/plugins/NormalizeFilterPlugin.cxx +++ b/src/filter/plugins/NormalizeFilterPlugin.cxx @@ -42,7 +42,7 @@ public: }; static Filter * -normalize_filter_init(gcc_unused const config_param ¶m, +normalize_filter_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { return new NormalizeFilter(); diff --git a/src/filter/plugins/NullFilterPlugin.cxx b/src/filter/plugins/NullFilterPlugin.cxx index 19792d13c..0bd8170f0 100644 --- a/src/filter/plugins/NullFilterPlugin.cxx +++ b/src/filter/plugins/NullFilterPlugin.cxx @@ -48,7 +48,7 @@ public: }; static Filter * -null_filter_init(gcc_unused const config_param ¶m, +null_filter_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { return new NullFilter(); diff --git a/src/filter/plugins/ReplayGainFilterPlugin.cxx b/src/filter/plugins/ReplayGainFilterPlugin.cxx index 617d99b74..ca1119331 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.cxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.cxx @@ -150,7 +150,7 @@ ReplayGainFilter::Update() } static Filter * -replay_gain_filter_init(gcc_unused const config_param ¶m, +replay_gain_filter_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { return new ReplayGainFilter(); diff --git a/src/filter/plugins/RouteFilterPlugin.cxx b/src/filter/plugins/RouteFilterPlugin.cxx index f84dac8cb..11eb534c9 100644 --- a/src/filter/plugins/RouteFilterPlugin.cxx +++ b/src/filter/plugins/RouteFilterPlugin.cxx @@ -41,7 +41,7 @@ #include "config.h" #include "config/ConfigError.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "AudioFormat.hxx" #include "filter/FilterPlugin.hxx" #include "filter/FilterInternal.hxx" @@ -114,11 +114,11 @@ public: * a>b, c>d, e>f, ... * where a... are non-unique, non-negative integers * and input channel a gets copied to output channel b, etc. - * @param param the configuration block to read + * @param block the configuration block to read * @param filter a route_filter whose min_channels and sources[] to set * @return true on success, false on error */ - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); /* virtual methods from class Filter */ AudioFormat Open(AudioFormat &af, Error &error) override; @@ -128,7 +128,7 @@ public: }; bool -RouteFilter::Configure(const config_param ¶m, Error &error) { +RouteFilter::Configure(const ConfigBlock &block, Error &error) { /* TODO: * With a more clever way of marking "don't copy to output N", @@ -142,7 +142,7 @@ RouteFilter::Configure(const config_param ¶m, Error &error) { min_output_channels = 0; // A cowardly default, just passthrough stereo - const char *routes = param.GetBlockValue("routes", "0>0, 1>1"); + const char *routes = block.GetBlockValue("routes", "0>0, 1>1"); while (true) { routes = StripLeft(routes); @@ -205,10 +205,10 @@ RouteFilter::Configure(const config_param ¶m, Error &error) { } static Filter * -route_filter_init(const config_param ¶m, Error &error) +route_filter_init(const ConfigBlock &block, Error &error) { RouteFilter *filter = new RouteFilter(); - if (!filter->Configure(param, error)) { + if (!filter->Configure(block, error)) { delete filter; return nullptr; } diff --git a/src/filter/plugins/VolumeFilterPlugin.cxx b/src/filter/plugins/VolumeFilterPlugin.cxx index 36f517f96..b9c3c277e 100644 --- a/src/filter/plugins/VolumeFilterPlugin.cxx +++ b/src/filter/plugins/VolumeFilterPlugin.cxx @@ -53,7 +53,7 @@ public: static constexpr Domain volume_domain("pcm_volume"); static Filter * -volume_filter_init(gcc_unused const config_param ¶m, +volume_filter_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { return new VolumeFilter(); |