filter/Convert: add convert_filter_prepare()

This commit is contained in:
Max Kellermann 2017-08-07 18:27:00 +02:00
parent 9250819b75
commit a3d71f4b91
3 changed files with 12 additions and 4 deletions

View File

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

View File

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

View File

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