From bbabb7a14c8e2abce220d0bfed899639b72174b4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 2 Jan 2018 23:06:53 +0100 Subject: [PATCH] filter/Plugin: move filter_configured_new() to LoadOne.cxx --- Makefile.am | 7 ++-- src/filter/FilterConfig.cxx | 2 +- src/filter/FilterPlugin.hxx | 11 ------ src/filter/{FilterPlugin.cxx => LoadOne.cxx} | 4 +- src/filter/LoadOne.hxx | 39 ++++++++++++++++++++ test/run_filter.cxx | 2 +- 6 files changed, 46 insertions(+), 19 deletions(-) rename src/filter/{FilterPlugin.cxx => LoadOne.cxx} (96%) create mode 100644 src/filter/LoadOne.hxx diff --git a/Makefile.am b/Makefile.am index e0ace0c79..bb6a3f642 100644 --- a/Makefile.am +++ b/Makefile.am @@ -103,8 +103,9 @@ libmpd_a_SOURCES = \ src/decoder/DecoderPlugin.hxx \ src/decoder/Bridge.cxx src/decoder/Bridge.hxx \ src/decoder/DecoderPrint.cxx src/decoder/DecoderPrint.hxx \ + src/filter/LoadOne.cxx src/filter/LoadOne.hxx \ src/filter/FilterConfig.cxx src/filter/FilterConfig.hxx \ - src/filter/FilterPlugin.cxx src/filter/FilterPlugin.hxx \ + src/filter/FilterPlugin.hxx \ src/filter/Filter.hxx \ src/filter/Prepared.hxx \ src/filter/FilterRegistry.cxx src/filter/FilterRegistry.hxx \ @@ -2055,7 +2056,7 @@ test_run_filter_LDADD = \ libutil.a test_run_filter_SOURCES = test/run_filter.cxx \ src/Log.cxx src/LogBackend.cxx \ - src/filter/FilterPlugin.cxx src/filter/FilterRegistry.cxx + src/filter/LoadOne.cxx src/filter/FilterRegistry.cxx if ENABLE_ENCODER noinst_PROGRAMS += test/run_encoder @@ -2168,7 +2169,7 @@ test_read_mixer_LDADD = \ test_read_mixer_SOURCES = test/read_mixer.cxx \ src/Log.cxx src/LogBackend.cxx \ src/mixer/MixerControl.cxx \ - src/filter/FilterPlugin.cxx \ + src/filter/LoadOne.cxx \ src/filter/plugins/VolumeFilterPlugin.cxx if ENABLE_BZIP2_TEST diff --git a/src/filter/FilterConfig.cxx b/src/filter/FilterConfig.cxx index a328f6296..e15d59c27 100644 --- a/src/filter/FilterConfig.cxx +++ b/src/filter/FilterConfig.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "FilterConfig.hxx" -#include "FilterPlugin.hxx" +#include "LoadOne.hxx" #include "Prepared.hxx" #include "plugins/ChainFilterPlugin.hxx" #include "config/Param.hxx" diff --git a/src/filter/FilterPlugin.hxx b/src/filter/FilterPlugin.hxx index 5804ef0c1..d6d8e627a 100644 --- a/src/filter/FilterPlugin.hxx +++ b/src/filter/FilterPlugin.hxx @@ -40,15 +40,4 @@ struct FilterPlugin { std::unique_ptr (*init)(const ConfigBlock &block); }; -/** - * Creates a new filter, loads configuration and the plugin name from - * the specified configuration section. - * - * Throws std::runtime_error on error. - * - * @param block the configuration section - */ -std::unique_ptr -filter_configured_new(const ConfigBlock &block); - #endif diff --git a/src/filter/FilterPlugin.cxx b/src/filter/LoadOne.cxx similarity index 96% rename from src/filter/FilterPlugin.cxx rename to src/filter/LoadOne.cxx index dcdf80252..43f751f64 100644 --- a/src/filter/FilterPlugin.cxx +++ b/src/filter/LoadOne.cxx @@ -18,15 +18,13 @@ */ #include "config.h" +#include "LoadOne.hxx" #include "FilterPlugin.hxx" #include "FilterRegistry.hxx" #include "Prepared.hxx" #include "config/Block.hxx" -#include "config/ConfigError.hxx" #include "util/RuntimeError.hxx" -#include - std::unique_ptr filter_configured_new(const ConfigBlock &block) { diff --git a/src/filter/LoadOne.hxx b/src/filter/LoadOne.hxx new file mode 100644 index 000000000..8baf51bc3 --- /dev/null +++ b/src/filter/LoadOne.hxx @@ -0,0 +1,39 @@ +/* + * Copyright 2003-2017 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_FILTER_LOAD_ONE_HXX +#define MPD_FILTER_LOAD_ONE_HXX + +#include + +struct ConfigBlock; +class PreparedFilter; + +/** + * Creates a new filter, loads configuration and the plugin name from + * the specified configuration section. + * + * Throws std::runtime_error on error. + * + * @param block the configuration section + */ +std::unique_ptr +filter_configured_new(const ConfigBlock &block); + +#endif diff --git a/test/run_filter.cxx b/test/run_filter.cxx index 9bd726565..a4440854a 100644 --- a/test/run_filter.cxx +++ b/test/run_filter.cxx @@ -23,7 +23,7 @@ #include "fs/Path.hxx" #include "AudioParser.hxx" #include "AudioFormat.hxx" -#include "filter/FilterPlugin.hxx" +#include "filter/LoadOne.hxx" #include "filter/Filter.hxx" #include "filter/Prepared.hxx" #include "pcm/Volume.hxx"