filter/Plugin: return std::unique_ptr<PreparedFilter>
This commit is contained in:
parent
0e3ff12dd3
commit
e2621d5e44
@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "FilterConfig.hxx"
|
#include "FilterConfig.hxx"
|
||||||
#include "plugins/ChainFilterPlugin.hxx"
|
|
||||||
#include "FilterPlugin.hxx"
|
#include "FilterPlugin.hxx"
|
||||||
|
#include "FilterInternal.hxx"
|
||||||
|
#include "plugins/ChainFilterPlugin.hxx"
|
||||||
#include "config/Param.hxx"
|
#include "config/Param.hxx"
|
||||||
#include "config/ConfigOption.hxx"
|
#include "config/ConfigOption.hxx"
|
||||||
#include "config/ConfigGlobal.hxx"
|
#include "config/ConfigGlobal.hxx"
|
||||||
@ -42,11 +43,11 @@ filter_chain_append_new(PreparedFilter &chain, const char *template_name)
|
|||||||
template_name);
|
template_name);
|
||||||
|
|
||||||
// Instantiate one of those filter plugins with the template name as a hint
|
// Instantiate one of those filter plugins with the template name as a hint
|
||||||
PreparedFilter *f = filter_configured_new(*cfg);
|
auto f = filter_configured_new(*cfg);
|
||||||
|
|
||||||
const char *plugin_name = cfg->GetBlockValue("plugin",
|
const char *plugin_name = cfg->GetBlockValue("plugin",
|
||||||
"unknown");
|
"unknown");
|
||||||
filter_chain_append(chain, plugin_name, f);
|
filter_chain_append(chain, plugin_name, std::move(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -20,13 +20,14 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "FilterPlugin.hxx"
|
#include "FilterPlugin.hxx"
|
||||||
#include "FilterRegistry.hxx"
|
#include "FilterRegistry.hxx"
|
||||||
|
#include "FilterInternal.hxx"
|
||||||
#include "config/Block.hxx"
|
#include "config/Block.hxx"
|
||||||
#include "config/ConfigError.hxx"
|
#include "config/ConfigError.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
filter_new(const FilterPlugin *plugin, const ConfigBlock &block)
|
filter_new(const FilterPlugin *plugin, const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
assert(plugin != nullptr);
|
assert(plugin != nullptr);
|
||||||
@ -34,7 +35,7 @@ filter_new(const FilterPlugin *plugin, const ConfigBlock &block)
|
|||||||
return plugin->init(block);
|
return plugin->init(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
filter_configured_new(const ConfigBlock &block)
|
filter_configured_new(const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
const char *plugin_name = block.GetBlockValue("plugin");
|
const char *plugin_name = block.GetBlockValue("plugin");
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#ifndef MPD_FILTER_PLUGIN_HXX
|
#ifndef MPD_FILTER_PLUGIN_HXX
|
||||||
#define MPD_FILTER_PLUGIN_HXX
|
#define MPD_FILTER_PLUGIN_HXX
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
struct ConfigBlock;
|
struct ConfigBlock;
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ struct FilterPlugin {
|
|||||||
/**
|
/**
|
||||||
* Allocates and configures a filter.
|
* Allocates and configures a filter.
|
||||||
*/
|
*/
|
||||||
PreparedFilter *(*init)(const ConfigBlock &block);
|
std::unique_ptr<PreparedFilter> (*init)(const ConfigBlock &block);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,7 +48,7 @@ struct FilterPlugin {
|
|||||||
* @param plugin the filter plugin
|
* @param plugin the filter plugin
|
||||||
* @param block configuration section
|
* @param block configuration section
|
||||||
*/
|
*/
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
filter_new(const FilterPlugin *plugin,
|
filter_new(const FilterPlugin *plugin,
|
||||||
const ConfigBlock &block);
|
const ConfigBlock &block);
|
||||||
|
|
||||||
@ -58,7 +60,7 @@ filter_new(const FilterPlugin *plugin,
|
|||||||
*
|
*
|
||||||
* @param block the configuration section
|
* @param block the configuration section
|
||||||
*/
|
*/
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
filter_configured_new(const ConfigBlock &block);
|
filter_configured_new(const ConfigBlock &block);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,21 +27,20 @@
|
|||||||
class FilterObserver::PreparedProxy final : public PreparedFilter {
|
class FilterObserver::PreparedProxy final : public PreparedFilter {
|
||||||
FilterObserver &observer;
|
FilterObserver &observer;
|
||||||
|
|
||||||
PreparedFilter *const prepared_filter;
|
std::unique_ptr<PreparedFilter> prepared_filter;
|
||||||
Proxy *child = nullptr;
|
Proxy *child = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PreparedProxy(FilterObserver &_observer,
|
PreparedProxy(FilterObserver &_observer,
|
||||||
PreparedFilter *_prepared_filter)
|
std::unique_ptr<PreparedFilter> _prepared_filter)
|
||||||
:observer(_observer),
|
:observer(_observer),
|
||||||
prepared_filter(_prepared_filter) {}
|
prepared_filter(std::move(_prepared_filter)) {}
|
||||||
|
|
||||||
~PreparedProxy() {
|
~PreparedProxy() {
|
||||||
assert(child == nullptr);
|
assert(child == nullptr);
|
||||||
assert(observer.proxy == this);
|
assert(observer.proxy == this);
|
||||||
|
|
||||||
observer.proxy = nullptr;
|
observer.proxy = nullptr;
|
||||||
delete prepared_filter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear(gcc_unused Proxy *_child) {
|
void Clear(gcc_unused Proxy *_child) {
|
||||||
@ -95,12 +94,14 @@ FilterObserver::PreparedProxy::Open(AudioFormat &af)
|
|||||||
return child = new Proxy(*this, f);
|
return child = new Proxy(*this, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
FilterObserver::Set(PreparedFilter *pf)
|
FilterObserver::Set(std::unique_ptr<PreparedFilter> pf)
|
||||||
{
|
{
|
||||||
assert(proxy == nullptr);
|
assert(proxy == nullptr);
|
||||||
|
|
||||||
return proxy = new PreparedProxy(*this, pf);
|
auto p = std::make_unique<PreparedProxy>(*this, std::move(pf));
|
||||||
|
proxy = p.get();
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter *
|
Filter *
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class Filter;
|
class Filter;
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @return a proxy object
|
* @return a proxy object
|
||||||
*/
|
*/
|
||||||
PreparedFilter *Set(PreparedFilter *pf);
|
std::unique_ptr<PreparedFilter> Set(std::unique_ptr<PreparedFilter> pf);
|
||||||
|
|
||||||
Filter *Get();
|
Filter *Get();
|
||||||
};
|
};
|
||||||
|
@ -62,13 +62,11 @@ class PreparedAutoConvertFilter final : public PreparedFilter {
|
|||||||
/**
|
/**
|
||||||
* The underlying filter.
|
* The underlying filter.
|
||||||
*/
|
*/
|
||||||
PreparedFilter *const filter;
|
std::unique_ptr<PreparedFilter> filter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PreparedAutoConvertFilter(PreparedFilter *_filter):filter(_filter) {}
|
PreparedAutoConvertFilter(std::unique_ptr<PreparedFilter> _filter) noexcept
|
||||||
~PreparedAutoConvertFilter() {
|
:filter(std::move(_filter)) {}
|
||||||
delete filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
Filter *Open(AudioFormat &af) override;
|
Filter *Open(AudioFormat &af) override;
|
||||||
};
|
};
|
||||||
@ -106,8 +104,8 @@ AutoConvertFilter::FilterPCM(ConstBuffer<void> src)
|
|||||||
return filter->FilterPCM(src);
|
return filter->FilterPCM(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
autoconvert_filter_new(PreparedFilter *filter)
|
autoconvert_filter_new(std::unique_ptr<PreparedFilter> filter) noexcept
|
||||||
{
|
{
|
||||||
return new PreparedAutoConvertFilter(filter);
|
return std::make_unique<PreparedAutoConvertFilter>(std::move(filter));
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
|
#ifndef MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
|
||||||
#define MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
|
#define MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +30,7 @@ class PreparedFilter;
|
|||||||
* requests a different format, it automatically creates a
|
* requests a different format, it automatically creates a
|
||||||
* convert_filter.
|
* convert_filter.
|
||||||
*/
|
*/
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
autoconvert_filter_new(PreparedFilter *filter);
|
autoconvert_filter_new(std::unique_ptr<PreparedFilter> filter) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,13 +67,11 @@ public:
|
|||||||
class PreparedChainFilter final : public PreparedFilter {
|
class PreparedChainFilter final : public PreparedFilter {
|
||||||
struct Child {
|
struct Child {
|
||||||
const char *name;
|
const char *name;
|
||||||
PreparedFilter *filter;
|
std::unique_ptr<PreparedFilter> filter;
|
||||||
|
|
||||||
Child(const char *_name, PreparedFilter *_filter)
|
Child(const char *_name,
|
||||||
:name(_name), filter(_filter) {}
|
std::unique_ptr<PreparedFilter> _filter)
|
||||||
~Child() {
|
:name(_name), filter(std::move(_filter)) {}
|
||||||
delete filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
Child(const Child &) = delete;
|
Child(const Child &) = delete;
|
||||||
Child &operator=(const Child &) = delete;
|
Child &operator=(const Child &) = delete;
|
||||||
@ -84,8 +82,9 @@ class PreparedChainFilter final : public PreparedFilter {
|
|||||||
std::list<Child> children;
|
std::list<Child> children;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Append(const char *name, PreparedFilter *filter) {
|
void Append(const char *name,
|
||||||
children.emplace_back(name, filter);
|
std::unique_ptr<PreparedFilter> filter) noexcept {
|
||||||
|
children.emplace_back(name, std::move(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual methods from class PreparedFilter */
|
/* virtual methods from class PreparedFilter */
|
||||||
@ -143,17 +142,17 @@ ChainFilter::FilterPCM(ConstBuffer<void> src)
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
filter_chain_new(void)
|
filter_chain_new() noexcept
|
||||||
{
|
{
|
||||||
return new PreparedChainFilter();
|
return std::make_unique<PreparedChainFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
filter_chain_append(PreparedFilter &_chain, const char *name,
|
filter_chain_append(PreparedFilter &_chain, const char *name,
|
||||||
PreparedFilter *filter)
|
std::unique_ptr<PreparedFilter> filter) noexcept
|
||||||
{
|
{
|
||||||
PreparedChainFilter &chain = (PreparedChainFilter &)_chain;
|
PreparedChainFilter &chain = (PreparedChainFilter &)_chain;
|
||||||
|
|
||||||
chain.Append(name, filter);
|
chain.Append(name, std::move(filter));
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,15 @@
|
|||||||
#ifndef MPD_FILTER_CHAIN_HXX
|
#ifndef MPD_FILTER_CHAIN_HXX
|
||||||
#define MPD_FILTER_CHAIN_HXX
|
#define MPD_FILTER_CHAIN_HXX
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new filter chain.
|
* Creates a new filter chain.
|
||||||
*/
|
*/
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
filter_chain_new();
|
filter_chain_new() noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a new filter at the end of the filter chain. You must call
|
* Appends a new filter at the end of the filter chain. You must call
|
||||||
@ -44,6 +46,6 @@ filter_chain_new();
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
filter_chain_append(PreparedFilter &chain, const char *name,
|
filter_chain_append(PreparedFilter &chain, const char *name,
|
||||||
PreparedFilter *filter);
|
std::unique_ptr<PreparedFilter> filter) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,10 +119,10 @@ ConvertFilter::FilterPCM(ConstBuffer<void> src)
|
|||||||
return state.Convert(src);
|
return state.Convert(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
convert_filter_prepare() noexcept
|
convert_filter_prepare() noexcept
|
||||||
{
|
{
|
||||||
return new PreparedConvertFilter();
|
return std::make_unique<PreparedConvertFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter *
|
Filter *
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
#ifndef MPD_CONVERT_FILTER_PLUGIN_HXX
|
#ifndef MPD_CONVERT_FILTER_PLUGIN_HXX
|
||||||
#define MPD_CONVERT_FILTER_PLUGIN_HXX
|
#define MPD_CONVERT_FILTER_PLUGIN_HXX
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class Filter;
|
class Filter;
|
||||||
struct AudioFormat;
|
struct AudioFormat;
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
convert_filter_prepare() noexcept;
|
convert_filter_prepare() noexcept;
|
||||||
|
|
||||||
Filter *
|
Filter *
|
||||||
|
@ -53,10 +53,10 @@ public:
|
|||||||
Filter *Open(AudioFormat &af) override;
|
Filter *Open(AudioFormat &af) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
static PreparedFilter *
|
static std::unique_ptr<PreparedFilter>
|
||||||
normalize_filter_init(gcc_unused const ConfigBlock &block)
|
normalize_filter_init(gcc_unused const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
return new PreparedNormalizeFilter();
|
return std::make_unique<PreparedNormalizeFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter *
|
Filter *
|
||||||
@ -82,8 +82,8 @@ const FilterPlugin normalize_filter_plugin = {
|
|||||||
normalize_filter_init,
|
normalize_filter_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
normalize_filter_prepare() noexcept
|
normalize_filter_prepare() noexcept
|
||||||
{
|
{
|
||||||
return new PreparedNormalizeFilter();
|
return std::make_unique<PreparedNormalizeFilter>();
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
#ifndef MPD_NORMALIZE_FILTER_PLUGIN_HXX
|
#ifndef MPD_NORMALIZE_FILTER_PLUGIN_HXX
|
||||||
#define MPD_NORMALIZE_FILTER_PLUGIN_HXX
|
#define MPD_NORMALIZE_FILTER_PLUGIN_HXX
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class Filter;
|
class Filter;
|
||||||
struct AudioFormat;
|
struct AudioFormat;
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
normalize_filter_prepare() noexcept;
|
normalize_filter_prepare() noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,10 +48,10 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static PreparedFilter *
|
static std::unique_ptr<PreparedFilter>
|
||||||
null_filter_init(gcc_unused const ConfigBlock &block)
|
null_filter_init(gcc_unused const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
return new PreparedNullFilter();
|
return std::make_unique<PreparedNullFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilterPlugin null_filter_plugin = {
|
const FilterPlugin null_filter_plugin = {
|
||||||
|
@ -171,10 +171,10 @@ ReplayGainFilter::Update()
|
|||||||
pv.SetVolume(volume);
|
pv.SetVolume(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
NewReplayGainFilter(const ReplayGainConfig &config)
|
NewReplayGainFilter(const ReplayGainConfig &config) noexcept
|
||||||
{
|
{
|
||||||
return new PreparedReplayGainFilter(config);
|
return std::make_unique<PreparedReplayGainFilter>(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter *
|
Filter *
|
||||||
|
@ -22,14 +22,16 @@
|
|||||||
|
|
||||||
#include "ReplayGainMode.hxx"
|
#include "ReplayGainMode.hxx"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class Filter;
|
class Filter;
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class Mixer;
|
class Mixer;
|
||||||
struct ReplayGainConfig;
|
struct ReplayGainConfig;
|
||||||
struct ReplayGainInfo;
|
struct ReplayGainInfo;
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
NewReplayGainFilter(const ReplayGainConfig &config);
|
NewReplayGainFilter(const ReplayGainConfig &config) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables or disables the hardware mixer for applying replay gain.
|
* Enables or disables the hardware mixer for applying replay gain.
|
||||||
|
@ -196,10 +196,10 @@ PreparedRouteFilter::PreparedRouteFilter(const ConfigBlock &block)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PreparedFilter *
|
static std::unique_ptr<PreparedFilter>
|
||||||
route_filter_init(const ConfigBlock &block)
|
route_filter_init(const ConfigBlock &block)
|
||||||
{
|
{
|
||||||
return new PreparedRouteFilter(block);
|
return std::make_unique<PreparedRouteFilter>(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteFilter::RouteFilter(const AudioFormat &audio_format,
|
RouteFilter::RouteFilter(const AudioFormat &audio_format,
|
||||||
|
@ -65,10 +65,10 @@ VolumeFilter::FilterPCM(ConstBuffer<void> src)
|
|||||||
return pv.Apply(src);
|
return pv.Apply(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
volume_filter_prepare() noexcept
|
volume_filter_prepare() noexcept
|
||||||
{
|
{
|
||||||
return new PreparedVolumeFilter();
|
return std::make_unique<PreparedVolumeFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
|
@ -20,10 +20,12 @@
|
|||||||
#ifndef MPD_VOLUME_FILTER_PLUGIN_HXX
|
#ifndef MPD_VOLUME_FILTER_PLUGIN_HXX
|
||||||
#define MPD_VOLUME_FILTER_PLUGIN_HXX
|
#define MPD_VOLUME_FILTER_PLUGIN_HXX
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class Filter;
|
class Filter;
|
||||||
|
|
||||||
PreparedFilter *
|
std::unique_ptr<PreparedFilter>
|
||||||
volume_filter_prepare() noexcept;
|
volume_filter_prepare() noexcept;
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
* The filter object of this audio output. This is an
|
* The filter object of this audio output. This is an
|
||||||
* instance of chain_filter_plugin.
|
* instance of chain_filter_plugin.
|
||||||
*/
|
*/
|
||||||
PreparedFilter *prepared_filter = nullptr;
|
std::unique_ptr<PreparedFilter> prepared_filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The #VolumeFilter instance of this audio output. It is
|
* The #VolumeFilter instance of this audio output. It is
|
||||||
@ -105,14 +105,14 @@ public:
|
|||||||
* The replay_gain_filter_plugin instance of this audio
|
* The replay_gain_filter_plugin instance of this audio
|
||||||
* output.
|
* output.
|
||||||
*/
|
*/
|
||||||
PreparedFilter *prepared_replay_gain_filter = nullptr;
|
std::unique_ptr<PreparedFilter> prepared_replay_gain_filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The replay_gain_filter_plugin instance of this audio
|
* The replay_gain_filter_plugin instance of this audio
|
||||||
* output, to be applied to the second chunk during
|
* output, to be applied to the second chunk during
|
||||||
* cross-fading.
|
* 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.
|
* The convert_filter_plugin instance of this audio output.
|
||||||
|
@ -27,10 +27,6 @@ FilteredAudioOutput::~FilteredAudioOutput()
|
|||||||
{
|
{
|
||||||
if (mixer != nullptr)
|
if (mixer != nullptr)
|
||||||
mixer_free(mixer);
|
mixer_free(mixer);
|
||||||
|
|
||||||
delete prepared_replay_gain_filter;
|
|
||||||
delete prepared_other_replay_gain_filter;
|
|
||||||
delete prepared_filter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
#include "Registry.hxx"
|
#include "Registry.hxx"
|
||||||
#include "Domain.hxx"
|
#include "Domain.hxx"
|
||||||
#include "OutputAPI.hxx"
|
#include "OutputAPI.hxx"
|
||||||
#include "filter/FilterConfig.hxx"
|
|
||||||
#include "AudioParser.hxx"
|
#include "AudioParser.hxx"
|
||||||
#include "mixer/MixerList.hxx"
|
#include "mixer/MixerList.hxx"
|
||||||
#include "mixer/MixerType.hxx"
|
#include "mixer/MixerType.hxx"
|
||||||
#include "mixer/MixerControl.hxx"
|
#include "mixer/MixerControl.hxx"
|
||||||
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
|
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
|
||||||
|
#include "filter/FilterConfig.hxx"
|
||||||
|
#include "filter/FilterInternal.hxx"
|
||||||
#include "filter/plugins/AutoConvertFilterPlugin.hxx"
|
#include "filter/plugins/AutoConvertFilterPlugin.hxx"
|
||||||
#include "filter/plugins/ConvertFilterPlugin.hxx"
|
#include "filter/plugins/ConvertFilterPlugin.hxx"
|
||||||
#include "filter/plugins/ReplayGainFilterPlugin.hxx"
|
#include "filter/plugins/ReplayGainFilterPlugin.hxx"
|
||||||
|
@ -146,8 +146,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
|
|||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
f = source.Open(in_audio_format, pipe,
|
f = source.Open(in_audio_format, pipe,
|
||||||
output->prepared_replay_gain_filter,
|
output->prepared_replay_gain_filter.get(),
|
||||||
output->prepared_other_replay_gain_filter,
|
output->prepared_other_replay_gain_filter.get(),
|
||||||
*output->prepared_filter);
|
*output->prepared_filter);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::throw_with_nested(FormatRuntimeError("Failed to open filter for %s",
|
std::throw_with_nested(FormatRuntimeError("Failed to open filter for %s",
|
||||||
|
@ -48,7 +48,7 @@ mixer_set_volume(gcc_unused Mixer *mixer,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static PreparedFilter *
|
static std::unique_ptr<PreparedFilter>
|
||||||
load_filter(const char *name)
|
load_filter(const char *name)
|
||||||
{
|
{
|
||||||
const auto *param = config_find_block(ConfigBlockOption::AUDIO_FILTER,
|
const auto *param = config_find_block(ConfigBlockOption::AUDIO_FILTER,
|
||||||
@ -86,7 +86,7 @@ try {
|
|||||||
|
|
||||||
/* initialize the filter */
|
/* initialize the filter */
|
||||||
|
|
||||||
std::unique_ptr<PreparedFilter> prepared_filter(load_filter(argv[2]));
|
auto prepared_filter = load_filter(argv[2]);
|
||||||
if (!prepared_filter)
|
if (!prepared_filter)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user