[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, stable-queue, updated. v0.9.21-75-g2b88634

Colin Guthrie gitmailer-noreply at 0pointer.de
Sun Aug 15 13:41:53 PDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The stable-queue branch has been updated
      from  65f89dca7ce1a7c65e78d452437eae6c9466d763 (commit)

- Log -----------------------------------------------------------------
2b88634 x11: Partially convert to XCB.
4a1072e udev: fix hex decoding
aaae99d alsa: disable rewinds when using ALSA plugins
6c8660a alsa: Fix assertion on mmap_write (triggered via a52 plugin)
-----------------------------------------------------------------------

Summary of changes:
 configure.ac                         |    2 +-
 src/modules/alsa/alsa-sink.c         |   17 ++++++++-
 src/modules/udev-util.c              |    4 +-
 src/modules/x11/module-x11-publish.c |   35 +++++++++---------
 src/pulse/client-conf-x11.c          |   23 ++++++------
 src/pulsecore/x11prop.c              |   55 +++++++++++++++++-----------
 src/pulsecore/x11prop.h              |    9 +++--
 src/pulsecore/x11wrap.c              |    4 ++
 src/pulsecore/x11wrap.h              |    4 ++
 src/utils/pax11publish.c             |   67 +++++++++++++++++-----------------
 10 files changed, 126 insertions(+), 94 deletions(-)

-----------------------------------------------------------------------

commit 6c8660abd27b8e0c733fad0e03545fd9b9378f8b
Author: Colin Guthrie <cguthrie at mandriva.org>
Date:   Sun Jun 6 21:19:34 2010 +0100

    alsa: Fix assertion on mmap_write (triggered via a52 plugin)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 02b5a02..cc7baf2 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -607,6 +607,9 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
             if (PA_UNLIKELY((sframes = snd_pcm_mmap_commit(u->pcm_handle, offset, frames)) < 0)) {
 
+                if (!after_avail && (int) sframes == -EAGAIN)
+                    break;
+
                 if ((r = try_recover(u, "snd_pcm_mmap_commit", (int) sframes)) == 0)
                     continue;
 

commit aaae99d89f9e02a5248d0226a58da05dd3b7e600
Author: Pierre-Louis Bossart <pierre-louis.bossart at intel.com>
Date:   Tue Jul 13 15:27:40 2010 -0500

    alsa: disable rewinds when using ALSA plugins
    
    This is required to when playing on a52: device, rewind is broken
    in those plugins.
    Credits to Michael Rans <mcarans at yahoo.co.uk> for finding this
    workaround, and Tanu Kaskinen <tanuk at iki.fi> for providing
    valuable feedback.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at intel.com>

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index cc7baf2..a253cc5 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -944,7 +944,12 @@ static int update_sw_params(struct userdata *u) {
     }
 
     pa_sink_set_max_request_within_thread(u->sink, u->hwbuf_size - u->hwbuf_unused);
-    pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size);
+     if (pa_alsa_pcm_is_hw(u->pcm_handle))
+         pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size);
+    else {
+        pa_log_info("Disabling rewind_within_thread for device %s", u->device_name);
+        pa_sink_set_max_rewind_within_thread(u->sink, 0);
+    }
 
     return 0;
 }
@@ -1886,7 +1891,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
                 (double) pa_bytes_to_usec(u->hwbuf_size, &ss) / PA_USEC_PER_MSEC);
 
     pa_sink_set_max_request(u->sink, u->hwbuf_size);
-    pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
+    if (pa_alsa_pcm_is_hw(u->pcm_handle))
+        pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
+    else {
+        pa_log_info("Disabling rewind for device %s", u->device_name);
+        pa_sink_set_max_rewind(u->sink, 0);
+    }
 
     if (u->use_tsched) {
         u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, &requested_ss), &u->sink->sample_spec);

commit 4a1072e0bcce9165a262dc76a12baa2680caa0e3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Jul 19 01:27:15 2010 +0200

    udev: fix hex decoding

diff --git a/src/modules/udev-util.c b/src/modules/udev-util.c
index eee5409..52df103 100644
--- a/src/modules/udev-util.c
+++ b/src/modules/udev-util.c
@@ -63,10 +63,10 @@ static int dehex(char x) {
         return x - '0';
 
     if (x >= 'A' && x <= 'F')
-        return x - 'A';
+        return x - 'A' + 10;
 
     if (x >= 'a' && x <= 'f')
-        return x - 'a';
+        return x - 'a' + 10;
 
     return -1;
 }

commit 2b88634671d1b745b1364e9cf4827e30a5ff2a6e
Author: Colin Guthrie <cguthrie at mandriva.org>
Date:   Sat May 29 19:33:54 2010 +0100

    x11: Partially convert to XCB.
    
    This commit mostly converts the X11 handling to XCB. There are still
    some uses of XLib to deal with the X11 session handling modules, however all
    client-side code should now be free of XLib and thus this should fix Bug #799

diff --git a/configure.ac b/configure.ac
index abcce13..d15499c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -516,7 +516,7 @@ AC_ARG_ENABLE([x11],
         [x11=auto])
 
 if test "x${x11}" != xno ; then
-    PKG_CHECK_MODULES(X11, [ x11 ice sm xtst ],
+    PKG_CHECK_MODULES(X11, [ x11-xcb ice sm xtst xcb-atom ],
         HAVE_X11=1,
         [
             HAVE_X11=0
diff --git a/src/modules/x11/module-x11-publish.c b/src/modules/x11/module-x11-publish.c
index 7ee1b6d..e811bdf 100644
--- a/src/modules/x11/module-x11-publish.c
+++ b/src/modules/x11/module-x11-publish.c
@@ -28,8 +28,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
+#include <xcb/xcb.h>
 
 #include <pulse/util.h>
 #include <pulse/xmalloc.h>
@@ -92,10 +91,10 @@ static void publish_servers(struct userdata *u, pa_strlist *l) {
         s = pa_strlist_tostring(l);
         pa_strlist_reverse(l);
 
-        pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SERVER", s);
+        pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SERVER", s);
         pa_xfree(s);
     } else
-        pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SERVER");
+        pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SERVER");
 }
 
 static pa_hook_result_t servers_changed_cb(void *hook_data, void *call_data, void *slot_data) {
@@ -105,7 +104,7 @@ static pa_hook_result_t servers_changed_cb(void *hook_data, void *call_data, voi
 
     pa_assert(u);
 
-    if (!pa_x11_get_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", t, sizeof(t)) || strcmp(t, u->id)) {
+    if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_ID", t, sizeof(t)) || strcmp(t, u->id)) {
         pa_log_warn("PulseAudio information vanished from X11!");
         return PA_HOOK_OK;
     }
@@ -168,22 +167,22 @@ int pa__init(pa_module*m) {
     u->id = pa_sprintf_malloc("%lu@%s/%lu", (unsigned long) getuid(), mid, (unsigned long) getpid());
     pa_xfree(mid);
 
-    pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", u->id);
+    pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_ID", u->id);
 
     if ((sid = pa_session_id())) {
-        pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SESSION_ID", sid);
+        pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SESSION_ID", sid);
         pa_xfree(sid);
     }
 
     publish_servers(u, pa_native_protocol_servers(u->protocol));
 
     if ((t = pa_modargs_get_value(ma, "source", NULL)))
-        pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SOURCE", t);
+        pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SOURCE", t);
 
     if ((t = pa_modargs_get_value(ma, "sink", NULL)))
-        pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SINK", t);
+        pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SINK", t);
 
-    pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_COOKIE",
+    pa_x11_set_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_COOKIE",
                     pa_hexstr(pa_auth_cookie_read(u->auth_cookie, PA_NATIVE_COOKIE_LENGTH), PA_NATIVE_COOKIE_LENGTH, hx, sizeof(hx)));
 
     u->x11_client = pa_x11_client_new(u->x11_wrapper, NULL, x11_kill_cb, u);
@@ -216,16 +215,16 @@ void pa__done(pa_module*m) {
         char t[256];
 
         /* Yes, here is a race condition */
-        if (!pa_x11_get_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", t, sizeof(t)) || strcmp(t, u->id))
+        if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_ID", t, sizeof(t)) || strcmp(t, u->id))
             pa_log_warn("PulseAudio information vanished from X11!");
         else {
-            pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID");
-            pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SERVER");
-            pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SINK");
-            pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SOURCE");
-            pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_COOKIE");
-            pa_x11_del_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_SESSION_ID");
-            XSync(pa_x11_wrapper_get_display(u->x11_wrapper), False);
+            pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_ID");
+            pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SERVER");
+            pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SINK");
+            pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SOURCE");
+            pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_COOKIE");
+            pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), "PULSE_SESSION_ID");
+            xcb_flush(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper));
         }
 
         pa_x11_wrapper_unref(u->x11_wrapper);
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c
index 4970363..565f997 100644
--- a/src/pulse/client-conf-x11.c
+++ b/src/pulse/client-conf-x11.c
@@ -25,8 +25,7 @@
 
 #include <string.h>
 
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
+#include <xcb/xcb.h>
 
 #include <pulse/xmalloc.h>
 #include <pulse/i18n.h>
@@ -39,7 +38,7 @@
 #include "client-conf-x11.h"
 
 int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
-    Display *d = NULL;
+    xcb_connection_t *xcb = NULL;
     int ret = -1;
     char t[1024];
 
@@ -51,18 +50,18 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
     if (*dname == 0)
         goto finish;
 
-    if (!(d = XOpenDisplay(dname))) {
-        pa_log(_("XOpenDisplay() failed"));
+    if (!(xcb = xcb_connect(dname, NULL))) {
+        pa_log(_("xcb_connect() failed"));
         goto finish;
     }
 
-    if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t))) {
+    if (pa_x11_get_prop(xcb, "PULSE_SERVER", t, sizeof(t))) {
         pa_bool_t disable_autospawn = TRUE;
 
         pa_xfree(c->default_server);
         c->default_server = pa_xstrdup(t);
 
-        if (pa_x11_get_prop(d, "PULSE_SESSION_ID", t, sizeof(t))) {
+        if (pa_x11_get_prop(xcb, "PULSE_SESSION_ID", t, sizeof(t))) {
             char *id;
 
             if ((id = pa_session_id())) {
@@ -76,17 +75,17 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
             c->autospawn = FALSE;
     }
 
-    if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t))) {
+    if (pa_x11_get_prop(xcb, "PULSE_SINK", t, sizeof(t))) {
         pa_xfree(c->default_sink);
         c->default_sink = pa_xstrdup(t);
     }
 
-    if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t))) {
+    if (pa_x11_get_prop(xcb, "PULSE_SOURCE", t, sizeof(t))) {
         pa_xfree(c->default_source);
         c->default_source = pa_xstrdup(t);
     }
 
-    if (pa_x11_get_prop(d, "PULSE_COOKIE", t, sizeof(t))) {
+    if (pa_x11_get_prop(xcb, "PULSE_COOKIE", t, sizeof(t))) {
         uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
 
         if (pa_parsehex(t, cookie, sizeof(cookie)) != sizeof(cookie)) {
@@ -106,8 +105,8 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
     ret = 0;
 
 finish:
-    if (d)
-        XCloseDisplay(d);
+    if (xcb)
+        xcb_disconnect(xcb);
 
     return ret;
 
diff --git a/src/pulsecore/x11prop.c b/src/pulsecore/x11prop.c
index 873a76e..cc5987a 100644
--- a/src/pulsecore/x11prop.c
+++ b/src/pulsecore/x11prop.c
@@ -25,45 +25,58 @@
 
 #include <string.h>
 
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
 #include "x11prop.h"
 
-void pa_x11_set_prop(Display *d, const char *name, const char *data) {
-    Atom a = XInternAtom(d, name, False);
-    XChangeProperty(d, RootWindow(d, 0), a, XA_STRING, 8, PropModeReplace, (const unsigned char*) data, (int) (strlen(data)+1));
+#include <xcb/xproto.h>
+#include <xcb/xcb_atom.h>
+
+#define PA_XCB_FORMAT 8
+
+void pa_x11_set_prop(xcb_connection_t *xcb, const char *name, const char *data) {
+    xcb_screen_t *screen;
+    xcb_atom_t a = xcb_atom_get(xcb, name);
+    screen = xcb_setup_roots_iterator(xcb_get_setup(xcb)).data;
+    xcb_change_property(xcb, XCB_PROP_MODE_REPLACE, screen->root, a, STRING, PA_XCB_FORMAT, (int) strlen(data), (const void*) data);
 }
 
-void pa_x11_del_prop(Display *d, const char *name) {
-    Atom a = XInternAtom(d, name, False);
-    XDeleteProperty(d, RootWindow(d, 0), a);
+void pa_x11_del_prop(xcb_connection_t *xcb, const char *name) {
+    xcb_screen_t *screen;
+    xcb_atom_t a = xcb_atom_get(xcb, name);
+    screen = xcb_setup_roots_iterator(xcb_get_setup(xcb)).data;
+    xcb_delete_property(xcb, screen->root, a);
 }
 
-char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l) {
-    Atom actual_type;
-    int actual_format;
-    unsigned long nitems;
-    unsigned long nbytes_after;
-    unsigned char *prop = NULL;
+char* pa_x11_get_prop(xcb_connection_t *xcb, const char *name, char *p, size_t l) {
     char *ret = NULL;
+    int len;
+    xcb_get_property_cookie_t req;
+    xcb_get_property_reply_t* prop = NULL;
+    xcb_screen_t *screen;
+    xcb_atom_t a = xcb_atom_get(xcb, name);
+    screen = xcb_setup_roots_iterator(xcb_get_setup(xcb)).data;
+
+    req = xcb_get_property(xcb, 0, screen->root, a, STRING, 0, (uint32_t)(l-1));
+    prop = xcb_get_property_reply(xcb, req, NULL);
+
+    if (!prop)
+        goto finish;
 
-    Atom a = XInternAtom(d, name, False);
-    if (XGetWindowProperty(d, RootWindow(d, 0), a, 0, (long) ((l+2)/4), False, XA_STRING, &actual_type, &actual_format, &nitems, &nbytes_after, &prop) != Success)
+    if (PA_XCB_FORMAT != prop->format)
         goto finish;
 
-    if (actual_type != XA_STRING)
+    len = xcb_get_property_value_length(prop);
+    if (len < 1 || len >= (int)l)
         goto finish;
 
-    memcpy(p, prop, nitems);
-    p[nitems] = 0;
+    memcpy(p, xcb_get_property_value(prop), len);
+    p[len] = 0;
 
     ret = p;
 
 finish:
 
     if (prop)
-        XFree(prop);
+        free(prop);
 
     return ret;
 }
diff --git a/src/pulsecore/x11prop.h b/src/pulsecore/x11prop.h
index dc67526..7492261 100644
--- a/src/pulsecore/x11prop.h
+++ b/src/pulsecore/x11prop.h
@@ -5,6 +5,7 @@
   This file is part of PulseAudio.
 
   Copyright 2004-2006 Lennart Poettering
+  Copyright 2010 Colin Guthrie
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
@@ -24,10 +25,10 @@
 
 #include <sys/types.h>
 
-#include <X11/Xlib.h>
+#include <xcb/xcb.h>
 
-void pa_x11_set_prop(Display *d, const char *name, const char *data);
-void pa_x11_del_prop(Display *d, const char *name);
-char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l);
+void pa_x11_set_prop(xcb_connection_t *xcb, const char *name, const char *data);
+void pa_x11_del_prop(xcb_connection_t *xcb, const char *name);
+char* pa_x11_get_prop(xcb_connection_t *xcb, const char *name, char *p, size_t l);
 
 #endif
diff --git a/src/pulsecore/x11wrap.c b/src/pulsecore/x11wrap.c
index 1960a12..454507a 100644
--- a/src/pulsecore/x11wrap.c
+++ b/src/pulsecore/x11wrap.c
@@ -259,6 +259,10 @@ Display *pa_x11_wrapper_get_display(pa_x11_wrapper *w) {
     return w->display;
 }
 
+xcb_connection_t *pa_x11_wrapper_get_xcb_connection(pa_x11_wrapper *w) {
+    return XGetXCBConnection(pa_x11_wrapper_get_display(w));
+}
+
 void pa_x11_wrapper_kill(pa_x11_wrapper *w) {
     pa_x11_client *c, *n;
 
diff --git a/src/pulsecore/x11wrap.h b/src/pulsecore/x11wrap.h
index b57541f..fc2e01f 100644
--- a/src/pulsecore/x11wrap.h
+++ b/src/pulsecore/x11wrap.h
@@ -23,6 +23,7 @@
 ***/
 
 #include <X11/Xlib.h>
+#include <X11/Xlib-xcb.h>
 
 #include <pulsecore/core.h>
 
@@ -46,6 +47,9 @@ void pa_x11_wrapper_unref(pa_x11_wrapper* w);
 /* Return the X11 display object for this connection */
 Display *pa_x11_wrapper_get_display(pa_x11_wrapper *w);
 
+/* Return the XCB connection object for this connection */
+xcb_connection_t *pa_x11_wrapper_get_xcb_connection(pa_x11_wrapper *w);
+
 /* Kill the connection to the X11 display */
 void pa_x11_wrapper_kill(pa_x11_wrapper *w);
 
diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c
index a9eb329..111bee2 100644
--- a/src/utils/pax11publish.c
+++ b/src/utils/pax11publish.c
@@ -29,8 +29,7 @@
 #include <assert.h>
 #include <locale.h>
 
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
+#include <xcb/xcb.h>
 
 #include <pulse/util.h>
 #include <pulse/i18n.h>
@@ -46,7 +45,7 @@
 int main(int argc, char *argv[]) {
     const char *dname = NULL, *sink = NULL, *source = NULL, *server = NULL, *cookie_file = PA_NATIVE_COOKIE_FILE;
     int c, ret = 1;
-    Display *d = NULL;
+    xcb_connection_t *xcb = NULL;
     enum { DUMP, EXPORT, IMPORT, REMOVE } mode = DUMP;
 
     setlocale(LC_ALL, "");
@@ -96,21 +95,21 @@ int main(int argc, char *argv[]) {
         }
     }
 
-    if (!(d = XOpenDisplay(dname))) {
-        pa_log(_("XOpenDisplay() failed"));
+    if (!(xcb = xcb_connect(dname, NULL))) {
+        pa_log(_("xcb_connect() failed"));
         goto finish;
     }
 
     switch (mode) {
         case DUMP: {
             char t[1024];
-            if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_SERVER", t, sizeof(t)))
                 printf(_("Server: %s\n"), t);
-            if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_SOURCE", t, sizeof(t)))
                 printf(_("Source: %s\n"), t);
-            if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_SINK", t, sizeof(t)))
                 printf(_("Sink: %s\n"), t);
-            if (pa_x11_get_prop(d, "PULSE_COOKIE", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_COOKIE", t, sizeof(t)))
                 printf(_("Cookie: %s\n"), t);
 
             break;
@@ -118,14 +117,14 @@ int main(int argc, char *argv[]) {
 
         case IMPORT: {
             char t[1024];
-            if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_SERVER", t, sizeof(t)))
                 printf("PULSE_SERVER='%s'\nexport PULSE_SERVER\n", t);
-            if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_SOURCE", t, sizeof(t)))
                 printf("PULSE_SOURCE='%s'\nexport PULSE_SOURCE\n", t);
-            if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t)))
+            if (pa_x11_get_prop(xcb, "PULSE_SINK", t, sizeof(t)))
                 printf("PULSE_SINK='%s'\nexport PULSE_SINK\n", t);
 
-            if (pa_x11_get_prop(d, "PULSE_COOKIE", t, sizeof(t))) {
+            if (pa_x11_get_prop(xcb, "PULSE_COOKIE", t, sizeof(t))) {
                 uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
                 size_t l;
                 if ((l = pa_parsehex(t, cookie, sizeof(cookie))) != sizeof(cookie)) {
@@ -158,16 +157,16 @@ int main(int argc, char *argv[]) {
                 goto finish;
             }
 
-            pa_x11_del_prop(d, "PULSE_SERVER");
-            pa_x11_del_prop(d, "PULSE_SINK");
-            pa_x11_del_prop(d, "PULSE_SOURCE");
-            pa_x11_del_prop(d, "PULSE_ID");
-            pa_x11_del_prop(d, "PULSE_COOKIE");
+            pa_x11_del_prop(xcb, "PULSE_SERVER");
+            pa_x11_del_prop(xcb, "PULSE_SINK");
+            pa_x11_del_prop(xcb, "PULSE_SOURCE");
+            pa_x11_del_prop(xcb, "PULSE_ID");
+            pa_x11_del_prop(xcb, "PULSE_COOKIE");
 
             if (server)
-                pa_x11_set_prop(d, "PULSE_SERVER", server);
+                pa_x11_set_prop(xcb, "PULSE_SERVER", server);
             else if (conf->default_server)
-                pa_x11_set_prop(d, "PULSE_SERVER", conf->default_server);
+                pa_x11_set_prop(xcb, "PULSE_SERVER", conf->default_server);
             else {
                 char hn[256];
                 if (!pa_get_fqdn(hn, sizeof(hn))) {
@@ -175,18 +174,18 @@ int main(int argc, char *argv[]) {
                     goto finish;
                 }
 
-                pa_x11_set_prop(d, "PULSE_SERVER", hn);
+                pa_x11_set_prop(xcb, "PULSE_SERVER", hn);
             }
 
             if (sink)
-                pa_x11_set_prop(d, "PULSE_SINK", sink);
+                pa_x11_set_prop(xcb, "PULSE_SINK", sink);
             else if (conf->default_sink)
-                pa_x11_set_prop(d, "PULSE_SINK", conf->default_sink);
+                pa_x11_set_prop(xcb, "PULSE_SINK", conf->default_sink);
 
             if (source)
-                pa_x11_set_prop(d, "PULSE_SOURCE", source);
+                pa_x11_set_prop(xcb, "PULSE_SOURCE", source);
             if (conf->default_source)
-                pa_x11_set_prop(d, "PULSE_SOURCE", conf->default_source);
+                pa_x11_set_prop(xcb, "PULSE_SOURCE", conf->default_source);
 
             pa_client_conf_free(conf);
 
@@ -195,16 +194,16 @@ int main(int argc, char *argv[]) {
                 goto finish;
             }
 
-            pa_x11_set_prop(d, "PULSE_COOKIE", pa_hexstr(cookie, sizeof(cookie), hx, sizeof(hx)));
+            pa_x11_set_prop(xcb, "PULSE_COOKIE", pa_hexstr(cookie, sizeof(cookie), hx, sizeof(hx)));
             break;
         }
 
         case REMOVE:
-            pa_x11_del_prop(d, "PULSE_SERVER");
-            pa_x11_del_prop(d, "PULSE_SINK");
-            pa_x11_del_prop(d, "PULSE_SOURCE");
-            pa_x11_del_prop(d, "PULSE_ID");
-            pa_x11_del_prop(d, "PULSE_COOKIE");
+            pa_x11_del_prop(xcb, "PULSE_SERVER");
+            pa_x11_del_prop(xcb, "PULSE_SINK");
+            pa_x11_del_prop(xcb, "PULSE_SOURCE");
+            pa_x11_del_prop(xcb, "PULSE_ID");
+            pa_x11_del_prop(xcb, "PULSE_COOKIE");
             break;
 
         default:
@@ -216,9 +215,9 @@ int main(int argc, char *argv[]) {
 
 finish:
 
-    if (d) {
-        XSync(d, False);
-        XCloseDisplay(d);
+    if (xcb) {
+        xcb_flush(xcb);
+        xcb_disconnect(xcb);
     }
 
     return ret;

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list