summaryrefslogtreecommitdiff
path: root/src/filter
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-07-17 21:47:32 +0200
committerMax Kellermann <max@musicpd.org>2018-07-17 22:05:24 +0200
commit7b02c0224c839d88bb61ee719d780f6a653eb4e2 (patch)
treee1af315ad4eb8ad71545f83492abd00d34fa2a64 /src/filter
parent57d77cc8a05835b2d1a33f1cec5adcc46a196981 (diff)
filter/LoadChain: use struct ConfigData
Diffstat (limited to 'src/filter')
-rw-r--r--src/filter/LoadChain.cxx15
-rw-r--r--src/filter/LoadChain.hxx6
2 files changed, 14 insertions, 7 deletions
diff --git a/src/filter/LoadChain.cxx b/src/filter/LoadChain.cxx
index 74c94a0a9..e400dcebf 100644
--- a/src/filter/LoadChain.cxx
+++ b/src/filter/LoadChain.cxx
@@ -24,7 +24,7 @@
#include "plugins/ChainFilterPlugin.hxx"
#include "config/Param.hxx"
#include "config/Option.hxx"
-#include "config/Global.hxx"
+#include "config/Data.hxx"
#include "config/Domain.hxx"
#include "config/Block.hxx"
#include "util/RuntimeError.hxx"
@@ -34,10 +34,11 @@
#include <string.h>
static void
-filter_chain_append_new(PreparedFilter &chain, const char *template_name)
+filter_chain_append_new(PreparedFilter &chain, const ConfigData &config,
+ const char *template_name)
{
- const auto *cfg = config_find_block(ConfigBlockOption::AUDIO_FILTER,
- "name", template_name);
+ const auto *cfg = config.FindBlock(ConfigBlockOption::AUDIO_FILTER,
+ "name", template_name);
if (cfg == nullptr)
throw FormatRuntimeError("Filter template not found: %s",
template_name);
@@ -53,7 +54,9 @@ filter_chain_append_new(PreparedFilter &chain, const char *template_name)
}
void
-filter_chain_parse(PreparedFilter &chain, const char *spec)
+filter_chain_parse(PreparedFilter &chain,
+ const ConfigData &config,
+ const char *spec)
{
const char *const end = spec + strlen(spec);
@@ -61,7 +64,7 @@ filter_chain_parse(PreparedFilter &chain, const char *spec)
const char *comma = std::find(spec, end, ',');
if (comma > spec) {
const std::string name(spec, comma);
- filter_chain_append_new(chain, name.c_str());
+ filter_chain_append_new(chain, config, name.c_str());
}
if (comma == end)
diff --git a/src/filter/LoadChain.hxx b/src/filter/LoadChain.hxx
index 3a667bd4a..cfe4ae8b2 100644
--- a/src/filter/LoadChain.hxx
+++ b/src/filter/LoadChain.hxx
@@ -20,6 +20,7 @@
#ifndef MPD_FILTER_LOAD_CHAIN_HXX
#define MPD_FILTER_LOAD_CHAIN_HXX
+struct ConfigData;
class PreparedFilter;
/**
@@ -30,9 +31,12 @@ class PreparedFilter;
* Throws std::runtime_error on error.
*
* @param chain the chain to append filters on
+ * @param config the global configuration to load filter definitions from
* @param spec the filter chain specification
*/
void
-filter_chain_parse(PreparedFilter &chain, const char *spec);
+filter_chain_parse(PreparedFilter &chain,
+ const ConfigData &config,
+ const char *spec);
#endif