From aef0507abb7341c14f79fe47a95910370d62c87f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 24 Mar 2019 22:34:11 +0100 Subject: [PATCH 1/2] filter/Filter: fix typo in API doc --- src/filter/Filter.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filter/Filter.hxx b/src/filter/Filter.hxx index 6864cec1a..ba68c9266 100644 --- a/src/filter/Filter.hxx +++ b/src/filter/Filter.hxx @@ -65,7 +65,7 @@ public: /** * Flush pending data and return it. This should be called - * repepatedly until it returns nullptr. + * repeatedly until it returns nullptr. */ virtual ConstBuffer Flush(); }; From 8b327f1d9bb5649df69f9547e38bcdcbfd416de1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 24 Mar 2019 22:42:06 +0100 Subject: [PATCH 2/2] filter/AutoConvert: implement Flush() --- src/filter/plugins/AutoConvertFilterPlugin.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/filter/plugins/AutoConvertFilterPlugin.cxx b/src/filter/plugins/AutoConvertFilterPlugin.cxx index 08302cc00..accce87f2 100644 --- a/src/filter/plugins/AutoConvertFilterPlugin.cxx +++ b/src/filter/plugins/AutoConvertFilterPlugin.cxx @@ -56,6 +56,7 @@ public: } ConstBuffer FilterPCM(ConstBuffer src) override; + ConstBuffer Flush() override; }; class PreparedAutoConvertFilter final : public PreparedFilter { @@ -104,6 +105,18 @@ AutoConvertFilter::FilterPCM(ConstBuffer src) return filter->FilterPCM(src); } +ConstBuffer +AutoConvertFilter::Flush() +{ + if (convert != nullptr) { + auto result = convert->Flush(); + if (!result.IsNull()) + return filter->FilterPCM(result); + } + + return filter->Flush(); +} + std::unique_ptr autoconvert_filter_new(std::unique_ptr filter) noexcept {