summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-03-08 16:36:52 +0100
committerMax Kellermann <max@musicpd.org>2021-03-08 16:44:15 +0100
commite227596c2052f28956d1767c5562d2c5a133049d (patch)
treed28c679912570f1c57ec1582c1ae4defeb6e3f57
parentec76583c33bb9a53985ae0ff9db602e2852d9c70 (diff)
test/run_output: pass FileDescriptor to run_output()
-rw-r--r--test/run_output.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/run_output.cxx b/test/run_output.cxx
index bb7ba71b8..f7d86a825 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -113,7 +113,8 @@ LoadAudioOutput(const ConfigData &config, EventLoop &event_loop,
}
static void
-run_output(AudioOutput &ao, AudioFormat audio_format)
+RunOutput(AudioOutput &ao, AudioFormat audio_format,
+ FileDescriptor in_fd)
{
/* open the audio output */
@@ -134,8 +135,8 @@ run_output(AudioOutput &ao, AudioFormat audio_format)
char buffer[4096];
while (true) {
if (length < sizeof(buffer)) {
- ssize_t nbytes = read(0, buffer + length,
- sizeof(buffer) - length);
+ ssize_t nbytes = in_fd.Read(buffer + length,
+ sizeof(buffer) - length);
if (nbytes <= 0)
break;
@@ -174,7 +175,7 @@ try {
/* do it */
- run_output(*ao, c.audio_format);
+ RunOutput(*ao, c.audio_format, FileDescriptor(STDIN_FILENO));
/* cleanup and exit */