filter/Plugin: return std::unique_ptr<PreparedFilter>

This commit is contained in:
Max Kellermann
2017-12-27 09:17:15 +01:00
parent 0e3ff12dd3
commit e2621d5e44
24 changed files with 87 additions and 74 deletions

View File

@@ -93,7 +93,7 @@ public:
* The filter object of this audio output. This is an
* instance of chain_filter_plugin.
*/
PreparedFilter *prepared_filter = nullptr;
std::unique_ptr<PreparedFilter> prepared_filter;
/**
* The #VolumeFilter instance of this audio output. It is
@@ -105,14 +105,14 @@ public:
* The replay_gain_filter_plugin instance of this audio
* output.
*/
PreparedFilter *prepared_replay_gain_filter = nullptr;
std::unique_ptr<PreparedFilter> prepared_replay_gain_filter;
/**
* The replay_gain_filter_plugin instance of this audio
* output, to be applied to the second chunk during
* cross-fading.
*/
PreparedFilter *prepared_other_replay_gain_filter = nullptr;
std::unique_ptr<PreparedFilter> prepared_other_replay_gain_filter;
/**
* The convert_filter_plugin instance of this audio output.

View File

@@ -27,10 +27,6 @@ FilteredAudioOutput::~FilteredAudioOutput()
{
if (mixer != nullptr)
mixer_free(mixer);
delete prepared_replay_gain_filter;
delete prepared_other_replay_gain_filter;
delete prepared_filter;
}
void

View File

@@ -22,12 +22,13 @@
#include "Registry.hxx"
#include "Domain.hxx"
#include "OutputAPI.hxx"
#include "filter/FilterConfig.hxx"
#include "AudioParser.hxx"
#include "mixer/MixerList.hxx"
#include "mixer/MixerType.hxx"
#include "mixer/MixerControl.hxx"
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
#include "filter/FilterConfig.hxx"
#include "filter/FilterInternal.hxx"
#include "filter/plugins/AutoConvertFilterPlugin.hxx"
#include "filter/plugins/ConvertFilterPlugin.hxx"
#include "filter/plugins/ReplayGainFilterPlugin.hxx"

View File

@@ -146,8 +146,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
try {
try {
f = source.Open(in_audio_format, pipe,
output->prepared_replay_gain_filter,
output->prepared_other_replay_gain_filter,
output->prepared_replay_gain_filter.get(),
output->prepared_other_replay_gain_filter.get(),
*output->prepared_filter);
} catch (...) {
std::throw_with_nested(FormatRuntimeError("Failed to open filter for %s",