output/Interface: pass std::span to Play()

This commit is contained in:
Max Kellermann
2022-07-12 12:31:35 +02:00
parent f5d104e7af
commit 45071607aa
29 changed files with 138 additions and 141 deletions
+4 -4
View File
@@ -45,7 +45,7 @@ private:
pclose(fh);
}
size_t Play(const void *chunk, size_t size) override;
std::size_t Play(std::span<const std::byte> src) override;
};
PipeOutput::PipeOutput(const ConfigBlock &block)
@@ -64,10 +64,10 @@ PipeOutput::Open([[maybe_unused]] AudioFormat &audio_format)
throw FormatErrno("Error opening pipe \"%s\"", cmd.c_str());
}
inline size_t
PipeOutput::Play(const void *chunk, size_t size)
std::size_t
PipeOutput::Play(std::span<const std::byte> src)
{
size_t nbytes = fwrite(chunk, 1, size, fh);
size_t nbytes = fwrite(src.data(), 1, src.size(), fh);
if (nbytes == 0)
throw MakeErrno("Write error on pipe");