mpd/src/encoder/ToOutputStream.cxx
2023-09-26 15:48:22 +02:00

24 lines
452 B
C++

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#include "ToOutputStream.hxx"
#include "EncoderInterface.hxx"
#include "io/OutputStream.hxx"
void
EncoderToOutputStream(OutputStream &os, Encoder &encoder)
{
while (true) {
/* read from the encoder */
std::byte buffer[32768];
const auto r = encoder.Read(buffer);
if (r.empty())
return;
/* write everything to the stream */
os.Write(r);
}
}