diff --git a/src/filter/plugins/ConvertFilterPlugin.cxx b/src/filter/plugins/ConvertFilterPlugin.cxx index 1ede2c03e..260e826f6 100644 --- a/src/filter/plugins/ConvertFilterPlugin.cxx +++ b/src/filter/plugins/ConvertFilterPlugin.cxx @@ -132,6 +132,12 @@ const FilterPlugin convert_filter_plugin = { convert_filter_init, }; +PreparedFilter * +convert_filter_prepare() noexcept +{ + return new PreparedConvertFilter(); +} + Filter * convert_filter_new(const AudioFormat in_audio_format, const AudioFormat out_audio_format) diff --git a/src/filter/plugins/ConvertFilterPlugin.hxx b/src/filter/plugins/ConvertFilterPlugin.hxx index bd6069330..469271c93 100644 --- a/src/filter/plugins/ConvertFilterPlugin.hxx +++ b/src/filter/plugins/ConvertFilterPlugin.hxx @@ -20,9 +20,13 @@ #ifndef MPD_CONVERT_FILTER_PLUGIN_HXX #define MPD_CONVERT_FILTER_PLUGIN_HXX +class PreparedFilter; class Filter; struct AudioFormat; +PreparedFilter * +convert_filter_prepare() noexcept; + Filter * convert_filter_new(AudioFormat in_audio_format, AudioFormat out_audio_format); diff --git a/src/output/Init.cxx b/src/output/Init.cxx index 2b4b026b2..bde49be9f 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -31,6 +31,7 @@ #include "filter/FilterPlugin.hxx" #include "filter/FilterRegistry.hxx" #include "filter/plugins/AutoConvertFilterPlugin.hxx" +#include "filter/plugins/ConvertFilterPlugin.hxx" #include "filter/plugins/ReplayGainFilterPlugin.hxx" #include "filter/plugins/ChainFilterPlugin.hxx" #include "filter/plugins/VolumeFilterPlugin.hxx" @@ -249,11 +250,8 @@ AudioOutput::Setup(EventLoop &event_loop, /* the "convert" filter must be the last one in the chain */ - auto *f = filter_new(&convert_filter_plugin, ConfigBlock()); - assert(f != nullptr); - filter_chain_append(*prepared_filter, "convert", - convert_filter.Set(f)); + convert_filter.Set(convert_filter_prepare())); } AudioOutput *