mpd/src/filter/LoadOne.cxx

25 lines
674 B
C++
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#include "LoadOne.hxx"
2013-02-01 17:47:09 +01:00
#include "FilterPlugin.hxx"
#include "Registry.hxx"
2018-01-01 18:48:34 +01:00
#include "Prepared.hxx"
#include "config/Block.hxx"
#include "lib/fmt/RuntimeError.hxx"
std::unique_ptr<PreparedFilter>
filter_configured_new(const ConfigBlock &block)
{
const char *plugin_name = block.GetBlockValue("plugin");
if (plugin_name == nullptr)
throw std::runtime_error("No filter plugin specified");
2016-11-23 17:43:50 +01:00
const auto *plugin = filter_plugin_by_name(plugin_name);
if (plugin == nullptr)
throw FmtRuntimeError("No such filter plugin: {}",
plugin_name);
2018-01-02 23:00:16 +01:00
return plugin->init(block);
}