summaryrefslogtreecommitdiff
path: root/src/pcm/PcmConvert.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-02 18:22:53 +0100
committerMax Kellermann <max@musicpd.org>2018-01-02 23:17:25 +0100
commitf6ec43b9ec2a1f64ed09479b60e85bd7d4fdb962 (patch)
tree95f98b40b95984409e2de699efc6abedcc0fb2a4 /src/pcm/PcmConvert.cxx
parent6d0d8cf9cf07a5d0905f715be9a79f5de86e8b37 (diff)
pcm/Resampler: add virtual method Flush()
Wired to Filter::Flush(). Closes #153
Diffstat (limited to 'src/pcm/PcmConvert.cxx')
-rw-r--r--src/pcm/PcmConvert.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pcm/PcmConvert.cxx b/src/pcm/PcmConvert.cxx
index a63e92a7c..548c5a9d1 100644
--- a/src/pcm/PcmConvert.cxx
+++ b/src/pcm/PcmConvert.cxx
@@ -152,3 +152,22 @@ PcmConvert::Convert(ConstBuffer<void> buffer)
return buffer;
}
+
+ConstBuffer<void>
+PcmConvert::Flush()
+{
+ if (enable_resampler) {
+ auto buffer = resampler.Flush();
+ if (!buffer.IsNull()) {
+ if (enable_format)
+ buffer = format_converter.Convert(buffer);
+
+ if (enable_channels)
+ buffer = channels_converter.Convert(buffer);
+
+ return buffer;
+ }
+ }
+
+ return nullptr;
+}