[pulseaudio-discuss] [PATCH 2/3] pacat: Enable binary mode on Windows.

kugel at rockbox.org kugel at rockbox.org
Wed Aug 8 14:06:11 PDT 2012


From: Thomas Martitz <thomas.martitz at student.htw-berlin.de>

Without this reading from stdin will eventually end with EOF (if there happens
to be a newline sign in the stream), because read() returns 0.

This patch fixes raw data input and piping to pacat on Windows.
---
 src/utils/pacat.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index ec360f7..734017c 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -1129,6 +1129,10 @@ int main(int argc, char *argv[]) {
     pa_disable_sigpipe();
 
     if (raw) {
+#ifdef OS_IS_WIN32
+        /* need to turn on binary mode for stdio io. Windows, meh */
+        setmode(mode == PLAYBACK ? STDIN_FILENO : STDOUT_FILENO, O_BINARY);
+#endif
         if (!(stdio_event = mainloop_api->io_new(mainloop_api,
                                                  mode == PLAYBACK ? STDIN_FILENO : STDOUT_FILENO,
                                                  mode == PLAYBACK ? PA_IO_EVENT_INPUT : PA_IO_EVENT_OUTPUT,
-- 
1.7.10.4



More information about the pulseaudio-discuss mailing list