filter/ReplayGain: remove FilterPlugin instance, add explicit constructor

This commit is contained in:
Max Kellermann 2016-12-03 12:34:23 +01:00
parent b8aa9348b9
commit 3b867462a3
5 changed files with 7 additions and 15 deletions

View File

@ -28,7 +28,6 @@ static const FilterPlugin *const filter_plugins[] = {
&route_filter_plugin,
&normalize_filter_plugin,
&volume_filter_plugin,
&replay_gain_filter_plugin,
nullptr,
};

View File

@ -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 *

View File

@ -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<void> 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)

View File

@ -27,6 +27,9 @@ class PreparedFilter;
class Mixer;
struct ReplayGainInfo;
PreparedFilter *
NewReplayGainFilter();
/**
* Enables or disables the hardware mixer for applying replay gain.
*

View File

@ -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;