From 551ac56a333b1c82ca21eb811b4758d6be17133b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 1 Jan 2018 18:48:34 +0100 Subject: [PATCH] Filter/Internal: split header --- Makefile.am | 3 +- src/filter/{FilterInternal.hxx => Filter.hxx} | 28 +----------- src/filter/FilterConfig.cxx | 2 +- src/filter/FilterPlugin.cxx | 2 +- src/filter/Observer.cxx | 3 +- src/filter/Prepared.hxx | 44 +++++++++++++++++++ .../plugins/AutoConvertFilterPlugin.cxx | 3 +- src/filter/plugins/ChainFilterPlugin.cxx | 3 +- src/filter/plugins/ConvertFilterPlugin.cxx | 3 +- src/filter/plugins/NormalizeFilterPlugin.cxx | 3 +- src/filter/plugins/NullFilterPlugin.cxx | 3 +- src/filter/plugins/ReplayGainFilterPlugin.cxx | 3 +- src/filter/plugins/RouteFilterPlugin.cxx | 3 +- src/filter/plugins/VolumeFilterPlugin.cxx | 3 +- src/output/Finish.cxx | 2 +- src/output/Init.cxx | 2 +- src/output/Source.cxx | 3 +- test/run_filter.cxx | 3 +- 18 files changed, 74 insertions(+), 42 deletions(-) rename src/filter/{FilterInternal.hxx => Filter.hxx} (75%) create mode 100644 src/filter/Prepared.hxx diff --git a/Makefile.am b/Makefile.am index 55c3f93fb..afb874882 100644 --- a/Makefile.am +++ b/Makefile.am @@ -105,7 +105,8 @@ libmpd_a_SOURCES = \ src/decoder/DecoderPrint.cxx src/decoder/DecoderPrint.hxx \ src/filter/FilterConfig.cxx src/filter/FilterConfig.hxx \ src/filter/FilterPlugin.cxx src/filter/FilterPlugin.hxx \ - src/filter/FilterInternal.hxx \ + src/filter/Filter.hxx \ + src/filter/Prepared.hxx \ src/filter/FilterRegistry.cxx src/filter/FilterRegistry.hxx \ src/filter/Observer.cxx src/filter/Observer.hxx \ src/client/Client.cxx src/client/Client.hxx \ diff --git a/src/filter/FilterInternal.hxx b/src/filter/Filter.hxx similarity index 75% rename from src/filter/FilterInternal.hxx rename to src/filter/Filter.hxx index 3758f1de4..54646d86c 100644 --- a/src/filter/FilterInternal.hxx +++ b/src/filter/Filter.hxx @@ -17,21 +17,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/** \file - * - * Internal stuff for the filter core and filter plugins. - */ - -#ifndef MPD_FILTER_INTERNAL_HXX -#define MPD_FILTER_INTERNAL_HXX +#ifndef MPD_FILTER_HXX +#define MPD_FILTER_HXX #include "AudioFormat.hxx" -#include - #include -struct AudioFormat; template struct ConstBuffer; class Filter { @@ -72,20 +64,4 @@ public: virtual ConstBuffer FilterPCM(ConstBuffer src) = 0; }; -class PreparedFilter { -public: - virtual ~PreparedFilter() {} - - /** - * Opens the filter, preparing it for FilterPCM(). - * - * Throws std::runtime_error on error. - * - * @param af the audio format of incoming data; the - * plugin may modify the object to enforce another input - * format - */ - virtual std::unique_ptr Open(AudioFormat &af) = 0; -}; - #endif diff --git a/src/filter/FilterConfig.cxx b/src/filter/FilterConfig.cxx index 380a65020..a328f6296 100644 --- a/src/filter/FilterConfig.cxx +++ b/src/filter/FilterConfig.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "FilterConfig.hxx" #include "FilterPlugin.hxx" -#include "FilterInternal.hxx" +#include "Prepared.hxx" #include "plugins/ChainFilterPlugin.hxx" #include "config/Param.hxx" #include "config/ConfigOption.hxx" diff --git a/src/filter/FilterPlugin.cxx b/src/filter/FilterPlugin.cxx index 5f5ad5d8c..ffd15cdc2 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 "FilterInternal.hxx" +#include "Prepared.hxx" #include "config/Block.hxx" #include "config/ConfigError.hxx" #include "util/RuntimeError.hxx" diff --git a/src/filter/Observer.cxx b/src/filter/Observer.cxx index 8ca42c5b1..d51d6329e 100644 --- a/src/filter/Observer.cxx +++ b/src/filter/Observer.cxx @@ -19,7 +19,8 @@ #include "config.h" #include "Observer.hxx" -#include "FilterInternal.hxx" +#include "Filter.hxx" +#include "Prepared.hxx" #include "util/ConstBuffer.hxx" #include diff --git a/src/filter/Prepared.hxx b/src/filter/Prepared.hxx new file mode 100644 index 000000000..253bf09a0 --- /dev/null +++ b/src/filter/Prepared.hxx @@ -0,0 +1,44 @@ +/* + * 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_PREPARED_FILTER_HXX +#define MPD_PREPARED_FILTER_HXX + +#include + +struct AudioFormat; +class Filter; + +class PreparedFilter { +public: + virtual ~PreparedFilter() {} + + /** + * Opens the filter, preparing it for FilterPCM(). + * + * Throws std::runtime_error on error. + * + * @param af the audio format of incoming data; the + * plugin may modify the object to enforce another input + * format + */ + virtual std::unique_ptr Open(AudioFormat &af) = 0; +}; + +#endif diff --git a/src/filter/plugins/AutoConvertFilterPlugin.cxx b/src/filter/plugins/AutoConvertFilterPlugin.cxx index 125e488dd..6b9b8cc13 100644 --- a/src/filter/plugins/AutoConvertFilterPlugin.cxx +++ b/src/filter/plugins/AutoConvertFilterPlugin.cxx @@ -21,7 +21,8 @@ #include "AutoConvertFilterPlugin.hxx" #include "ConvertFilterPlugin.hxx" #include "filter/FilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "filter/FilterRegistry.hxx" #include "AudioFormat.hxx" #include "util/ConstBuffer.hxx" diff --git a/src/filter/plugins/ChainFilterPlugin.cxx b/src/filter/plugins/ChainFilterPlugin.cxx index 3be60463f..e1b6d6c2b 100644 --- a/src/filter/plugins/ChainFilterPlugin.cxx +++ b/src/filter/plugins/ChainFilterPlugin.cxx @@ -19,7 +19,8 @@ #include "config.h" #include "ChainFilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "AudioFormat.hxx" #include "util/ConstBuffer.hxx" #include "util/StringBuffer.hxx" diff --git a/src/filter/plugins/ConvertFilterPlugin.cxx b/src/filter/plugins/ConvertFilterPlugin.cxx index 4e512d73d..40da165cd 100644 --- a/src/filter/plugins/ConvertFilterPlugin.cxx +++ b/src/filter/plugins/ConvertFilterPlugin.cxx @@ -19,7 +19,8 @@ #include "config.h" #include "ConvertFilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "pcm/PcmConvert.hxx" #include "util/Manual.hxx" #include "util/ConstBuffer.hxx" diff --git a/src/filter/plugins/NormalizeFilterPlugin.cxx b/src/filter/plugins/NormalizeFilterPlugin.cxx index 99b2c205f..75e952b16 100644 --- a/src/filter/plugins/NormalizeFilterPlugin.cxx +++ b/src/filter/plugins/NormalizeFilterPlugin.cxx @@ -20,7 +20,8 @@ #include "config.h" #include "NormalizeFilterPlugin.hxx" #include "filter/FilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "filter/FilterRegistry.hxx" #include "pcm/PcmBuffer.hxx" #include "AudioFormat.hxx" diff --git a/src/filter/plugins/NullFilterPlugin.cxx b/src/filter/plugins/NullFilterPlugin.cxx index 895402ae4..037be79f4 100644 --- a/src/filter/plugins/NullFilterPlugin.cxx +++ b/src/filter/plugins/NullFilterPlugin.cxx @@ -26,7 +26,8 @@ #include "config.h" #include "filter/FilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "filter/FilterRegistry.hxx" #include "AudioFormat.hxx" #include "Compiler.h" diff --git a/src/filter/plugins/ReplayGainFilterPlugin.cxx b/src/filter/plugins/ReplayGainFilterPlugin.cxx index 84e2bcde5..8cb2db0a5 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.cxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.cxx @@ -19,7 +19,8 @@ #include "config.h" #include "ReplayGainFilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "AudioFormat.hxx" #include "ReplayGainInfo.hxx" #include "ReplayGainConfig.hxx" diff --git a/src/filter/plugins/RouteFilterPlugin.cxx b/src/filter/plugins/RouteFilterPlugin.cxx index 10a4045c0..e7eebe5e8 100644 --- a/src/filter/plugins/RouteFilterPlugin.cxx +++ b/src/filter/plugins/RouteFilterPlugin.cxx @@ -44,7 +44,8 @@ #include "config/Block.hxx" #include "AudioFormat.hxx" #include "filter/FilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "filter/FilterRegistry.hxx" #include "pcm/PcmBuffer.hxx" #include "pcm/Silence.hxx" diff --git a/src/filter/plugins/VolumeFilterPlugin.cxx b/src/filter/plugins/VolumeFilterPlugin.cxx index 2d113c820..5a2f4a5bd 100644 --- a/src/filter/plugins/VolumeFilterPlugin.cxx +++ b/src/filter/plugins/VolumeFilterPlugin.cxx @@ -19,7 +19,8 @@ #include "config.h" #include "VolumeFilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "pcm/Volume.hxx" #include "AudioFormat.hxx" #include "util/ConstBuffer.hxx" diff --git a/src/output/Finish.cxx b/src/output/Finish.cxx index a3714586f..90fe9f467 100644 --- a/src/output/Finish.cxx +++ b/src/output/Finish.cxx @@ -21,7 +21,7 @@ #include "Filtered.hxx" #include "Interface.hxx" #include "mixer/MixerControl.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Prepared.hxx" FilteredAudioOutput::~FilteredAudioOutput() { diff --git a/src/output/Init.cxx b/src/output/Init.cxx index 9dbd14ef6..2fc8ee5a1 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -28,7 +28,7 @@ #include "mixer/MixerControl.hxx" #include "mixer/plugins/SoftwareMixerPlugin.hxx" #include "filter/FilterConfig.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Prepared.hxx" #include "filter/plugins/AutoConvertFilterPlugin.hxx" #include "filter/plugins/ConvertFilterPlugin.hxx" #include "filter/plugins/ReplayGainFilterPlugin.hxx" diff --git a/src/output/Source.cxx b/src/output/Source.cxx index 3df937c07..23ba7a640 100644 --- a/src/output/Source.cxx +++ b/src/output/Source.cxx @@ -20,7 +20,8 @@ #include "config.h" #include "Source.hxx" #include "MusicChunk.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "filter/plugins/ReplayGainFilterPlugin.hxx" #include "pcm/PcmMix.hxx" #include "thread/Mutex.hxx" diff --git a/test/run_filter.cxx b/test/run_filter.cxx index 3da70a07c..2782ad7a1 100644 --- a/test/run_filter.cxx +++ b/test/run_filter.cxx @@ -24,7 +24,8 @@ #include "AudioParser.hxx" #include "AudioFormat.hxx" #include "filter/FilterPlugin.hxx" -#include "filter/FilterInternal.hxx" +#include "filter/Filter.hxx" +#include "filter/Prepared.hxx" #include "pcm/Volume.hxx" #include "mixer/MixerControl.hxx" #include "util/ConstBuffer.hxx"