]> code.delx.au - pulseaudio/blobdiff - src/modules/module-jack-sink.c
* add new function pa_check_in_group()
[pulseaudio] / src / modules / module-jack-sink.c
index 96db837a429ca3900bc101b910a6c164db9630ad..c645caa99001da5507440d44c45281040bf2f19a 100644 (file)
@@ -1,20 +1,20 @@
 /* $Id$ */
 
 /***
-  This file is part of polypaudio.
+  This file is part of PulseAudio.
  
-  polypaudio is free software; you can redistribute it and/or modify
+  PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
   by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
-  polypaudio is distributed in the hope that it will be useful, but
+  PulseAudio 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 Lesser General Public License
-  along with polypaudio; if not, write to the Free Software
+  along with PulseAudio; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
 ***/
 
 #include <jack/jack.h>
 
-#include <polyp/xmalloc.h>
+#include <pulse/xmalloc.h>
 
-#include <polypcore/iochannel.h>
-#include <polypcore/sink.h>
-#include <polypcore/module.h>
-#include <polypcore/core-util.h>
-#include <polypcore/modargs.h>
-#include <polypcore/log.h>
-#include <polyp/mainloop-api.h>
+#include <pulsecore/core-error.h>
+#include <pulsecore/iochannel.h>
+#include <pulsecore/sink.h>
+#include <pulsecore/module.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/modargs.h>
+#include <pulsecore/log.h>
+#include <pulse/mainloop-api.h>
 
 #include "module-jack-sink-symdef.h"
 
@@ -79,6 +80,7 @@ struct userdata {
     jack_nframes_t frames_requested;
     int quit_requested;
 
+    int pipe_fd_type;
     int pipe_fds[2];
     pa_io_event *io_event;
 
@@ -119,7 +121,7 @@ static void io_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_
     assert(u);
     assert(u->pipe_fds[0] == fd);
 
-    read(fd, &x, 1);
+    pa_read(fd, &x, 1, &u->pipe_fd_type);
     
     if (u->quit_requested) {
         stop_sink(u);
@@ -164,7 +166,7 @@ static void request_render(struct userdata *u) {
     assert(u);
 
     assert(u->pipe_fds[1] >= 0);
-    write(u->pipe_fds[1], &c, 1);
+    pa_write(u->pipe_fds[1], &c, 1, &u->pipe_fd_type);
 }
 
 static void jack_shutdown(void *arg) {
@@ -240,7 +242,7 @@ int pa__init(pa_core *c, pa_module*m) {
     jack_status_t status;
     const char *server_name, *client_name;
     uint32_t channels = 0;
-    int connect = 1;
+    int do_connect = 1;
     unsigned i;
     const char **ports = NULL, **p;
     
@@ -254,25 +256,26 @@ int pa__init(pa_core *c, pa_module*m) {
         goto fail;
     }
 
-    if (pa_modargs_get_value_boolean(ma, "connect", &connect) < 0) {
+    if (pa_modargs_get_value_boolean(ma, "connect", &do_connect) < 0) {
         pa_log(__FILE__": failed to parse connect= argument.");
         goto fail;
     }
         
     server_name = pa_modargs_get_value(ma, "server_name", NULL);
-    client_name = pa_modargs_get_value(ma, "client_name", "polypaudio");
+    client_name = pa_modargs_get_value(ma, "client_name", "PulseAudio");
 
     u = pa_xnew0(struct userdata, 1);
     m->userdata = u;
     u->core = c;
     u->module = m;
     u->pipe_fds[0] = u->pipe_fds[1] = -1;
+    u->pipe_fd_type = 0;
 
     pthread_mutex_init(&u->mutex, NULL);
     pthread_cond_init(&u->cond, NULL);
     
     if (pipe(u->pipe_fds) < 0) {
-        pa_log(__FILE__": pipe() failed: %s", strerror(errno));
+        pa_log(__FILE__": pipe() failed: %s", pa_cstrerror(errno));
         goto fail;
     }
 
@@ -336,7 +339,7 @@ int pa__init(pa_core *c, pa_module*m) {
         goto fail;
     }
 
-    if (connect) {
+    if (do_connect) {
         for (i = 0, p = ports; i < ss.channels; i++, p++) {
 
             if (!*p) {