filter/*: use std::span instead of ConstBuffer

This commit is contained in:
Max Kellermann
2022-07-04 18:12:12 +02:00
parent 18ebd42c52
commit 67c6d111a8
16 changed files with 50 additions and 86 deletions

View File

@@ -30,7 +30,6 @@
#include "mixer/MixerControl.hxx"
#include "system/Error.hxx"
#include "io/FileDescriptor.hxx"
#include "util/ConstBuffer.hxx"
#include "util/StringBuffer.hxx"
#include "util/RuntimeError.hxx"
#include "util/PrintException.hxx"
@@ -102,22 +101,22 @@ try {
FileDescriptor output_fd(STDOUT_FILENO);
while (true) {
char buffer[4096];
std::byte buffer[4096];
ssize_t nbytes = ReadFrames(input_fd, buffer, sizeof(buffer),
in_frame_size);
if (nbytes == 0)
break;
auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes});
output_fd.FullWrite(dest.data, dest.size);
auto dest = filter->FilterPCM(std::span{buffer}.first(nbytes));
output_fd.FullWrite(dest.data(), dest.size());
}
while (true) {
auto dest = filter->Flush();
if (dest.IsNull())
if (dest.data() == nullptr)
break;
output_fd.FullWrite(dest.data, dest.size);
output_fd.FullWrite(dest.data(), dest.size());
}
/* cleanup and exit */