From 3b867462a3c889792ea5ffeab2f150dab14ed992 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Dec 2016 12:34:23 +0100 Subject: [PATCH] filter/ReplayGain: remove FilterPlugin instance, add explicit constructor --- src/filter/FilterRegistry.cxx | 1 - src/filter/FilterRegistry.hxx | 1 - src/filter/plugins/ReplayGainFilterPlugin.cxx | 11 ++--------- src/filter/plugins/ReplayGainFilterPlugin.hxx | 3 +++ src/output/Init.cxx | 6 ++---- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/filter/FilterRegistry.cxx b/src/filter/FilterRegistry.cxx index 580c26b8a..adbaeafcc 100644 --- a/src/filter/FilterRegistry.cxx +++ b/src/filter/FilterRegistry.cxx @@ -28,7 +28,6 @@ static const FilterPlugin *const filter_plugins[] = { &route_filter_plugin, &normalize_filter_plugin, &volume_filter_plugin, - &replay_gain_filter_plugin, nullptr, }; diff --git a/src/filter/FilterRegistry.hxx b/src/filter/FilterRegistry.hxx index c18bcfc67..8b49c5bf4 100644 --- a/src/filter/FilterRegistry.hxx +++ b/src/filter/FilterRegistry.hxx @@ -36,7 +36,6 @@ extern const FilterPlugin convert_filter_plugin; extern const FilterPlugin route_filter_plugin; extern const FilterPlugin normalize_filter_plugin; extern const FilterPlugin volume_filter_plugin; -extern const FilterPlugin replay_gain_filter_plugin; gcc_pure const FilterPlugin * diff --git a/src/filter/plugins/ReplayGainFilterPlugin.cxx b/src/filter/plugins/ReplayGainFilterPlugin.cxx index 1e5116548..2adc01bdc 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.cxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.cxx @@ -19,9 +19,7 @@ #include "config.h" #include "ReplayGainFilterPlugin.hxx" -#include "filter/FilterPlugin.hxx" #include "filter/FilterInternal.hxx" -#include "filter/FilterRegistry.hxx" #include "AudioFormat.hxx" #include "ReplayGainInfo.hxx" #include "ReplayGainGlobal.hxx" @@ -163,8 +161,8 @@ ReplayGainFilter::Update() pv.SetVolume(volume); } -static PreparedFilter * -replay_gain_filter_init(gcc_unused const ConfigBlock &block) +PreparedFilter * +NewReplayGainFilter() { return new PreparedReplayGainFilter(); } @@ -183,11 +181,6 @@ ReplayGainFilter::FilterPCM(ConstBuffer src) : pv.Apply(src); } -const FilterPlugin replay_gain_filter_plugin = { - "replay_gain", - replay_gain_filter_init, -}; - void replay_gain_filter_set_mixer(PreparedFilter &_filter, Mixer *mixer, unsigned base) diff --git a/src/filter/plugins/ReplayGainFilterPlugin.hxx b/src/filter/plugins/ReplayGainFilterPlugin.hxx index b7c360727..e06c4232b 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.hxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.hxx @@ -27,6 +27,9 @@ class PreparedFilter; class Mixer; struct ReplayGainInfo; +PreparedFilter * +NewReplayGainFilter(); + /** * Enables or disables the hardware mixer for applying replay gain. * diff --git a/src/output/Init.cxx b/src/output/Init.cxx index 5d912ba37..9edefa958 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -216,14 +216,12 @@ audio_output_setup(EventLoop &event_loop, AudioOutput &ao, block.GetBlockValue("replay_gain_handler", "software"); if (strcmp(replay_gain_handler, "none") != 0) { - ao.prepared_replay_gain_filter = filter_new(&replay_gain_filter_plugin, - block); + ao.prepared_replay_gain_filter = NewReplayGainFilter(); assert(ao.prepared_replay_gain_filter != nullptr); ao.replay_gain_serial = 0; - ao.prepared_other_replay_gain_filter = filter_new(&replay_gain_filter_plugin, - block); + ao.prepared_other_replay_gain_filter = NewReplayGainFilter(); assert(ao.prepared_other_replay_gain_filter != nullptr); ao.other_replay_gain_serial = 0;