[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test2-14-ge954a89

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Feb 13 09:19:22 PST 2009


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 master branch has been updated
      from  433751ff258b78f23a8e82b06f54522f820d3230 (commit)

- Log -----------------------------------------------------------------
e954a89... properly read icon/application name/display from gtk/glib/gdk
f863756... make PULSE_PROP env vars non-overriding but introduce PULSE_PROP_OVERRIDE for allowing overriding
689e6f8... add definition for GCC style weak references
44bca66... make PA_GCC_PACKED and PA_GCC_MALLOC actually work
c0fb91d... drop check for PA_PROP_APPLICATION_NAME since often enough we can deduce this better from g_get_application_name()
15e9b96... we reinit proplist since the server will copy from client proplist anyway
62818b8... fix aiff channel mapping for 6 channels
-----------------------------------------------------------------------

Summary of changes:
 configure.ac                        |   39 +++++++++++++
 src/Makefile.am                     |   13 +++++
 src/modules/module-card-restore.c   |    4 +-
 src/modules/module-device-restore.c |    4 +-
 src/modules/module-stream-restore.c |    4 +-
 src/pulse/channelmap.c              |    4 +-
 src/pulse/context.c                 |    3 -
 src/pulse/gccmacro.h                |   10 +++-
 src/pulse/scache.c                  |    4 +-
 src/pulsecore/proplist-util.c       |  103 ++++++++++++++++++++++++++++-------
 src/pulsecore/shm.c                 |    4 +-
 src/tests/gtk-test.c                |   62 +++++++++++++++++++++
 12 files changed, 216 insertions(+), 38 deletions(-)
 create mode 100644 src/tests/gtk-test.c

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

commit 62818b8e57787f3b717443e72cb6dd28c4c0d4fd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:48:34 2009 +0100

    fix aiff channel mapping for 6 channels

diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 983b897..82e36c0 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -217,10 +217,10 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
 
                 case 6:
                     m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
-                    m->map[1] = PA_CHANNEL_POSITION_SIDE_LEFT;
+                    m->map[1] = PA_CHANNEL_POSITION_REAR_LEFT;
                     m->map[2] = PA_CHANNEL_POSITION_FRONT_CENTER;
                     m->map[3] = PA_CHANNEL_POSITION_FRONT_RIGHT;
-                    m->map[4] = PA_CHANNEL_POSITION_SIDE_RIGHT;
+                    m->map[4] = PA_CHANNEL_POSITION_REAR_RIGHT;
                     m->map[5] = PA_CHANNEL_POSITION_LFE;
                     return m;
 

commit 15e9b968e1fe67eef272803c80bbecc8463c3c89
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 17:59:53 2009 +0100

    we reinit proplist since the server will copy from client proplist anyway

diff --git a/src/pulse/scache.c b/src/pulse/scache.c
index c96c42a..a7e3cd8 100644
--- a/src/pulse/scache.c
+++ b/src/pulse/scache.c
@@ -66,10 +66,8 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) {
     pa_tagstruct_put_channel_map(t, &s->channel_map);
     pa_tagstruct_putu32(t, (uint32_t) length);
 
-    if (s->context->version >= 13) {
-        pa_init_proplist(s->proplist);
+    if (s->context->version >= 13)
         pa_tagstruct_put_proplist(t, s->proplist);
-    }
 
     pa_pstream_send_tagstruct(s->context->pstream, t);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);

commit c0fb91db545774ec45f208a6f771c22a0b153637
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 18:01:00 2009 +0100

    drop check for PA_PROP_APPLICATION_NAME since often enough we can deduce this better from g_get_application_name()

diff --git a/src/pulse/context.c b/src/pulse/context.c
index 8105091..8686e0d 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -129,9 +129,6 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
 
     pa_init_i18n();
 
-    if (!name && !pa_proplist_contains(p, PA_PROP_APPLICATION_NAME))
-        return NULL;
-
     c = pa_xnew(pa_context, 1);
     PA_REFCNT_INIT(c);
 

commit 44bca66c5929e63bb39ed68420a74c97523b411f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 18:02:47 2009 +0100

    make PA_GCC_PACKED and PA_GCC_MALLOC actually work

diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
index 4dffd36..909c095 100644
--- a/src/modules/module-card-restore.c
+++ b/src/modules/module-card-restore.c
@@ -70,10 +70,10 @@ struct userdata {
 
 #define ENTRY_VERSION 1
 
-struct entry PA_GCC_PACKED {
+struct entry {
     uint8_t version;
     char profile[PA_NAME_MAX];
-};
+} PA_GCC_PACKED ;
 
 static void save_time_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) {
     struct userdata *u = userdata;
diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
index 7c56c24..e6a4881 100644
--- a/src/modules/module-device-restore.c
+++ b/src/modules/module-device-restore.c
@@ -81,12 +81,12 @@ struct userdata {
 
 #define ENTRY_VERSION 1
 
-struct entry PA_GCC_PACKED {
+struct entry {
     uint8_t version;
     pa_bool_t muted:1;
     pa_channel_map channel_map;
     pa_cvolume volume;
-};
+} PA_GCC_PACKED;
 
 static void save_time_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) {
     struct userdata *u = userdata;
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 2dd2045..434dc7a 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -93,7 +93,7 @@ struct userdata {
 
 #define ENTRY_VERSION 1
 
-struct entry PA_GCC_PACKED {
+struct entry {
     uint8_t version;
     pa_bool_t muted_valid:1, relative_volume_valid:1, absolute_volume_valid:1, device_valid:1;
     pa_bool_t muted:1;
@@ -101,7 +101,7 @@ struct entry PA_GCC_PACKED {
     pa_cvolume relative_volume;
     pa_cvolume absolute_volume;
     char device[PA_NAME_MAX];
-};
+} PA_GCC_PACKED;
 
 enum {
     SUBCOMMAND_TEST,
diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h
index 0b1a1a6..0f751c0 100644
--- a/src/pulse/gccmacro.h
+++ b/src/pulse/gccmacro.h
@@ -88,7 +88,7 @@
 #endif
 
 #ifndef PA_GCC_PACKED
-#ifdef __GNUCC__
+#ifdef __GNUC__
 #define PA_GCC_PACKED __attribute__ ((packed))
 #else
 /** Structure shall be packed in memory **/
@@ -109,7 +109,7 @@
 #endif
 
 #ifndef PA_GCC_MALLOC
-#ifdef __GNUCC__
+#ifdef __GNUC__
 #define PA_GCC_MALLOC __attribute__ ((malloc))
 #else
 /** Macro for usage of GCC's malloc attribute */
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index c59d247..b8c5f78 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -70,14 +70,14 @@
 
 /* We now put this SHM marker at the end of each segment. It's
  * optional, to not require a reboot when upgrading, though */
-struct shm_marker PA_GCC_PACKED {
+struct shm_marker {
     pa_atomic_t marker; /* 0xbeefcafe */
     pa_atomic_t pid;
     uint64_t _reserved1;
     uint64_t _reserved2;
     uint64_t _reserved3;
     uint64_t _reserved4;
-};
+} PA_GCC_PACKED;
 
 static char *segment_name(char *fn, size_t l, unsigned id) {
     pa_snprintf(fn, l, "/pulse-shm-%u", id);

commit 689e6f8a811e9fb00928bc57f2acbb859ac3923a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 18:03:21 2009 +0100

    add definition for GCC style weak references

diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h
index 0f751c0..8d9d4f0 100644
--- a/src/pulse/gccmacro.h
+++ b/src/pulse/gccmacro.h
@@ -117,4 +117,10 @@
 #endif
 #endif
 
+#ifndef PA_GCC_WEAKREF
+#ifdef __GNUC__
+#define PA_GCC_WEAKREF(x) __attribute__((weakref(#x)));
+#endif
+#endif
+
 #endif

commit f863756b430bed8cd43c31535eda5d973abbc1b1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 18:06:30 2009 +0100

    make PULSE_PROP env vars non-overriding but introduce PULSE_PROP_OVERRIDE for allowing overriding

diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c
index 8a447cf..ae8e080 100644
--- a/src/pulsecore/proplist-util.c
+++ b/src/pulsecore/proplist-util.c
@@ -58,18 +58,27 @@ void pa_init_proplist(pa_proplist *p) {
         for (e = environ; *e; e++) {
 
             if (pa_startswith(*e, "PULSE_PROP_")) {
-                size_t kl = strcspn(*e+11, "=");
+                size_t kl, skip;
                 char *k;
+                pa_bool_t override;
 
-                if ((*e)[11+kl] != '=')
-                    continue;
+                if (pa_startswith(*e, "PULSE_PROP_OVERRIDE_")) {
+                    skip = 20;
+                    override = TRUE;
+                } else {
+                    skip = 11;
+                    override = FALSE;
+                }
+
+                kl = strcspn(*e+skip, "=");
 
-                if (!pa_utf8_valid(*e+11+kl+1))
+                if ((*e)[skip+kl] != '=')
                     continue;
 
-                k = pa_xstrndup(*e+11, kl);
+                k = pa_xstrndup(*e+skip, kl);
 
-                pa_proplist_sets(p, k, *e+11+kl+1);
+                if (override || !pa_proplist_contains(p, k))
+                    pa_proplist_sets(p, k, *e+skip+kl+1);
                 pa_xfree(k);
             }
         }
@@ -79,6 +88,15 @@ void pa_init_proplist(pa_proplist *p) {
         pa_proplist *t;
 
         if ((t = pa_proplist_from_string(pp))) {
+            pa_proplist_update(p, PA_UPDATE_MERGE, t);
+            pa_proplist_free(t);
+        }
+    }
+
+    if ((pp = getenv("PULSE_PROP_OVERRIDE"))) {
+        pa_proplist *t;
+
+        if ((t = pa_proplist_from_string(pp))) {
             pa_proplist_update(p, PA_UPDATE_REPLACE, t);
             pa_proplist_free(t);
         }

commit e954a89d89a88774a7a8ebb32f08f9b0f377d4fe
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 18:19:10 2009 +0100

    properly read icon/application name/display from gtk/glib/gdk

diff --git a/configure.ac b/configure.ac
index fbe134c..e809839 100644
--- a/configure.ac
+++ b/configure.ac
@@ -721,6 +721,45 @@ AC_SUBST(GLIB20_LIBS)
 AC_SUBST(HAVE_GLIB20)
 AM_CONDITIONAL([HAVE_GLIB20], [test "x$HAVE_GLIB20" = x1])
 
+if test "x$HAVE_GLIB20" = x1 ; then
+   AC_DEFINE([HAVE_GLIB], 1, [Have GLIB?])
+fi
+
+#### GTK2 support (optional) ####
+
+AC_ARG_ENABLE([gtk2],
+    AS_HELP_STRING([--disable-gtk2],[Disable optional Gtk+ 2 support]),
+        [
+            case "${enableval}" in
+                yes) gtk2=yes ;;
+                no) gtk2=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk2) ;;
+            esac
+        ],
+        [gtk2=auto])
+
+if test "x${gtk2}" != xno ; then
+    PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ],
+        HAVE_GTK20=1,
+        [
+            HAVE_GTK20=0
+            if test "x$gtk2" = xyes ; then
+                AC_MSG_ERROR([*** Gtk+ 2 support not found])
+            fi
+        ])
+else
+    HAVE_GTK20=0
+fi
+
+AC_SUBST(GTK20_CFLAGS)
+AC_SUBST(GTK20_LIBS)
+AC_SUBST(HAVE_GTK20)
+AM_CONDITIONAL([HAVE_GTK20], [test "x$HAVE_GTK20" = x1])
+
+if test "x$HAVE_GTK20" = x1 ; then
+   AC_DEFINE([HAVE_GTK], 1, [Have GTK?])
+fi
+
 #### GConf support (optional) ####
 
 AC_ARG_ENABLE([gconf],
diff --git a/src/Makefile.am b/src/Makefile.am
index 811b120..f385c0a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -308,6 +308,11 @@ TESTS_BINARIES += \
 		mainloop-test-glib
 endif
 
+if HAVE_GTK20
+TESTS_BINARIES += \
+		gtk-test
+endif
+
 if BUILD_TESTS_DEFAULT
 noinst_PROGRAMS = $(TESTS_BINARIES)
 else
@@ -504,6 +509,11 @@ prioq_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINORMICRO@.la libpulsecomm
 prioq_test_CFLAGS = $(AM_CFLAGS) $(LIBOIL_CFLAGS)
 prioq_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBOIL_LIBS)
 
+gtk_test_SOURCES = tests/gtk-test.c
+gtk_test_LDADD = $(AM_LDADD) libpulse.la libpulse-mainloop-glib.la
+gtk_test_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
+gtk_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(GTK20_LIBS)
+
 ###################################
 #         Common library          #
 ###################################
@@ -571,6 +581,9 @@ libpulsecommon_ at PA_MAJORMINORMICRO@_la_CFLAGS = $(AM_CFLAGS)
 libpulsecommon_ at PA_MAJORMINORMICRO@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
 libpulsecommon_ at PA_MAJORMINORMICRO@_la_LIBADD = $(AM_LIBADD) $(LIBWRAP_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV)
 
+# proplist-util.h uses these header files, but not the library itself!
+libpulsecommon_ at PA_MAJORMINORMICRO@_la_CFLAGS += $(GLIB20_CFLAGS) $(GTK20_CFLAGS)
+
 ## Please note that libpulsecommon implicitly also depends on<
 ## libpulse! i.e. we have a cyclic dependancy here. Which is intended
 ## since libpulse only includes stable, official APIs, while
diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c
index ae8e080..bdae0e6 100644
--- a/src/pulsecore/proplist-util.c
+++ b/src/pulsecore/proplist-util.c
@@ -34,6 +34,7 @@
 extern char **environ;
 #endif
 
+#include <pulse/gccmacro.h>
 #include <pulse/proplist.h>
 #include <pulse/utf8.h>
 #include <pulse/xmalloc.h>
@@ -41,8 +42,64 @@ extern char **environ;
 
 #include <pulsecore/core-util.h>
 
+#if defined(HAVE_GLIB) && defined(PA_GCC_WEAKREF)
+#include <glib.h>
+static G_CONST_RETURN gchar* _g_get_application_name(void) PA_GCC_WEAKREF(g_get_application_name);
+#endif
+
+#if defined(HAVE_GTK) && defined(PA_GCC_WEAKREF)
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+static G_CONST_RETURN gchar* _gtk_window_get_default_icon_name(void) PA_GCC_WEAKREF(gtk_window_get_default_icon_name);
+static Display *_gdk_display PA_GCC_WEAKREF(gdk_display);
+#endif
+
 #include "proplist-util.h"
 
+static void add_glib_properties(pa_proplist *p) {
+
+#if defined(HAVE_GLIB) && defined(PA_GCC_WEAKREF)
+
+    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME))
+        if (_g_get_application_name) {
+            const gchar *t;
+
+            /* We ignore the tiny race condition here. */
+
+            if ((t = _g_get_application_name()))
+                pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, t);
+        }
+
+#endif
+}
+
+static void add_gtk_properties(pa_proplist *p) {
+
+#if defined(HAVE_GTK) && defined(PA_GCC_WEAKREF)
+
+    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_ICON_NAME))
+        if (_gtk_window_get_default_icon_name) {
+            const gchar *t;
+
+            /* We ignore the tiny race condition here. */
+
+            if ((t = _gtk_window_get_default_icon_name()))
+                pa_proplist_sets(p, PA_PROP_APPLICATION_ICON_NAME, t);
+        }
+
+    if (!pa_proplist_contains(p, PA_PROP_WINDOW_X11_DISPLAY))
+        if (&_gdk_display && _gdk_display) {
+            const char *t;
+
+            /* We ignore the tiny race condition here. */
+
+            if ((t = DisplayString(_gdk_display)))
+                pa_proplist_sets(p, PA_PROP_WINDOW_X11_DISPLAY, t);
+        }
+
+#endif
+}
+
 void pa_init_proplist(pa_proplist *p) {
     char **e;
     const char *pp;
@@ -135,20 +192,8 @@ void pa_init_proplist(pa_proplist *p) {
         }
     }
 
-#ifdef RTLD_NOLOAD
-    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) {
-        void *dl;
-
-        if ((dl = dlopen("libglib-2.0", RTLD_NOLOAD))) {
-            const char *(*_g_get_application_name)(void);
-
-            if ((*(void**) &_g_get_application_name = dlsym(dl, "g_get_application_name")))
-                pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, _g_get_application_name());
-
-            dlclose(dl);
-        }
-    }
-#endif
+    add_glib_properties(p);
+    add_gtk_properties(p);
 
     if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) {
         const char *t;
diff --git a/src/tests/gtk-test.c b/src/tests/gtk-test.c
new file mode 100644
index 0000000..a2d3e69
--- /dev/null
+++ b/src/tests/gtk-test.c
@@ -0,0 +1,62 @@
+/***
+  This file is part of PulseAudio.
+
+  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.
+
+  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 PulseAudio; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <pulse/context.h>
+#include <pulse/glib-mainloop.h>
+
+int main(int argc, char *argv[]) {
+
+    pa_context *c;
+    pa_glib_mainloop *m;
+    GtkWidget *window;
+    int r;
+
+    gtk_init(&argc, &argv);
+
+    g_set_application_name("This is a test");
+    gtk_window_set_default_icon_name("foobar");
+    g_setenv("PULSE_PROP_media.role", "phone", TRUE);
+
+    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title(GTK_WINDOW (window), g_get_application_name());
+    gtk_widget_show_all(window);
+
+    m = pa_glib_mainloop_new(NULL);
+    g_assert(m);
+
+    c = pa_context_new(pa_glib_mainloop_get_api(m), NULL);
+    g_assert(c);
+
+    r = pa_context_connect(c, NULL, 0, NULL);
+    g_assert(r == 0);
+
+    gtk_main();
+
+    pa_context_unref(c);
+    pa_glib_mainloop_free(m);
+
+    return 0;
+}

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list