X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/22b9fa74de8e80471a5033ea067d3b360930b91d..ec57f6c97b41d54ade912f7e3b9f727b40e38e16:/server/speaker-command.c
diff --git a/server/speaker-command.c b/server/speaker-command.c
index 8a8f63c..e85d198 100644
--- a/server/speaker-command.c
+++ b/server/speaker-command.c
@@ -1,30 +1,29 @@
/*
* This file is part of DisOrder
* Copyright (C) 2005, 2006, 2007 Richard Kettlewell
+ * Portions (C) 2007 Mark Wooding
*
- * This program is free software; you can redistribute it and/or modify
+ * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * along with this program. If not, see .
*/
/** @file server/speaker-command.c
* @brief Support for @ref BACKEND_COMMAND */
-#include
-#include "types.h"
+#include "common.h"
#include
#include
+#include
#include "configuration.h"
#include "syscalls.h"
@@ -52,6 +51,7 @@ static void fork_cmd(void) {
xpipe(pfd);
cmdpid = xfork();
if(!cmdpid) {
+ exitfn = _exit;
signal(SIGPIPE, SIG_DFL);
xdup2(pfd[0], 0);
close(pfd[0]);
@@ -72,7 +72,7 @@ static void command_init(void) {
/** @brief Play to a subprocess */
static size_t command_play(size_t frames) {
- size_t bytes = frames * device_bpf;
+ size_t bytes = frames * bpf;
int written_bytes;
written_bytes = write(cmdfd, playing->buffer + playing->start, bytes);
@@ -90,11 +90,11 @@ static size_t command_play(size_t frames) {
fatal(errno, "error writing to subprocess");
}
} else
- return written_bytes / device_bpf;
+ return written_bytes / bpf;
}
/** @brief Update poll array for writing to subprocess */
-static void command_beforepoll(void) {
+static void command_beforepoll(int attribute((unused)) *timeoutp) {
/* We send sample data to the subprocess as fast as it can accept it.
* This isn't ideal as pause latency can be very high as a result. */
if(cmdfd >= 0)
@@ -111,7 +111,7 @@ static int command_ready(void) {
const struct speaker_backend command_backend = {
BACKEND_COMMAND,
- FIXED_FORMAT,
+ 0,
command_init,
0, /* activate */
command_play,