rpms/libcanberra/devel ac5ac9e486aa33f7be0cd9ddd315c03780676795.patch, NONE, 1.1 libcanberra.spec, 1.23, 1.24

Lennart Poettering lennart at fedoraproject.org
Wed Apr 1 00:32:18 UTC 2009


Author: lennart

Update of /cvs/pkgs/rpms/libcanberra/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8489

Modified Files:
	libcanberra.spec 
Added Files:
	ac5ac9e486aa33f7be0cd9ddd315c03780676795.patch 
Log Message:
Another preview for 0.12

ac5ac9e486aa33f7be0cd9ddd315c03780676795.patch:

--- NEW FILE ac5ac9e486aa33f7be0cd9ddd315c03780676795.patch ---
diff --git a/Makefile.am b/Makefile.am
index 507a02f..8db04da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
 dist_doc_DATA = README
 
 EXTRA_DIST = bootstrap.sh autogen.sh LGPL libcanberra.schemas
-SUBDIRS = libltdl src gtkdoc doc
+SUBDIRS = src gtkdoc doc
 
 MAINTAINERCLEANFILES = README
 noinst_DATA = README
@@ -51,7 +51,7 @@ ACLOCAL_AMFLAGS = -I m4
 README:
 	rm -f README
 	$(MAKE) -C doc README
-	cd $(srcdir) && ln -s doc/README README
+	ln -s doc/README README
 
 homepage: all dist
 	test -d $$HOME/homepage/private
diff --git a/bootstrap.sh b/bootstrap.sh
index abeb4f6..29d356f 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -18,7 +18,7 @@
 # License along with libcanberra. If not, see
 # <http://www.gnu.org/licenses/>.
 
-VERSION=1.9
+VERSION=1.10
 
 run_versioned() {
     local P
@@ -42,6 +42,15 @@ run_versioned() {
 
 set -ex
 
+# We check for this here, because if pkg-config is not found in the
+# system, it's likely that the pkg.m4 macro file is also not present,
+# which will make PKG_PROG_PKG_CONFIG be undefined and the generated
+# configure file faulty.
+if ! pkg-config --version &>/dev/null; then
+    echo "pkg-config is required to bootstrap this program" &>/dev/null
+    exit 1
+fi
+
 if [ "x$1" = "xam" ] ; then
     run_versioned automake "$VERSION" -a -c --foreign
     ./config.status
@@ -54,7 +63,7 @@ else
 
     mkdir -p m4
     gtkdocize --copy --flavour no-tmpl --docdir gtkdoc
-    "$LIBTOOLIZE" -c --force --ltdl --recursive
+    "$LIBTOOLIZE" -c --force --recursive
     run_versioned aclocal "$VERSION" -I m4
     run_versioned autoconf 2.63 -Wall
     run_versioned autoheader 2.63
diff --git a/configure.ac b/configure.ac
index 3f1a841..51dc305 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@
 
 AC_PREREQ(2.63)
 
-AC_INIT([libcanberra], 0.11, [mzyvopnaoreen (at) 0pointer (dot) de])
+AC_INIT([libcanberra],[0.11],[mzyvopnaoreen (at) 0pointer (dot) de])
 AC_CONFIG_SRCDIR([src/common.c])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR(m4)
@@ -65,9 +65,32 @@ done
 
 #### libtool stuff ####
 LT_PREREQ(2.2)
-LT_CONFIG_LTDL_DIR([libltdl])
 LT_INIT([dlopen win32-dll disable-static])
-LTDL_INIT([convenience recursive])
+
+dnl Unfortunately, even up to libtool 2.2.6a there is no way to know
+dnl exactly which version of libltdl is present in the system, so we
+dnl just assume that it's a working version as long as we have the
+dnl library and the header files.
+dnl
+dnl As an extra safety device, check for lt_dladvise_init() which is
+dnl only implemented in libtool 2.x, and refine as we go if we have
+dnl refined requirements.
+dnl
+dnl Check the header files first since the system may have a
+dnl libltdl.so for runtime, but no headers, and we want to bail out as
+dnl soon as possible.
+dnl
+dnl We don't need any special variable for this though, since the user
+dnl can give the proper place to find libltdl through the standard
+dnl variables like LDFLAGS and CPPFLAGS.
+
+AC_CHECK_HEADER([ltdl.h],
+    [AC_CHECK_LIB([ltdl], [lt_dladvise_init], [LIBLTDL=-lltdl], [LIBLTDL=])],
+    [LIBLTDL=])
+
+AS_IF([test "x$LIBLTDL" = "x"],
+    [AC_MSG_ERROR([Unable to find libltdl.])])
+AC_SUBST([LIBLTDL])
 
 #### Determine build environment ####
 
@@ -109,7 +132,6 @@ AC_TYPE_SIZE_T
 AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
     [Define ssize_t if it is not done by the standard libs.])])
 AC_TYPE_OFF_T
-AC_TYPE_SIGNAL
 AC_TYPE_UID_T
 
 #### Check for libs ####
@@ -158,20 +180,12 @@ AM_ICONV
 
 #### pkg-config ####
 
-# Check for pkg-config manually first, as if its not installed the
-# PKG_PROG_PKG_CONFIG macro won't be defined.
-AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
-
-if test x"$have_pkg_config" = "xno"; then
-    AC_MSG_ERROR(pkg-config is required to install this program)
-fi
-
 PKG_PROG_PKG_CONFIG
 
 #### ALSA support (optional) ####
 
 AC_ARG_ENABLE([alsa],
-    AC_HELP_STRING([--disable-alsa], [Disable optional ALSA support]),
+    AS_HELP_STRING([--disable-alsa], [Disable optional ALSA support]),
         [
             case "${enableval}" in
                 yes) alsa=yes ;;
@@ -203,7 +217,7 @@ AC_SUBST(ALSA_LIBS)
 ### OSS support (optional) ###
 
 AC_ARG_ENABLE([oss],
-    AC_HELP_STRING([--disable-oss], [Disable optional OSS support]),
+    AS_HELP_STRING([--disable-oss], [Disable optional OSS support]),
         [
             case "${enableval}" in
                 yes) oss=yes ;;
@@ -233,7 +247,7 @@ fi
 ### PulseAudio (optional) ####
 
 AC_ARG_ENABLE([pulse],
-    AC_HELP_STRING([--disable-pulse], [Disable optional PulseAudio support]),
+    AS_HELP_STRING([--disable-pulse], [Disable optional PulseAudio support]),
         [
             case "${enableval}" in
                 yes) pulse=yes ;;
@@ -274,7 +288,7 @@ AC_SUBST(PULSE_LIBS)
 #### GStreamer support (optional) ####
 
 AC_ARG_ENABLE([gstreamer],
-    AC_HELP_STRING([--disable-gstreamer], [Disable optional GStreamer support]),
+    AS_HELP_STRING([--disable-gstreamer], [Disable optional GStreamer support]),
         [
             case "${enableval}" in
                 yes) gstreamer=yes ;;
@@ -306,7 +320,7 @@ AC_SUBST(GSTREAMER_LIBS)
 ### Null output (optional) ####
 
 AC_ARG_ENABLE([null],
-    AC_HELP_STRING([--disable-null], [Disable optional null output]),
+    AS_HELP_STRING([--disable-null], [Disable optional null output]),
         [
             case "${enableval}" in
                 yes) null=yes ;;
@@ -326,7 +340,7 @@ fi
 ### GTK (optional) ####
 
 AC_ARG_ENABLE([gtk],
-    AC_HELP_STRING([--disable-gtk], [Disable optional GTK+ support]),
+    AS_HELP_STRING([--disable-gtk], [Disable optional GTK+ support]),
         [
             case "${enableval}" in
                 yes) gtk=yes ;;
@@ -368,7 +382,7 @@ AM_CONDITIONAL([HAVE_GTK], [test "x$HAVE_GTK" = x1])
 #### TDB cache support (optional) ####
 
 AC_ARG_ENABLE([tdb],
-    AC_HELP_STRING([--disable-tdb], [Disable optional tdb support]),
+    AS_HELP_STRING([--disable-tdb], [Disable optional tdb support]),
         [
             case "${enableval}" in
                 yes) tdb=yes ;;
@@ -415,7 +429,7 @@ fi
 ### LYNX documentation generation ###
 
 AC_ARG_ENABLE([lynx],
-        AC_HELP_STRING([--disable-lynx], [Turn off lynx usage for documentation generation]),
+        AS_HELP_STRING([--disable-lynx], [Turn off lynx usage for documentation generation]),
                 [
                         case "${enableval}" in
                                 yes) lynx=yes ;;
@@ -561,7 +575,6 @@ GTK_DOC_CHECK(1.9)
 
 AC_CONFIG_FILES([
 Makefile
-libltdl/Makefile
 src/Makefile
 libcanberra.pc
 libcanberra-gtk.pc
diff --git a/doc/README.html.in b/doc/README.html.in
index d4a3edf..9b9cf04 100644
--- a/doc/README.html.in
+++ b/doc/README.html.in
@@ -10,7 +10,7 @@
 <body>
 <h1><a name="top">libcanberra @PACKAGE_VERSION@</a></h1>
 
-<p><i>Copyright 2008 Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;</i></p>
+<p><i>Copyright 2008-2009 Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;</i></p>
 
 <ul class="toc">
     <li><a href="#license">License</a></li>
diff --git a/src/Makefile.am b/src/Makefile.am
index d1b4d89..e40ec1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,8 @@ libcanberra_la_SOURCES = \
 	sound-theme-spec.c sound-theme-spec.h \
 	llist.h \
 	macro.h macro.c \
-	malloc.c malloc.h
+	malloc.c malloc.h \
+	fork-detect.c fork-detect.h
 libcanberra_la_CFLAGS = \
 	$(AM_CFLAGS) \
 	$(VORBIS_CFLAGS)
@@ -85,8 +86,6 @@ if BUILTIN_DSO
 libcanberra_la_SOURCES += \
 	dso.c \
 	driver-order.c driver-order.h
-libcanberra_la_CFLAGS += \
-	$(LTDLINCL)
 libcanberra_la_LIBADD += \
 	$(LIBLTDL)
 
diff --git a/src/canberra-gtk-module.c b/src/canberra-gtk-module.c
index b9d8ae0..302eeb4 100644
--- a/src/canberra-gtk-module.c
+++ b/src/canberra-gtk-module.c
@@ -647,11 +647,15 @@ static gboolean idle_cb(void *userdata) {
     return FALSE;
 }
 
+static void connect_settings(void);
+
 static gboolean emission_hook_cb(GSignalInvocationHint *hint, guint n_param_values, const GValue *param_values, gpointer data) {
     static SoundEventData *d = NULL;
     GdkEvent *e;
     GObject *object;
 
+    connect_settings();
+
     if (disabled)
         return TRUE;
 
@@ -719,15 +723,15 @@ static void enable_input_feedback_sounds_changed(GtkSettings *s, GParamSpec *arg
     read_enable_input_feedback_sounds(s);
 }
 
-G_MODULE_EXPORT void gtk_module_init(gint *argc, gchar ***argv[]) {
+static void connect_settings(void) {
     GtkSettings *s;
+    static gboolean connected = FALSE;
 
-    /* This is the same quark libgnomeui uses! */
-    disable_sound_quark = g_quark_from_string("gnome_disable_sound_events");
-    was_hidden_quark = g_quark_from_string("canberra_was_hidden");
+    if (connected)
+        return;
 
-    /* Hook up the gtk setting */
-    s = gtk_settings_get_default();
+    if (!(s = gtk_settings_get_default()))
+        return;
 
     if (g_object_class_find_property(G_OBJECT_GET_CLASS(s), "gtk-enable-input-feedback-sounds")) {
         g_signal_connect(G_OBJECT(s), "notify::gtk-enable-input-feedback-sounds", G_CALLBACK(enable_input_feedback_sounds_changed), NULL);
@@ -735,6 +739,18 @@ G_MODULE_EXPORT void gtk_module_init(gint *argc, gchar ***argv[]) {
     } else
         g_debug("This Gtk+ version doesn't have the GtkSettings::gtk-enable-input-feedback-sounds property.");
 
+    connected = TRUE;
+}
+
+G_MODULE_EXPORT void gtk_module_init(gint *argc, gchar ***argv[]) {
+
+    /* This is the same quark libgnomeui uses! */
+    disable_sound_quark = g_quark_from_string("gnome_disable_sound_events");
+    was_hidden_quark = g_quark_from_string("canberra_was_hidden");
+
+    /* Hook up the gtk setting */
+    connect_settings();
+
     install_hook(GTK_TYPE_WINDOW, "show", &signal_id_widget_show);
     install_hook(GTK_TYPE_WINDOW, "hide", &signal_id_widget_hide);
     install_hook(GTK_TYPE_DIALOG, "response", &signal_id_dialog_response);
@@ -749,7 +765,6 @@ G_MODULE_EXPORT void gtk_module_init(gint *argc, gchar ***argv[]) {
     install_hook(GTK_TYPE_ICON_VIEW, "selection-changed", &signal_id_icon_view_selection_changed);
 }
 
-
 G_MODULE_EXPORT gchar* g_module_check_init(GModule *module);
 
 G_MODULE_EXPORT gchar* g_module_check_init(GModule *module) {
diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c
index 70b8d7e..cb36a0f 100644
--- a/src/canberra-gtk.c
+++ b/src/canberra-gtk.c
@@ -31,6 +31,7 @@
 #include "common.h"
 #include "malloc.h"
 #include "proplist.h"
+#include "fork-detect.h"
 
 /**
  * SECTION:canberra-gtk
@@ -93,7 +94,8 @@ ca_context *ca_gtk_context_get(void) {
     if ((c = g_static_private_get(&context_private)))
         return c;
 
-    ca_assert_se(ca_context_create(&c) == CA_SUCCESS);
+    if (ca_context_create(&c) != CA_SUCCESS)
+        return NULL;
 
     if ((name = g_get_application_name()))
         ca_context_change_props(c, CA_PROP_APPLICATION_NAME, name, NULL);
@@ -154,6 +156,7 @@ int ca_gtk_proplist_set_for_widget(ca_proplist *p, GtkWidget *widget) {
 
     ca_return_val_if_fail(p, CA_ERROR_INVALID);
     ca_return_val_if_fail(widget, CA_ERROR_INVALID);
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
 
     if (!(w = get_toplevel(widget)))
         return CA_ERROR_INVALID;
@@ -224,6 +227,7 @@ int ca_gtk_proplist_set_for_event(ca_proplist *p, GdkEvent *e) {
 
     ca_return_val_if_fail(p, CA_ERROR_INVALID);
     ca_return_val_if_fail(e, CA_ERROR_INVALID);
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
 
     if ((gw = e->any.window)) {
         gdk_window_get_user_data(gw, (gpointer*) &w);
@@ -297,6 +301,7 @@ int ca_gtk_play_for_widget(GtkWidget *w, uint32_t id, ...) {
     ca_proplist *p;
 
     ca_return_val_if_fail(w, CA_ERROR_INVALID);
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
 
     if ((ret = ca_proplist_create(&p)) < 0)
         return ret;
@@ -346,6 +351,7 @@ int ca_gtk_play_for_event(GdkEvent *e, uint32_t id, ...) {
     ca_proplist *p;
 
     ca_return_val_if_fail(e, CA_ERROR_INVALID);
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
 
     if ((ret = ca_proplist_create(&p)) < 0)
         return ret;
diff --git a/src/canberra.h b/src/canberra.h
index ff09146..9664ef2 100644
--- a/src/canberra.h
+++ b/src/canberra.h
@@ -414,7 +414,8 @@ enum {
     CA_ERROR_IO = -14,
     CA_ERROR_INTERNAL = -15,
     CA_ERROR_DISABLED = -16,
-    _CA_ERROR_MAX = -17
+    CA_ERROR_FORKED = -17,
+    _CA_ERROR_MAX = -18
 };
 
 /**
diff --git a/src/common.c b/src/common.c
index e1445f4..ac8b982 100644
--- a/src/common.c
+++ b/src/common.c
@@ -30,6 +30,7 @@
 #include "driver.h"
 #include "proplist.h"
 #include "macro.h"
+#include "fork-detect.h"
 
 /**
  * SECTION:canberra
@@ -127,6 +128,7 @@ int ca_context_create(ca_context **_c) {
     int ret;
     const char *d;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(_c, CA_ERROR_INVALID);
 
     if (!(c = ca_new0(ca_context, 1)))
@@ -171,6 +173,7 @@ int ca_context_create(ca_context **_c) {
 int ca_context_destroy(ca_context *c) {
     int ret = CA_SUCCESS;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
 
     /* There's no locking necessary here, because the application is
@@ -209,6 +212,7 @@ int ca_context_set_driver(ca_context *c, const char *driver) {
     char *n;
     int ret;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_mutex_lock(c->mutex);
     ca_return_val_if_fail_unlock(!c->opened, CA_ERROR_STATE, c->mutex);
@@ -250,6 +254,7 @@ int ca_context_change_device(ca_context *c, const char *device) {
     char *n;
     int ret;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_mutex_lock(c->mutex);
 
@@ -277,6 +282,7 @@ fail:
 static int context_open_unlocked(ca_context *c) {
     int ret;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
 
     if (c->opened)
@@ -302,6 +308,7 @@ static int context_open_unlocked(ca_context *c) {
 int ca_context_open(ca_context *c) {
     int ret;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_mutex_lock(c->mutex);
     ca_return_val_if_fail_unlock(!c->opened, CA_ERROR_STATE, c->mutex);
@@ -336,6 +343,7 @@ int ca_context_change_props(ca_context *c, ...)  {
     int ret;
     ca_proplist *p = NULL;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
 
     va_start(ap, c);
@@ -368,6 +376,7 @@ int ca_context_change_props_full(ca_context *c, ca_proplist *p) {
     int ret;
     ca_proplist *merged;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_return_val_if_fail(p, CA_ERROR_INVALID);
 
@@ -438,6 +447,7 @@ int ca_context_play(ca_context *c, uint32_t id, ...) {
     va_list ap;
     ca_proplist *p = NULL;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
 
     va_start(ap, id);
@@ -478,6 +488,7 @@ int ca_context_play_full(ca_context *c, uint32_t id, ca_proplist *p, ca_finish_c
     const char *t;
     ca_bool_t enabled = TRUE;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_return_val_if_fail(p, CA_ERROR_INVALID);
     ca_return_val_if_fail(!userdata || cb, CA_ERROR_INVALID);
@@ -532,6 +543,7 @@ finish:
 int ca_context_cancel(ca_context *c, uint32_t id)  {
     int ret;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_mutex_lock(c->mutex);
     ca_return_val_if_fail_unlock(c->opened, CA_ERROR_STATE, c->mutex);
@@ -566,6 +578,7 @@ int ca_context_cache(ca_context *c, ...) {
     va_list ap;
     ca_proplist *p = NULL;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
 
     va_start(ap, c);
@@ -599,6 +612,7 @@ int ca_context_cache(ca_context *c, ...) {
 int ca_context_cache_full(ca_context *c, ca_proplist *p) {
     int ret;
 
+    ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
     ca_return_val_if_fail(c, CA_ERROR_INVALID);
     ca_return_val_if_fail(p, CA_ERROR_INVALID);
 
@@ -648,7 +662,8 @@ const char *ca_strerror(int code) {
         [-CA_ERROR_ACCESS] = "Access forbidden",
         [-CA_ERROR_IO] = "IO error",
         [-CA_ERROR_INTERNAL] = "Internal error",
-        [-CA_ERROR_DISABLED] = "Sound disabled"
+        [-CA_ERROR_DISABLED] = "Sound disabled",
+        [-CA_ERROR_FORKED] = "Process forked"
     };
 
     ca_return_val_if_fail(code <= 0, NULL);
diff --git a/src/fork-detect.c b/src/fork-detect.c
new file mode 100644
index 0000000..622037c
--- /dev/null
+++ b/src/fork-detect.c
@@ -0,0 +1,51 @@
+/***
+  This file is part of libcanberra.
+
+  Copyright 2009 Lennart Poettering
+
+  libcanberra 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.1 of the
+  License, or (at your option) any later version.
+
+  libcanberra 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
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with libcanberra. If not, see
+  <http://www.gnu.org/licenses/>.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "fork-detect.h"
+
+int ca_detect_fork(void) {
+    static volatile pid_t pid = (pid_t) -1;
+    pid_t v;
+
+    /* Some really stupid applications (Hey, vim, that means you!)
+     * love to fork after initializing gtk/libcanberra. This is really
+     * bad style. We however have to deal with this cleanly, so we try
+     * to detect the forks making sure all our calls fail cleanly
+     * after the fork. */
+
+    /* Ideally we'd use atomic operations here, but we don't have them
+     * and this is not exactly crucial, so we don't care */
+
+    v = pid;
+
+    if (v == getpid() || v == (pid_t) -1) {
+        pid = getpid();
+        return 0;
+    }
+
+    return 1;
+}
diff --git a/src/fork-detect.h b/src/fork-detect.h
new file mode 100644
index 0000000..9050ef8
--- /dev/null
+++ b/src/fork-detect.h
@@ -0,0 +1,26 @@
+#ifndef foocanberraforkdetecth
+#define foocanberraforkdetecth
+
+/***
+  This file is part of libcanberra.
+
+  Copyright 2009 Lennart Poettering
+
+  libcanberra 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.1 of the
+  License, or (at your option) any later version.
+
+  libcanberra 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
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with libcanberra. If not, see
+  <http://www.gnu.org/licenses/>.
+***/
+
+int ca_detect_fork(void);
+
+#endif
diff --git a/src/map-file b/src/map-file
index 2265ed0..902252a 100644
--- a/src/map-file
+++ b/src/map-file
@@ -7,4 +7,7 @@ driver_change_props;
 driver_destroy;
 driver_open;
 driver_play;
+lt_*;
+dlopen_*;
+preopen_*;
 };
diff --git a/src/pulse.c b/src/pulse.c
index 11d6e52..ed371de 100644
--- a/src/pulse.c
+++ b/src/pulse.c
@@ -166,12 +166,27 @@ static int translate_error(int error) {
         [PA_ERR_BADSTATE]             = CA_ERROR_STATE,
         [PA_ERR_NODATA]               = CA_ERROR_IO,
         [PA_ERR_VERSION]              = CA_ERROR_NOTSUPPORTED,
-        [PA_ERR_TOOLARGE]             = CA_ERROR_TOOBIG
+        [PA_ERR_TOOLARGE]             = CA_ERROR_TOOBIG,
+#ifdef PA_ERR_NOTSUPPORTED
+        [PA_ERR_NOTSUPPORTED]         = CA_ERROR_NOTSUPPORTED,
+#endif
+#ifdef PA_ERR_UNKNOWN
+        [PA_ERR_UNKNOWN]              = CA_ERROR_IO,
+#endif
+#ifdef PA_ERR_NOEXTENSION
+        [PA_ERR_NOEXTENSION]          = CA_ERROR_NOTSUPPORTED,
+#endif
+#ifdef PA_ERR_OBSOLETE
+        [PA_ERR_OBSOLETE]             = CA_ERROR_NOTSUPPORTED,
+#endif
+#ifdef PA_ERR_NOTIMPLEMENTED
+        [PA_ERR_NOTIMPLEMENTED]       = CA_ERROR_NOTSUPPORTED
+#endif
     };
 
     ca_assert(error >= 0);
 
-    if (error >= PA_ERR_MAX)
+    if (error >= PA_ERR_MAX || !table[error])
         return CA_ERROR_IO;
 
     return table[error];
@@ -572,7 +587,7 @@ static void stream_write_cb(pa_stream *s, size_t bytes, void *userdata) {
             goto finish;
         }
 
-	data = NULL;
+        data = NULL;
 
         bytes -= rbytes;
     }
@@ -641,7 +656,11 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
     pa_proplist *l = NULL;
     const char *n, *vol, *ct;
     char *name = NULL;
+#if defined(PA_MAJOR) && ((PA_MAJOR > 0) || (PA_MAJOR == 0 && PA_MINOR > 9) || (PA_MAJOR == 0 && PA_MINOR == 9 && PA_MICRO >= 15))
+    pa_volume_t v = (pa_volume_t) -1;
+#else
     pa_volume_t v = PA_VOLUME_NORM;
+#endif
     pa_sample_spec ss;
     ca_cache_control_t cache_control = CA_CACHE_CONTROL_NEVER;
     struct outstanding *out = NULL;
@@ -781,7 +800,13 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
     pa_stream_set_state_callback(out->stream, stream_state_cb, out);
     pa_stream_set_write_callback(out->stream, stream_write_cb, out);
 
-    if (pa_stream_connect_playback(out->stream, NULL, NULL, 0, NULL, NULL) < 0) {
+    if (pa_stream_connect_playback(out->stream, NULL, NULL,
+#ifdef PA_STREAM_FAIL_ON_SUSPEND
+                                   PA_STREAM_FAIL_ON_SUSPEND
+#else
+                                   0
+#endif
+                                   , NULL, NULL) < 0) {
         ret = translate_error(pa_context_errno(p->context));
         pa_threaded_mainloop_unlock(p->mainloop);
         goto finish;


Index: libcanberra.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libcanberra/devel/libcanberra.spec,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- libcanberra.spec	25 Feb 2009 02:57:26 -0000	1.23
+++ libcanberra.spec	1 Apr 2009 00:31:47 -0000	1.24
@@ -1,6 +1,6 @@
 Name: libcanberra
 Version: 0.11
-Release: 8%{?dist}
+Release: 9%{?dist}
 Summary: Portable Sound Event Library
 Group: System Environment/Libraries
 Source0: http://0pointer.de/lennart/projects/libcanberra/libcanberra-%{version}.tar.gz
@@ -19,7 +19,7 @@
 BuildRequires: gettext-devel
 Requires: sound-theme-freedesktop
 Requires: pulseaudio-libs >= 0.9.15
-Patch0: febbf740799d85dfbdca965efa9867fd70fa2cfc.patch
+Patch0: ac5ac9e486aa33f7be0cd9ddd315c03780676795.patch
 
 %description
 A small and lightweight implementation of the XDG Sound Theme Specification
@@ -120,6 +120,9 @@
 %{_libdir}/pkgconfig/libcanberra.pc
 
 %changelog
+* Wed Apr 1 2009 Lennart Poettering <lpoetter at redhat.com> 0.11-9
+- Another preview for 0.12
+
 * Wed Feb 25 2009 Lennart Poettering <lpoetter at redhat.com> 0.11-8
 - Add missing dependency on gettext-devel
 




More information about the scm-commits mailing list