]> code.delx.au - pulseaudio/commitdiff
Merge commit 'origin/master-tx'
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Mar 2009 11:27:19 +0000 (12:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Mar 2009 11:27:19 +0000 (12:27 +0100)
330 files changed:
.gitignore
Makefile.am
bootstrap.sh
configure.ac
m4/shave.m4 [new file with mode: 0644]
shave-libtool.in [new file with mode: 0644]
shave.in [new file with mode: 0644]
src/Makefile.am
src/daemon/caps.c
src/daemon/caps.h
src/daemon/cmdline.c
src/daemon/cmdline.h
src/daemon/cpulimit.c
src/daemon/cpulimit.h
src/daemon/daemon-conf.c
src/daemon/daemon-conf.h
src/daemon/dumpmodules.c
src/daemon/dumpmodules.h
src/daemon/ltdl-bind-now.c
src/daemon/ltdl-bind-now.h
src/daemon/main.c
src/daemon/polkit.c
src/daemon/polkit.h
src/modules/alsa/alsa-sink.c
src/modules/alsa/alsa-sink.h
src/modules/alsa/alsa-source.c
src/modules/alsa/alsa-source.h
src/modules/alsa/alsa-util.c
src/modules/alsa/alsa-util.h
src/modules/alsa/module-alsa-card.c
src/modules/alsa/module-alsa-sink.c
src/modules/alsa/module-alsa-source.c
src/modules/bluetooth/bluetooth-util.c
src/modules/bluetooth/bluetooth-util.h
src/modules/bluetooth/ipc.h
src/modules/bluetooth/module-bluetooth-device.c
src/modules/bluetooth/module-bluetooth-discover.c
src/modules/bluetooth/module-bluetooth-proximity.c
src/modules/dbus-util.c
src/modules/dbus-util.h
src/modules/gconf/gconf-helper.c
src/modules/gconf/module-gconf.c
src/modules/hal-util.c
src/modules/hal-util.h
src/modules/module-always-sink.c
src/modules/module-augment-properties.c
src/modules/module-card-restore.c
src/modules/module-cli.c
src/modules/module-combine.c
src/modules/module-console-kit.c
src/modules/module-cork-music-on-phone.c
src/modules/module-default-device-restore.c
src/modules/module-detect.c
src/modules/module-device-restore.c
src/modules/module-esound-compat-spawnfd.c
src/modules/module-esound-compat-spawnpid.c
src/modules/module-esound-sink.c
src/modules/module-hal-detect.c
src/modules/module-jack-sink.c
src/modules/module-jack-source.c
src/modules/module-ladspa-sink.c
src/modules/module-lirc.c
src/modules/module-match.c
src/modules/module-mmkbd-evdev.c
src/modules/module-native-protocol-fd.c
src/modules/module-null-sink.c
src/modules/module-pipe-sink.c
src/modules/module-pipe-source.c
src/modules/module-position-event-sounds.c
src/modules/module-protocol-stub.c
src/modules/module-raop-discover.c
src/modules/module-raop-sink.c
src/modules/module-remap-sink.c
src/modules/module-rescue-streams.c
src/modules/module-sine-source.c
src/modules/module-sine.c
src/modules/module-solaris.c
src/modules/module-stream-restore.c
src/modules/module-suspend-on-idle.c
src/modules/module-tunnel.c
src/modules/module-volume-restore.c
src/modules/module-waveout.c
src/modules/module-x11-bell.c
src/modules/module-x11-cork-request.c
src/modules/module-x11-publish.c
src/modules/module-x11-xsmp.c
src/modules/module-zeroconf-discover.c
src/modules/module-zeroconf-publish.c
src/modules/oss/module-oss.c
src/modules/oss/oss-util.c
src/modules/oss/oss-util.h
src/modules/raop/base64.c
src/modules/raop/base64.h
src/modules/raop/raop_client.c
src/modules/raop/raop_client.h
src/modules/reserve-wrap.c
src/modules/reserve-wrap.h
src/modules/reserve.h
src/modules/rtp/module-rtp-recv.c
src/modules/rtp/module-rtp-send.c
src/modules/rtp/rtp.c
src/modules/rtp/rtp.h
src/modules/rtp/rtsp_client.c
src/modules/rtp/rtsp_client.h
src/modules/rtp/sap.c
src/modules/rtp/sap.h
src/modules/rtp/sdp.c
src/modules/rtp/sdp.h
src/modules/udev-util.c [new file with mode: 0644]
src/modules/udev-util.h [new file with mode: 0644]
src/pulse/browser.c
src/pulse/browser.h
src/pulse/cdecl.h
src/pulse/channelmap.c
src/pulse/channelmap.h
src/pulse/client-conf-x11.c
src/pulse/client-conf-x11.h
src/pulse/client-conf.c
src/pulse/client-conf.h
src/pulse/context.c
src/pulse/context.h
src/pulse/def.h
src/pulse/error.c
src/pulse/error.h
src/pulse/ext-stream-restore.c
src/pulse/ext-stream-restore.h
src/pulse/fork-detect.c [new file with mode: 0644]
src/pulse/fork-detect.h [new file with mode: 0644]
src/pulse/gccmacro.h
src/pulse/glib-mainloop.c
src/pulse/glib-mainloop.h
src/pulse/internal.h
src/pulse/introspect.c
src/pulse/introspect.h
src/pulse/mainloop-signal.c
src/pulse/mainloop-signal.h
src/pulse/mainloop.c
src/pulse/mainloop.h
src/pulse/operation.c
src/pulse/operation.h
src/pulse/proplist.h
src/pulse/sample.c
src/pulse/sample.h
src/pulse/scache.c
src/pulse/scache.h
src/pulse/simple.c
src/pulse/simple.h
src/pulse/stream.c
src/pulse/stream.h
src/pulse/subscribe.c
src/pulse/subscribe.h
src/pulse/thread-mainloop.c
src/pulse/thread-mainloop.h
src/pulse/volume.c
src/pulse/volume.h
src/pulse/xmalloc.c
src/pulse/xmalloc.h
src/pulsecore/atomic.h
src/pulsecore/auth-cookie.c
src/pulsecore/auth-cookie.h
src/pulsecore/avahi-wrap.c
src/pulsecore/avahi-wrap.h
src/pulsecore/bitset.c
src/pulsecore/bitset.h
src/pulsecore/card.c
src/pulsecore/card.h
src/pulsecore/cli-command.c
src/pulsecore/cli-command.h
src/pulsecore/cli-text.c
src/pulsecore/cli-text.h
src/pulsecore/cli.c
src/pulsecore/cli.h
src/pulsecore/client.c
src/pulsecore/client.h
src/pulsecore/conf-parser.c
src/pulsecore/conf-parser.h
src/pulsecore/core-error.c
src/pulsecore/core-error.h
src/pulsecore/core-scache.c
src/pulsecore/core-scache.h
src/pulsecore/core-subscribe.c
src/pulsecore/core-subscribe.h
src/pulsecore/core-util.c
src/pulsecore/core.c
src/pulsecore/core.h
src/pulsecore/dllmain.c
src/pulsecore/endianmacros.h
src/pulsecore/esound.h
src/pulsecore/ffmpeg/resample2.c
src/pulsecore/flist.h
src/pulsecore/hashmap.c
src/pulsecore/hashmap.h
src/pulsecore/hook-list.c
src/pulsecore/hook-list.h
src/pulsecore/ioline.c
src/pulsecore/ioline.h
src/pulsecore/llist.h
src/pulsecore/lock-autospawn.c
src/pulsecore/log.c
src/pulsecore/log.h
src/pulsecore/ltdl-helper.c
src/pulsecore/ltdl-helper.h
src/pulsecore/macro.h
src/pulsecore/memblockq.c
src/pulsecore/memblockq.h
src/pulsecore/modargs.c
src/pulsecore/modargs.h
src/pulsecore/modinfo.c
src/pulsecore/modinfo.h
src/pulsecore/module.c
src/pulsecore/module.h
src/pulsecore/msgobject.c
src/pulsecore/msgobject.h
src/pulsecore/mutex-posix.c
src/pulsecore/mutex-win32.c
src/pulsecore/mutex.h
src/pulsecore/namereg.c
src/pulsecore/namereg.h
src/pulsecore/object.c
src/pulsecore/object.h
src/pulsecore/once.c
src/pulsecore/once.h
src/pulsecore/pid.c
src/pulsecore/pid.h
src/pulsecore/pipe.c
src/pulsecore/pipe.h
src/pulsecore/play-memblockq.c
src/pulsecore/play-memblockq.h
src/pulsecore/play-memchunk.c
src/pulsecore/play-memchunk.h
src/pulsecore/poll.c
src/pulsecore/poll.h
src/pulsecore/prioq.c
src/pulsecore/protocol-cli.c
src/pulsecore/protocol-cli.h
src/pulsecore/protocol-esound.c
src/pulsecore/protocol-esound.h
src/pulsecore/protocol-http.c
src/pulsecore/protocol-http.h
src/pulsecore/protocol-native.c
src/pulsecore/protocol-native.h
src/pulsecore/protocol-simple.c
src/pulsecore/protocol-simple.h
src/pulsecore/ratelimit.c
src/pulsecore/ratelimit.h
src/pulsecore/refcnt.h
src/pulsecore/resampler.c
src/pulsecore/resampler.h
src/pulsecore/rtclock.c
src/pulsecore/sample-util.c
src/pulsecore/sample-util.h
src/pulsecore/sconv-s16be.c
src/pulsecore/sconv-s16be.h
src/pulsecore/sconv-s16le.c
src/pulsecore/sconv-s16le.h
src/pulsecore/sconv.c
src/pulsecore/sconv.h
src/pulsecore/semaphore-posix.c
src/pulsecore/semaphore-win32.c
src/pulsecore/semaphore.h
src/pulsecore/shared.c
src/pulsecore/shared.h
src/pulsecore/sink-input.c
src/pulsecore/sink-input.h
src/pulsecore/sink.c
src/pulsecore/sink.h
src/pulsecore/sioman.c
src/pulsecore/sioman.h
src/pulsecore/socket-server.c
src/pulsecore/socket-server.h
src/pulsecore/socket-util.c
src/pulsecore/socket-util.h
src/pulsecore/sound-file-stream.c
src/pulsecore/sound-file-stream.h
src/pulsecore/sound-file.c
src/pulsecore/sound-file.h
src/pulsecore/source-output.c
src/pulsecore/source-output.h
src/pulsecore/source.c
src/pulsecore/source.h
src/pulsecore/strbuf.c
src/pulsecore/strbuf.h
src/pulsecore/strlist.c
src/pulsecore/strlist.h
src/pulsecore/thread-posix.c
src/pulsecore/thread-win32.c
src/pulsecore/thread.h
src/pulsecore/tokenizer.c
src/pulsecore/tokenizer.h
src/pulsecore/vector.h
src/pulsecore/x11prop.c
src/pulsecore/x11prop.h
src/pulsecore/x11wrap.c
src/pulsecore/x11wrap.h
src/tests/asyncmsgq-test.c
src/tests/asyncq-test.c
src/tests/cpulimit-test.c
src/tests/envelope-test.c
src/tests/flist-test.c
src/tests/get-binary-name-test.c
src/tests/gtk-test.c
src/tests/interpol-test.c
src/tests/lock-autospawn-test.c
src/tests/mainloop-test.c
src/tests/memblock-test.c
src/tests/memblockq-test.c
src/tests/mix-test.c
src/tests/pacat-simple.c
src/tests/parec-simple.c
src/tests/proplist-test.c
src/tests/queue-test.c
src/tests/remix-test.c
src/tests/resampler-test.c
src/tests/rtpoll-test.c
src/tests/rtstutter.c
src/tests/sig2str-test.c
src/tests/smoother-test.c
src/tests/stripnul.c
src/tests/sync-playback.c
src/tests/thread-mainloop-test.c
src/tests/thread-test.c
src/tests/vector-test.c
src/utils/pabrowse.c
src/utils/pacat.c
src/utils/pacmd.c
src/utils/pactl.c
src/utils/padsp.c
src/utils/paplay.c
src/utils/pasuspender.c
src/utils/pax11publish.c

index f869d72d16a2e081694d0175094353193c28f817..e2a5091d5e34d3092ebf67fc824830964998581b 100644 (file)
@@ -1,3 +1,6 @@
+shave
+shave-libtool
+.*.swp
 ABOUT-NLS
 intltool-extract.in
 intltool-merge.in
index 8735d312be5cb4cda822b9d5203609c1fb6e72dd..9a3ca7b719d7d80a87b03460bb528eda71fa077a 100644 (file)
@@ -61,6 +61,12 @@ dist-hook:
                ( git-changelog.perl || echo "git-changelog.perl failed." ) > ${distdir}/ChangeLog 2>&1 ; \
        fi
 
+update-shave:
+       for i in shave.in shave.m4 shave-libtool.in; do \
+               wget -O $$i http://git.lespiau.name/cgit/shave/blob/\?path=shave/$$i ; \
+       done
+       mv shave.m4 m4/
+
 .PHONY: homepage distcleancheck doxygen
 
 DISTCLEANFILES = \
index e64f3426d330b494ff8ba9d333e7c2941096a29d..cb74121e45261755a33f12a34868fa5fbaa48e5f 100755 (executable)
@@ -49,6 +49,10 @@ if ! pkg-config --version &>/dev/null; then
     exit 1
 fi
 
+if type -p colorgcc > /dev/null ; then
+   export CC=colorgcc
+fi
+
 if [ "x$1" = "xam" ] ; then
     run_versioned automake "$VERSION" -a -c --foreign
     ./config.status
@@ -58,7 +62,7 @@ else
 
     rm -f Makefile.am~ configure.ac~
     # Evil, evil, evil, evil hack
-    sed 's/read dummy/\#/' `which gettextize` | sh -s -- --copy --force
+    sed 's/read dummy/\#/' `which gettextize` | bash -s -- --copy --force
     test -f Makefile.am~ && mv Makefile.am~ Makefile.am
     test -f configure.ac~ && mv configure.ac~ configure.ac
 
@@ -73,7 +77,7 @@ else
     run_versioned automake "$VERSION" --copy --foreign --add-missing
 
     if test "x$NOCONFIGURE" = "x"; then
-        CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var --enable-force-preopen "$@"
+        CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var --enable-force-preopen --enable-shave "$@"
         make clean
     fi
 fi
index 11b091bb49f9924494af504726df423a6ac9362a..049589d457b0d7dba39221879c6dbe5837268c48 100644 (file)
@@ -26,7 +26,7 @@ m4_define(pa_major, [0])
 m4_define(pa_minor, [9])
 m4_define(pa_micro, [15])
 
-AC_INIT([pulseaudio],[pa_major.pa_minor.pa_micro-test2],[mzchyfrnhqvb (at) 0pointer (dot) net])
+AC_INIT([pulseaudio],[pa_major.pa_minor.pa_micro-test3],[mzchyfrnhqvb (at) 0pointer (dot) net])
 AC_CONFIG_SRCDIR([src/daemon/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
@@ -70,8 +70,7 @@ fi
 
 case $host in
    *-*-solaris* )
-      AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
-      AC_DEFINE(_XOPEN_SOURCE,          2, Needed to get declarations for msg_control and msg_controllen on Solaris)
+      AC_DEFINE(_XOPEN_SOURCE,        600, Needed to get declarations for msg_control and msg_controllen on Solaris)
       AC_DEFINE(__EXTENSIONS__,         1, Needed to get declarations for msg_control and msg_controllen on Solaris)
       ;;
 esac
@@ -92,11 +91,20 @@ AC_USE_SYSTEM_EXTENSIONS
 
 # M4
 
-AC_PATH_PROG([M4], [m4 gm4], [no])
+AC_CHECK_PROGS([M4], gm4 m4, no)
 if test "x$M4" = xno ; then
    AC_MSG_ERROR([m4 missing])
 fi
 
+# Linker
+
+AC_PROG_LD
+AC_PROG_LD_GNU
+
+AC_SUBST(HAVE_GNU_LD)
+AM_CONDITIONAL([HAVE_GNU_LD], [test "x$HAVE_GNU_LD" = x1])
+
+
 dnl Compiler flags
 DESIRED_FLAGS="-Wall -W -Wextra -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option"
 
@@ -977,6 +985,41 @@ AC_SUBST(HAL_LIBS)
 AC_SUBST(HAVE_HAL)
 AM_CONDITIONAL([HAVE_HAL], [test "x$HAVE_HAL" = x1])
 
+#### UDEV support (optional) ####
+
+AC_ARG_ENABLE([udev],
+    AS_HELP_STRING([--disable-udev],[Disable optional UDEV support]),
+        [
+            case "${enableval}" in
+                yes) udev=yes ;;
+                no) udev=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --disable-udev) ;;
+            esac
+        ],
+        [udev=auto])
+if test "x${udev}" != xno -a \( "x$HAVE_OSS" = "x1" -o "x$HAVE_ALSA" = "x1" \) ; then
+    PKG_CHECK_MODULES(UDEV, [ libudev >= 137 ],
+        [
+            HAVE_UDEV=1
+            AC_DEFINE([HAVE_UDEV], 1, [Have UDEV.])
+        ],
+        [
+            HAVE_UDEV=0
+            if test "x$udev" = xyes ; then
+                AC_MSG_ERROR([*** UDEV support not found])
+            fi
+        ])
+else
+    HAVE_UDEV=0
+fi
+
+AC_SUBST(UDEV_CFLAGS)
+AC_SUBST(UDEV_LIBS)
+AC_SUBST(HAVE_UDEV)
+AM_CONDITIONAL([HAVE_UDEV], [test "x$HAVE_UDEV" = x1])
+
+AC_DEFINE([LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE], 1, [I know the API is subject to change.])
+
 #### BlueZ support (optional) ####
 
 AC_ARG_ENABLE([bluez],
@@ -1024,7 +1067,7 @@ if test "x$HAVE_HAL" = x1 ; then
    dbus=yes
 fi
 
-if test "x${dbus}" != xno || test "x${bluez}" != xno || "x${hal}" != xno ; then
+if test "x${dbus}" != xno || test "x${bluez}" != xno || test "x${hal}" != xno ; then
 
     PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.0.0 ],
         [
@@ -1261,6 +1304,8 @@ AM_CONDITIONAL([FORCE_PREOPEN], [test "x$FORCE_PREOPEN" = "xyes"])
 
 AC_CONFIG_FILES([
 Makefile
+shave
+shave-libtool
 src/Makefile
 man/Makefile
 libpulse.pc
@@ -1272,7 +1317,10 @@ doxygen/doxygen.conf
 src/pulse/version.h
 po/Makefile.in
 ])
+
+SHAVE_INIT
 AC_OUTPUT
+SHAVE_OUTPUT
 
 # ==========================================================================
 ENABLE_X11=no
@@ -1335,6 +1383,11 @@ if test "x$HAVE_HAL" = "x1" ; then
    ENABLE_HAL=yes
 fi
 
+ENABLE_UDEV=no
+if test "x$HAVE_UDEV" = "x1" ; then
+   ENABLE_UDEV=yes
+fi
+
 ENABLE_TCPWRAP=no
 if test "x${LIBWRAP_LIBS}" != x ; then
    ENABLE_TCPWRAP=yes
@@ -1394,6 +1447,7 @@ echo "
     Enable Async DNS:              ${ENABLE_LIBASYNCNS}
     Enable LIRC:                   ${ENABLE_LIRC}
     Enable HAL:                    ${ENABLE_HAL}
+    Enable udev:                   ${ENABLE_UDEV}
     Enable BlueZ:                  ${ENABLE_BLUEZ}
     Enable TCP Wrappers:           ${ENABLE_TCPWRAP}
     Enable libsamplerate:          ${ENABLE_LIBSAMPLERATE}
diff --git a/m4/shave.m4 b/m4/shave.m4
new file mode 100644 (file)
index 0000000..0c2c9f5
--- /dev/null
@@ -0,0 +1,73 @@
+dnl Make automake/libtool output more friendly to humans
+dnl
+dnl SHAVE_INIT([shavedir],[default_mode])
+dnl
+dnl shavedir: the directory where the shave scripts are, it defaults to
+dnl           $(top_builddir)
+dnl default_mode: (enable|disable) default shave mode.  This parameter
+dnl               controls shave's behaviour when no option has been
+dnl               given to configure.  It defaults to disable.
+dnl
+dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
+dnl   before AC_CONFIG_FILE/AC_OUTPUT is perfect.  This macro rewrites CC and
+dnl   LIBTOOL, you don't want the configure tests to have these variables
+dnl   re-defined.
+dnl * This macro requires GNU make's -s option.
+
+AC_DEFUN([_SHAVE_ARG_ENABLE],
+[
+  AC_ARG_ENABLE([shave],
+    AS_HELP_STRING(
+      [--enable-shave],
+      [use shave to make the build pretty [[default=$1]]]),,
+      [enable_shave=$1]
+    )
+])
+
+AC_DEFUN([SHAVE_INIT],
+[
+  dnl you can tweak the default value of enable_shave
+  m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
+
+  if test x"$enable_shave" = xyes; then
+    dnl where can we find the shave scripts?
+    m4_if([$1],,
+      [shavedir="$ac_pwd"],
+      [shavedir="$ac_pwd/$1"])
+    AC_SUBST(shavedir)
+
+    dnl make is now quiet
+    AC_SUBST([MAKEFLAGS], [-s])
+    AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
+
+    dnl we need sed
+    AC_CHECK_PROG(SED,sed,sed,false)
+
+    dnl substitute libtool
+    SHAVE_SAVED_LIBTOOL=$LIBTOOL
+    LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
+    AC_SUBST(LIBTOOL)
+
+    dnl substitute cc/cxx
+    SHAVE_SAVED_CC=$CC
+    SHAVE_SAVED_CXX=$CXX
+    SHAVE_SAVED_FC=$FC
+    SHAVE_SAVED_F77=$F77
+    CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
+    CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
+    FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
+    F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
+    AC_SUBST(CC)
+    AC_SUBST(CXX)
+    AC_SUBST(FC)
+    AC_SUBST(F77)
+
+    V=@
+  else
+    V=1
+  fi
+  Q='$(V:1=)'
+  AC_SUBST(V)
+  AC_SUBST(Q)
+])
+
diff --git a/shave-libtool.in b/shave-libtool.in
new file mode 100644 (file)
index 0000000..1f3a720
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# we need sed
+SED=@SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+   last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the real libtool to use
+LIBTOOL="$1"
+shift
+
+# if 1, don't print anything, the underlaying wrapper will do it
+pass_though=0
+
+# scan the arguments, keep the right ones for libtool, and discover the mode
+preserved_args=
+while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+    --mode=*)
+        mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+        preserved_args="$preserved_args $opt"
+        ;;
+    -o)
+        lt_output="$1"
+        preserved_args="$preserved_args $opt"
+       ;;
+    *)
+        preserved_args="$preserved_args $opt"
+        ;;
+      esac
+done
+
+case "$mode" in
+compile)
+    # shave will be called and print the actual CC/CXX/LINK line
+    preserved_args="$preserved_args --shave-mode=$mode"
+    pass_though=1
+    ;;
+link)
+    preserved_args="$preserved_args --shave-mode=$mode"
+    Q="  LINK  "
+    ;;
+*)
+    # let's u
+    # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
+    ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+    if test $pass_though -eq 0; then
+        echo "$Q$output"
+    fi
+    $LIBTOOL --silent $preserved_args
+else
+    echo $LIBTOOL $preserved_args
+    $LIBTOOL $preserved_args
+fi
diff --git a/shave.in b/shave.in
new file mode 100644 (file)
index 0000000..174641e
--- /dev/null
+++ b/shave.in
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# we need sed
+SED=@SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+   last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the tool to wrap (cc, cxx, ar, ranlib, ..)
+tool="$1"
+shift
+
+# the reel tool (to call)
+REEL_TOOL="$1"
+shift
+
+pass_through=0
+preserved_args=
+while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+    --shave-mode=*)
+        mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+       ;;
+    -o)
+        lt_output="$1"
+        preserved_args="$preserved_args $opt"
+       ;;
+    *)
+        preserved_args="$preserved_args $opt"
+        ;;
+      esac
+done
+
+# mode=link is handled in the libtool wrapper
+case "$mode,$tool" in
+link,*)
+    pass_through=1
+    ;;
+*,cxx)
+    Q="  CXX   "
+    ;;
+*,cc)
+    Q="  CC    "
+    ;;
+*,fc)
+    Q="  FC    "
+    ;;
+*,f77)
+    Q="  F77   "
+    ;;
+*,*)
+    # should not happen
+    Q="  CC    "
+    ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+    if test $pass_through -eq 0; then
+        echo "$Q$output"
+    fi
+    $REEL_TOOL $preserved_args
+else
+    echo $REEL_TOOL $preserved_args
+    $REEL_TOOL $preserved_args
+fi
index 1fc873537471f7d39e6edc4a34f76e6924716b03..09bd9728afdfcfc035f55bb65c23978bdfa9744d 100644 (file)
@@ -86,7 +86,7 @@ AM_LDFLAGS+=-Wl,--export-all-symbols
 WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet
 endif
 
-FOREIGN_CLFGAS = -w
+FOREIGN_CFLAGS = -w
 MODULE_LDFLAGS = -module -disable-static -avoid-version
 
 ###################################
@@ -540,6 +540,7 @@ lib_LTLIBRARIES = \
 libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES = \
                pulse/client-conf.c pulse/client-conf.h \
                pulse/i18n.c pulse/i18n.h \
+               pulse/fork-detect.c pulse/fork-detect.h \
                pulsecore/atomic.h \
                pulsecore/authkey.c pulsecore/authkey.h \
                pulsecore/conf-parser.c pulsecore/conf-parser.h \
@@ -713,8 +714,11 @@ libpulse_la_SOURCES = \
                pulse/xmalloc.c pulse/xmalloc.h
 
 libpulse_la_CFLAGS = $(AM_CFLAGS)
-libpulse_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file
 libpulse_la_LIBADD = $(AM_LIBADD) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon-@PA_MAJORMINORMICRO@.la
+libpulse_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_VERSION_INFO)
+if HAVE_GNU_LD
+libpulse_la_LDFLAGS += -Wl,-version-script=$(srcdir)/map-file
+endif
 
 if HAVE_X11
 libpulse_la_SOURCES += pulse/client-conf-x11.c pulse/client-conf-x11.h
@@ -725,17 +729,26 @@ endif
 libpulse_simple_la_SOURCES = pulse/simple.c pulse/simple.h
 libpulse_simple_la_CFLAGS = $(AM_CFLAGS)
 libpulse_simple_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la
-libpulse_simple_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_SIMPLE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file
+libpulse_simple_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_SIMPLE_VERSION_INFO)
+if HAVE_GNU_LD
+libpulse_simple_la_LDFLAGS += -Wl,-version-script=$(srcdir)/map-file
+endif
 
 libpulse_browse_la_SOURCES = pulse/browser.c pulse/browser.h pulsecore/avahi-wrap.c pulsecore/avahi-wrap.h
 libpulse_browse_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)
 libpulse_browse_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(AVAHI_LIBS)
-libpulse_browse_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_BROWSE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file
+libpulse_browse_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_BROWSE_VERSION_INFO)
+if HAVE_GNU_LD
+libpulse_browse_la_LDFLAGS += -Wl,-version-script=$(srcdir)/map-file
+endif
 
 libpulse_mainloop_glib_la_SOURCES = pulse/glib-mainloop.h pulse/glib-mainloop.c
 libpulse_mainloop_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
 libpulse_mainloop_glib_la_LIBADD = $(AM_LIBADD) libpulse.la libpulsecommon-@PA_MAJORMINORMICRO@.la $(GLIB20_LIBS)
-libpulse_mainloop_glib_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file
+libpulse_mainloop_glib_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO)
+if HAVE_GNU_LD
+libpulse_mainloop_glib_la_LDFLAGS += -Wl,-version-script=$(srcdir)/map-file
+endif
 
 ###################################
 #         OSS emulation           #
@@ -818,7 +831,7 @@ noinst_LTLIBRARIES = libpulsecore-foreign.la
 libpulsecore_foreign_la_SOURCES = \
                pulsecore/ffmpeg/resample2.c pulsecore/ffmpeg/avcodec.h pulsecore/ffmpeg/dsputil.h
 
-libpulsecore_foreign_la_CFLAGS = $(AM_CFLAGS) -w
+libpulsecore_foreign_la_CFLAGS = $(AM_CFLAGS) $(FOREIGN_CFLAGS)
 
 ###################################
 #   Plug-in support libraries     #
@@ -1313,9 +1326,15 @@ libalsa_util_la_LIBADD += $(HAL_LIBS)
 libalsa_util_la_CFLAGS += $(HAL_CFLAGS)
 endif
 
+if HAVE_UDEV
+libalsa_util_la_SOURCES += modules/udev-util.h modules/udev-util.c
+libalsa_util_la_LIBADD += $(UDEV_LIBS)
+libalsa_util_la_CFLAGS += $(UDEV_CFLAGS)
+endif
+
 if HAVE_DBUS
 libalsa_util_la_SOURCES += modules/reserve.h modules/reserve.c modules/reserve-wrap.c modules/reserve-wrap.h
-libalsa_util_la_LIBADD += $(DBUS_LIBS)
+libalsa_util_la_LIBADD += $(DBUS_LIBS) libdbus-util.la
 libalsa_util_la_CFLAGS += $(DBUS_CFLAGS)
 endif
 
@@ -1532,7 +1551,7 @@ libbluetooth_util_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 
 module_bluetooth_device_la_SOURCES = modules/bluetooth/module-bluetooth-device.c modules/bluetooth/rtp.h
 module_bluetooth_device_la_LDFLAGS = $(MODULE_LDFLAGS)
-module_bluetooth_device_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libdbus-util.la libbluetooth-ipc.la libbluetooth-sbc.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
+module_bluetooth_device_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore-@PA_MAJORMINORMICRO@.la libdbus-util.la libbluetooth-util.la libbluetooth-ipc.la libbluetooth-sbc.la libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la
 module_bluetooth_device_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 
 # Apple Airtunes/RAOP
index b5cbbc6359bc0e08577f5eb9d7da5e2c5fc2bf4b..d2ae8d0e72797dcba27ba8184aadbebf35bf82c0 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 176aa90e4600380b867bfd91516cee7b7c49c162..94241a9a0d1b61bba1625274de45a23068472db1 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f4224ea80d8d2d03e17bc706432b20e2effb7e7b..d78089e194b7a0cc9b289d077fca186d94b9cd28 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fd72a6d3a5b973e9371397ecf9d130e49c30fd5f..e34d7f50f14497e18479661bc6d41981fe8326f3 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5f24474db611451a2970b8f3b6e155b50cf254dd..64728e27a40b0319ea60cfae8da755aa48e01df5 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index cb9a123d92329edae5fb0e80dd950a1598073cf3..ce78d4839ad0a0f550eabf6a230a6cacbf238500 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 10144ea45b302718ef84548a161f5204818017e0..ac6cc8aad54622515ed5180745bc7a18d72e1ec9 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -94,8 +94,10 @@ static const pa_daemon_conf default_conf = {
    ,.rlimit_fsize = { .value = 0, .is_set = FALSE },
     .rlimit_data = { .value = 0, .is_set = FALSE },
     .rlimit_stack = { .value = 0, .is_set = FALSE },
-    .rlimit_core = { .value = 0, .is_set = FALSE },
-    .rlimit_rss = { .value = 0, .is_set = FALSE }
+    .rlimit_core = { .value = 0, .is_set = FALSE }
+#ifdef RLIMIT_RSS
+   ,.rlimit_rss = { .value = 0, .is_set = FALSE }
+#endif
 #ifdef RLIMIT_NPROC
    ,.rlimit_nproc = { .value = 0, .is_set = FALSE }
 #endif
@@ -472,7 +474,9 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
         { "rlimit-data",                parse_rlimit,             &c->rlimit_data, NULL },
         { "rlimit-stack",               parse_rlimit,             &c->rlimit_stack, NULL },
         { "rlimit-core",                parse_rlimit,             &c->rlimit_core, NULL },
+#ifdef RLIMIT_RSS
         { "rlimit-rss",                 parse_rlimit,             &c->rlimit_rss, NULL },
+#endif
 #ifdef RLIMIT_NOFILE
         { "rlimit-nofile",              parse_rlimit,             &c->rlimit_nofile, NULL },
 #endif
@@ -651,7 +655,9 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     pa_strbuf_printf(s, "rlimit-data = %li\n", c->rlimit_data.is_set ? (long int) c->rlimit_data.value : -1);
     pa_strbuf_printf(s, "rlimit-stack = %li\n", c->rlimit_stack.is_set ? (long int) c->rlimit_stack.value : -1);
     pa_strbuf_printf(s, "rlimit-core = %li\n", c->rlimit_core.is_set ? (long int) c->rlimit_core.value : -1);
+#ifdef RLIMIT_RSS
     pa_strbuf_printf(s, "rlimit-rss = %li\n", c->rlimit_rss.is_set ? (long int) c->rlimit_rss.value : -1);
+#endif
 #ifdef RLIMIT_AS
     pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
 #endif
index 9331280b5121461b4de3c48f11be803234282db6..9cec189f82cbd86c285e423b82e5796db645b204 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -87,8 +87,10 @@ typedef struct pa_daemon_conf {
     char *config_file;
 
 #ifdef HAVE_SYS_RESOURCE_H
-    pa_rlimit rlimit_fsize, rlimit_data, rlimit_stack, rlimit_core, rlimit_rss;
-
+    pa_rlimit rlimit_fsize, rlimit_data, rlimit_stack, rlimit_core;
+#ifdef RLIMIT_RSS
+    pa_rlimit rlimit_rss;
+#endif
 #ifdef RLIMIT_NOFILE
     pa_rlimit rlimit_nofile;
 #endif
index 9c9f1c813560d2a0f7c1a3b5187fa8cbe409ca4f..0ffc0fc09b85bdc6dcae42c5990209afd5445eac 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c49a5eda71998286a6f2b97b95bd354f5b9771e2..c3595e5455d5ddac258867407ad77f22c7ba3dc9 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8444cfb499dd06a4d4d70056d5d30e2fd05538c0..276b2a06eb1eec4000fe75809edc47ec440ea46a 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f95d13b4205f2af8a9fd2ce104c7dce3c24ee0dc..07600706e4352a5a38934ac2c18da8006136631d 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b630bd173375439d84bb9173bd32a88735392ad4..0048e7b7b45e350358877a5f947b2ddc52f90538 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -294,7 +294,9 @@ static void set_all_rlimits(const pa_daemon_conf *conf) {
     set_one_rlimit(&conf->rlimit_data, RLIMIT_DATA, "RLIMIT_DATA");
     set_one_rlimit(&conf->rlimit_stack, RLIMIT_STACK, "RLIMIT_STACK");
     set_one_rlimit(&conf->rlimit_core, RLIMIT_CORE, "RLIMIT_CORE");
+#ifdef RLIMIT_RSS
     set_one_rlimit(&conf->rlimit_rss, RLIMIT_RSS, "RLIMIT_RSS");
+#endif
 #ifdef RLIMIT_NPROC
     set_one_rlimit(&conf->rlimit_nproc, RLIMIT_NPROC, "RLIMIT_NPROC");
 #endif
index 921e5d1d4042daea077e41d4ca666f689b44d8c6..9799e09485f8fbb4628fc550f812fa2979391b0f 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 0d65ec520a6a1815f1cfe9138e024b722d1deead..018f6ef1c526806a714b4d8b00c035935ef8acaa 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index dbd95b637e7345d90374bbb59491af2c05289e31..7bf16c3c673290977717c20b02108df938ac3d0a 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 /* #define DEBUG_TIMING */
 
 #define DEFAULT_DEVICE "default"
-#define DEFAULT_TSCHED_BUFFER_USEC (2*PA_USEC_PER_SEC)            /* 2s */
-#define DEFAULT_TSCHED_WATERMARK_USEC (20*PA_USEC_PER_MSEC)       /* 20ms */
-#define TSCHED_MIN_SLEEP_USEC (10*PA_USEC_PER_MSEC)               /* 10ms */
-#define TSCHED_MIN_WAKEUP_USEC (4*PA_USEC_PER_MSEC)               /* 4ms */
+#define DEFAULT_TSCHED_BUFFER_USEC (2*PA_USEC_PER_SEC)            /* 2s   -- Overall buffer size */
+#define DEFAULT_TSCHED_WATERMARK_USEC (20*PA_USEC_PER_MSEC)       /* 20ms -- Fill up when only this much is left in the buffer */
+#define TSCHED_WATERMARK_STEP_USEC (10*PA_USEC_PER_MSEC)          /* 10ms -- On underrun, increase watermark by this */
+#define TSCHED_MIN_SLEEP_USEC (10*PA_USEC_PER_MSEC)               /* 10ms -- Sleep at least 10ms on each iteration */
+#define TSCHED_MIN_WAKEUP_USEC (4*PA_USEC_PER_MSEC)               /* 4ms  -- Wakeup at least this long before the buffer runs empty*/
 
 struct userdata {
     pa_core *core;
@@ -86,7 +87,16 @@ struct userdata {
     pa_bool_t mixer_seperate_channels:1;
     pa_cvolume hardware_volume;
 
-    size_t frame_size, fragment_size, hwbuf_size, tsched_watermark, hwbuf_unused, min_sleep, min_wakeup;
+    size_t
+        frame_size,
+        fragment_size,
+        hwbuf_size,
+        tsched_watermark,
+        hwbuf_unused,
+        min_sleep,
+        min_wakeup,
+        watermark_step;
+
     unsigned nfragments;
     pa_memchunk memchunk;
 
@@ -138,7 +148,7 @@ static void reserve_update(struct userdata *u) {
     const char *description;
     pa_assert(u);
 
-    if (!u->sink)
+    if (!u->sink || !u->reserve)
         return;
 
     if ((description = pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)))
@@ -154,6 +164,9 @@ static int reserve_init(struct userdata *u, const char *dname) {
     if (u->reserve)
         return 0;
 
+    if (pa_in_system_mode())
+        return 0;
+
     /* We are resuming, try to lock the device */
     if (!(rname = pa_alsa_get_reserve_name(dname)))
         return 0;
@@ -205,10 +218,11 @@ static void adjust_after_underrun(struct userdata *u) {
     pa_usec_t old_min_latency, new_min_latency;
 
     pa_assert(u);
+    pa_assert(u->use_tsched);
 
     /* First, just try to increase the watermark */
     old_watermark = u->tsched_watermark;
-    u->tsched_watermark *= 2;
+    u->tsched_watermark = PA_MIN(u->tsched_watermark * 2, u->tsched_watermark + u->watermark_step);
     fix_tsched_watermark(u);
 
     if (old_watermark != u->tsched_watermark) {
@@ -219,7 +233,8 @@ static void adjust_after_underrun(struct userdata *u) {
 
     /* Hmm, we cannot increase the watermark any further, hence let's raise the latency */
     old_min_latency = u->sink->thread_info.min_latency;
-    new_min_latency = PA_MIN(old_min_latency * 2, u->sink->thread_info.max_latency);
+    new_min_latency = PA_MIN(old_min_latency * 2, old_min_latency + TSCHED_WATERMARK_STEP_USEC);
+    new_min_latency = PA_MIN(new_min_latency, u->sink->thread_info.max_latency);
 
     if (old_min_latency != new_min_latency) {
         pa_log_notice("Increasing minimal latency to %0.2f ms",
@@ -1175,17 +1190,11 @@ static int process_rewind(struct userdata *u) {
 
     /* Figure out how much we shall rewind and reset the counter */
     rewind_nbytes = u->sink->thread_info.rewind_nbytes;
-    u->sink->thread_info.rewind_nbytes = 0;
 
-    if (rewind_nbytes <= 0)
-        goto finish;
-
-    pa_assert(rewind_nbytes > 0);
     pa_log_debug("Requested to rewind %lu bytes.", (unsigned long) rewind_nbytes);
 
-    snd_pcm_hwsync(u->pcm_handle);
-    if ((unused = snd_pcm_avail_update(u->pcm_handle)) < 0) {
-        pa_log("snd_pcm_avail_update() failed: %s", snd_strerror((int) unused));
+    if (PA_UNLIKELY((unused = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
+        pa_log("snd_pcm_avail() failed: %s", snd_strerror((int) unused));
         return -1;
     }
 
@@ -1227,12 +1236,8 @@ static int process_rewind(struct userdata *u) {
     } else
         pa_log_debug("Mhmm, actually there is nothing to rewind.");
 
-finish:
-
     pa_sink_process_rewind(u->sink, 0);
-
     return 0;
-
 }
 
 static void thread_func(void *userdata) {
@@ -1261,7 +1266,7 @@ static void thread_func(void *userdata) {
             int work_done;
             pa_usec_t sleep_usec = 0;
 
-            if (u->sink->thread_info.rewind_requested)
+            if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
                 if (process_rewind(u) < 0)
                         goto fail;
 
@@ -1484,7 +1489,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 
     struct userdata *u = NULL;
     const char *dev_id = NULL;
-    pa_sample_spec ss;
+    pa_sample_spec ss, requested_ss;
     pa_channel_map map;
     uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
     snd_pcm_uframes_t period_frames, tsched_frames;
@@ -1503,6 +1508,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         goto fail;
     }
 
+    requested_ss = ss;
     frame_size = pa_frame_size(&ss);
 
     nfrags = m->core->default_n_fragments;
@@ -1654,6 +1660,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
     }
 
+    pa_alsa_init_description(data.proplist);
+
     u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY);
     pa_sink_new_data_done(&data);
 
@@ -1674,19 +1682,20 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     u->fragment_size = frag_size = (uint32_t) (period_frames * frame_size);
     u->nfragments = nfrags;
     u->hwbuf_size = u->fragment_size * nfrags;
-    u->tsched_watermark = tsched_watermark;
+    u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, &requested_ss), &u->sink->sample_spec);
     pa_cvolume_mute(&u->hardware_volume, u->sink->sample_spec.channels);
 
     if (use_tsched) {
         fix_min_sleep_wakeup(u);
         fix_tsched_watermark(u);
-    }
 
-    u->sink->thread_info.max_rewind = use_tsched ? u->hwbuf_size : 0;
-    u->sink->thread_info.max_request = u->hwbuf_size;
+        u->watermark_step = pa_usec_to_bytes(TSCHED_WATERMARK_STEP_USEC, &u->sink->sample_spec);
+    }
 
+    pa_sink_set_max_rewind(u->sink, use_tsched ? u->hwbuf_size : 0);
+    pa_sink_set_max_request(u->sink, u->hwbuf_size);
     pa_sink_set_latency_range(u->sink,
-                              !use_tsched ? pa_bytes_to_usec(u->hwbuf_size, &ss) : (pa_usec_t) -1,
+                              use_tsched ? (pa_usec_t) -1 : pa_bytes_to_usec(u->hwbuf_size, &ss),
                               pa_bytes_to_usec(u->hwbuf_size, &ss));
 
     pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
index 47ece9e0969840d47c99f5f6d7109a79f1c1bfec..bbf64234b56cd7d5b891434cfb3d025b0a717e64 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 39df4a917ab0e7eeecf417890f3051d85434fb93..f4acad8cd66c13d79e69f3550c2a5fea3416015a 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -64,6 +64,7 @@
 #define DEFAULT_DEVICE "default"
 #define DEFAULT_TSCHED_BUFFER_USEC (2*PA_USEC_PER_SEC)       /* 2s */
 #define DEFAULT_TSCHED_WATERMARK_USEC (20*PA_USEC_PER_MSEC)  /* 20ms */
+#define TSCHED_WATERMARK_STEP_USEC (10*PA_USEC_PER_MSEC)     /* 10ms */
 #define TSCHED_MIN_SLEEP_USEC (10*PA_USEC_PER_MSEC)          /* 10ms */
 #define TSCHED_MIN_WAKEUP_USEC (4*PA_USEC_PER_MSEC)          /* 4ms */
 
@@ -88,7 +89,16 @@ struct userdata {
 
     pa_cvolume hardware_volume;
 
-    size_t frame_size, fragment_size, hwbuf_size, tsched_watermark, hwbuf_unused, min_sleep, min_wakeup;
+    size_t
+        frame_size,
+        fragment_size,
+        hwbuf_size,
+        tsched_watermark,
+        hwbuf_unused,
+        min_sleep,
+        min_wakeup,
+        watermark_step;
+
     unsigned nfragments;
 
     char *device_name;
@@ -136,7 +146,7 @@ static void reserve_update(struct userdata *u) {
     const char *description;
     pa_assert(u);
 
-    if (!u->source)
+    if (!u->source || !u->reserve)
         return;
 
     if ((description = pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION)))
@@ -152,6 +162,9 @@ static int reserve_init(struct userdata *u, const char *dname) {
     if (u->reserve)
         return 0;
 
+    if (pa_in_system_mode())
+        return 0;
+
     /* We are resuming, try to lock the device */
     if (!(rname = pa_alsa_get_reserve_name(dname)))
         return 0;
@@ -202,10 +215,12 @@ static void adjust_after_overrun(struct userdata *u) {
     pa_usec_t old_min_latency, new_min_latency;
 
     pa_assert(u);
+    pa_assert(u->use_tsched);
 
     /* First, just try to increase the watermark */
     old_watermark = u->tsched_watermark;
-    u->tsched_watermark *= 2;
+    u->tsched_watermark = PA_MIN(u->tsched_watermark * 2, u->tsched_watermark + u->watermark_step);
+
     fix_tsched_watermark(u);
 
     if (old_watermark != u->tsched_watermark) {
@@ -216,7 +231,8 @@ static void adjust_after_overrun(struct userdata *u) {
 
     /* Hmm, we cannot increase the watermark any further, hence let's raise the latency */
     old_min_latency = u->source->thread_info.min_latency;
-    new_min_latency = PA_MIN(old_min_latency * 2, u->source->thread_info.max_latency);
+    new_min_latency = PA_MIN(old_min_latency * 2, old_min_latency + TSCHED_WATERMARK_STEP_USEC);
+    new_min_latency = PA_MIN(new_min_latency, u->source->thread_info.max_latency);
 
     if (old_min_latency != new_min_latency) {
         pa_log_notice("Increasing minimal latency to %0.2f ms",
@@ -1331,7 +1347,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 
     struct userdata *u = NULL;
     const char *dev_id = NULL;
-    pa_sample_spec ss;
+    pa_sample_spec ss, requested_ss;
     pa_channel_map map;
     uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
     snd_pcm_uframes_t period_frames, tsched_frames;
@@ -1349,6 +1365,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         goto fail;
     }
 
+    requested_ss = ss;
     frame_size = pa_frame_size(&ss);
 
     nfrags = m->core->default_n_fragments;
@@ -1495,6 +1512,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
     }
 
+    pa_alsa_init_description(data.proplist);
+
     u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
     pa_source_new_data_done(&data);
 
@@ -1515,16 +1534,18 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     u->fragment_size = frag_size = (uint32_t) (period_frames * frame_size);
     u->nfragments = nfrags;
     u->hwbuf_size = u->fragment_size * nfrags;
-    u->tsched_watermark = tsched_watermark;
+    u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, &requested_ss), &u->source->sample_spec);
     pa_cvolume_mute(&u->hardware_volume, u->source->sample_spec.channels);
 
     if (use_tsched) {
         fix_min_sleep_wakeup(u);
         fix_tsched_watermark(u);
+
+        u->watermark_step = pa_usec_to_bytes(TSCHED_WATERMARK_STEP_USEC, &u->source->sample_spec);
     }
 
     pa_source_set_latency_range(u->source,
-                                !use_tsched ? pa_bytes_to_usec(u->hwbuf_size, &ss) : (pa_usec_t) -1,
+                                use_tsched ? (pa_usec_t) -1 : pa_bytes_to_usec(u->hwbuf_size, &ss),
                                 pa_bytes_to_usec(u->hwbuf_size, &ss));
 
     pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
index 5fed6cc897258680456057dec5a5d20d0a622ebf..9cbb0e174a34ec08c34bad0c59be20d9e3b24a09 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6740c06927f99ef34c85eb0c9de5fa3b882d24ec..454cfd4ea9e7266f934d36eae7b2645670ccc2b8 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 #include "hal-util.h"
 #endif
 
+#ifdef HAVE_UDEV
+#include "udev-util.h"
+#endif
+
 struct pa_alsa_fdlist {
     unsigned num_fds;
     struct pollfd *fds;
@@ -1362,6 +1366,26 @@ void pa_alsa_redirect_errors_dec(void) {
         snd_lib_error_set_handler(NULL);
 }
 
+pa_bool_t pa_alsa_init_description(pa_proplist *p) {
+    const char *s;
+    pa_assert(p);
+
+    if (pa_device_init_description(p))
+        return TRUE;
+
+    if ((s = pa_proplist_gets(p, "alsa.card_name"))) {
+        pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s);
+        return TRUE;
+    }
+
+    if ((s = pa_proplist_gets(p, "alsa.name"))) {
+        pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s);
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
 void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
     char *cn, *lcn, *dn;
 
@@ -1385,6 +1409,10 @@ void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
         pa_xfree(dn);
     }
 
+#ifdef HAVE_UDEV
+    pa_udev_get_info(c, p, card);
+#endif
+
 #ifdef HAVE_HAL
     pa_hal_get_info(c, p, card);
 #endif
@@ -1411,7 +1439,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
 
     snd_pcm_class_t class;
     snd_pcm_subclass_t subclass;
-    const char *n, *id, *sdn, *cn = NULL;
+    const char *n, *id, *sdn;
     int card;
 
     pa_assert(p);
@@ -1426,6 +1454,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
         if (alsa_class_table[class])
             pa_proplist_sets(p, "alsa.class", alsa_class_table[class]);
     }
+
     subclass = snd_pcm_info_get_subclass(pcm_info);
     if (subclass <= SND_PCM_SUBCLASS_LAST)
         if (alsa_subclass_table[subclass])
@@ -1443,17 +1472,8 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
 
     pa_proplist_setf(p, "alsa.device", "%u", snd_pcm_info_get_device(pcm_info));
 
-    if ((card = snd_pcm_info_get_card(pcm_info)) >= 0) {
+    if ((card = snd_pcm_info_get_card(pcm_info)) >= 0)
         pa_alsa_init_proplist_card(c, p, card);
-        cn = pa_proplist_gets(p, "alsa.card_name");
-    }
-
-    if (cn && n && !strstr(cn, n) && !strstr(n, cn))
-        pa_proplist_setf(p, PA_PROP_DEVICE_DESCRIPTION, "%s, %s", cn, n);
-    else if (cn && (!n || strstr(cn, n)))
-        pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, cn);
-    else if (n)
-        pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, n);
 }
 
 void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm) {
index 899532e2498d0878f7f23c2468cc4bbe2f22378f..fe0f71e0e9bc879f41ca947eb3db5cadadd97ed0 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -123,6 +123,7 @@ void pa_alsa_redirect_errors_dec(void);
 void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
 void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
 void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
+pa_bool_t pa_alsa_init_description(pa_proplist *p);
 
 int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
 
index fc6b886b9d80143fbd224fc5b61b0ecd30e4aaf3..d5e2cdc296eb163fafe4e5c47223e68d8985f586 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -310,14 +310,16 @@ int pa__init(pa_module *m) {
 
     pa_snprintf(rname, sizeof(rname), "Audio%i", alsa_card_index);
 
-    if (!(reserve = pa_reserve_wrapper_get(m->core, rname)))
-        goto fail;
+    if (!pa_in_system_mode())
+        if (!(reserve = pa_reserve_wrapper_get(m->core, rname)))
+            goto fail;
 
     pa_card_new_data_init(&data);
     data.driver = __FILE__;
     data.module = m;
     pa_alsa_init_proplist_card(m->core, data.proplist, alsa_card_index);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_id);
+    pa_alsa_init_description(data.proplist);
     set_card_name(&data, ma, u->device_id);
 
     if (reserve)
index 4f844e0822fd9d9a37cae58243f4f43358f2263c..c728a4464c217b5598afdc970a1dd74a6b376579 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c35936dfb748d12fa58a93b63821cef15676c76e..6188019f3ceca10f75bf90647c8eda132974216f 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7855c2efdd32b3807e1d271f51a93cb77e1be2dc..dfd3a30651032fb9547b35869c97dcd7b26399fb 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -811,8 +811,8 @@ const char*pa_bluetooth_get_form_factor(uint32_t class) {
         [1] = "headset",
         [2] = "hands-free",
         [4] = "microphone",
-        [5] = "external-speakers",
-        [6] = "headphones",
+        [5] = "speaker",
+        [6] = "headphone",
         [7] = "portable",
         [8] = "car",
         [10] = "hifi"
index 2c3ec6497a6053bb42def4278ce1db4e1c23b7db..0364c97240a536d6dba621329180d25596ff37a8 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4203150bfd82f59be8534a3234e13db6d46367d2..f030acfa24370ce0667708653e7468499326db39 100644 (file)
@@ -160,7 +160,8 @@ struct bt_get_capabilities_req {
 
 #define BT_HFP_CODEC_PCM                       0x00
 
-#define BT_PCM_FLAG_NREC                       1
+#define BT_PCM_FLAG_NREC                       0x01
+#define BT_PCM_FLAG_PCM_ROUTING                        0x02
 
 typedef struct {
        uint8_t transport;
index b2fb1db1e8d03badbac797c2ae41320810cac917..495bc82fa83b68f434311c1a1cb1d466e9b9ce34 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -921,7 +921,7 @@ static int hsp_process_push(struct userdata *u) {
             if (l < 0 && errno == EINTR)
                 continue;
             else {
-                pa_log_error("Failed to read data from SCO socket: %s", ret < 0 ? pa_cstrerror(errno) : "EOF");
+                pa_log_error("Failed to read data from SCO socket: %s", l < 0 ? pa_cstrerror(errno) : "EOF");
                 ret = -1;
                 break;
             }
@@ -1363,7 +1363,7 @@ static void sco_over_pcm_state_update(struct userdata *u) {
     if (PA_SINK_IS_OPENED(pa_sink_get_state(u->hsp.sco_sink)) ||
         PA_SOURCE_IS_OPENED(pa_source_get_state(u->hsp.sco_source))) {
 
-        if (u->service_fd > 0)
+        if (u->service_fd >= 0)
             return;
 
         pa_log_debug("Resuming SCO over PCM");
@@ -1372,7 +1372,7 @@ static void sco_over_pcm_state_update(struct userdata *u) {
 
     } else {
 
-        if (u->service_fd <= 0)
+        if (u->service_fd < 0)
             return;
 
         pa_log_debug("Closing SCO over PCM");
@@ -1559,6 +1559,7 @@ static int setup_bt(struct userdata *u) {
 static int init_profile(struct userdata *u) {
     int r = 0;
     pa_assert(u);
+    pa_assert(u->profile != PROFILE_OFF);
 
     if (setup_bt(u) < 0)
         return -1;
@@ -1688,7 +1689,9 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
     u->sample_spec = u->requested_sample_spec;
 
     init_bt(u);
-    init_profile(u);
+
+    if (u->profile != PROFILE_OFF)
+        init_profile(u);
 
     if (u->sink || u->source)
         start_thread(u);
@@ -1728,7 +1731,7 @@ static int add_card(struct userdata *u, const char * default_profile) {
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device->address);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_API, "bluez");
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "sound");
-    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CONNECTOR, "bluetooth");
+    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_BUS, "bluetooth");
     if ((ff = pa_bluetooth_get_form_factor(u->device->class)))
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_FORM_FACTOR, ff);
     pa_proplist_sets(data.proplist, "bluez.path", u->device->path);
@@ -1909,8 +1912,9 @@ int pa__init(pa_module* m) {
     if (init_bt(u) < 0)
         goto fail;
 
-    if (init_profile(u) < 0)
-        goto fail;
+    if (u->profile != PROFILE_OFF)
+        if (init_profile(u) < 0)
+            goto fail;
 
 /*     if (u->path) { */
 /*         DBusError err; */
@@ -1948,8 +1952,9 @@ int pa__init(pa_module* m) {
 /*         } */
 /*     } */
 
-    if (start_thread(u) < 0)
-        goto fail;
+    if (u->sink || u->source)
+        if (start_thread(u) < 0)
+            goto fail;
 
     return 0;
 
index e974074924c558d12dd9655d10bbb88831ddaa2d..521a9127b629c78241eb59da041a7b85736ecf18 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f30d39fea16cf04e3166c82a1efb6790ec41b31b..a3b525eee90b42bfbe99e1538fc76e619343fd1e 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4218bca5662e98c502ad6365d6747fed28ab249a..d51befb92d88a987958063bb5d8498cf4d2c3534 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fd9746730c721c4e04514ac7d4726b801f9876f5..90abbc7b81184716c6cb9e253699cc4010a1768c 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f5016faf2f7fd7ada1e82595c9716aa34ede9a0c..fbd8cfd83808ef2659814ef4142173d5aa174d68 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 845ede50bc781a787d9c9dcfc155d8e4e06b7b0f..c01ebbf6827a613a0d1fdbe8372d513b41631c49 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 82bbc57ee29041cf53cad7e2fc667876689955fa..422ae4ec8bbb17a0792be098412caada26e3dcbe 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -89,6 +89,9 @@ int pa_hal_get_info(pa_core *core, pa_proplist *p, int card) {
 
     pa_proplist_sets(p, "hal.udi", udis[i]);
 
+    /* The data HAL stores in info.product is not actually a product
+     * string but simply the ALSA card name. We will hence not write
+     * it to PA_PROP_DEVICE_PRODUCT_NAME */
     t = libhal_device_get_property_string(hal, udis[i], "info.product", &error);
     if (dbus_error_is_set(&error))
         dbus_error_free(&error);
index 3c0e094372f46e01ca9646df5bc2ef627144a11f..19e41d774ea159850e92fa43751f366cb510ee8c 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 591695fbdfba2f672d8bbaa273a4415abe82bbae..aee1c650f69bb56ce553a385eb8f77196a7dab71 100644 (file)
@@ -5,7 +5,7 @@
 
     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,
+    by the Free Software Foundation; either version 2.1 of the License,
     or (at your option) any later version.
 
     PulseAudio is distributed in the hope that it will be useful, but
index 99111868b503d9b485f9b954c4f652b12cf8eadd..c3e5997a60dd03a4a743b1a720c0436f53ee2a47 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c7696058b05194eb8ccf99b78451e945ad5b771e..0afb9353ba2b7d2e271ae8f928b13d679340747f 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 439aa8b0e0b7e6a7ed2486def91486343f46d035..fd9452b492fed6c716cc21bfe7cefd32067c8cd3 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6ed4f1413e2412efe05a0db7477afb8d4343f001..4b2d6f9b3eb46d234710a42a7deaa6125dcbc380 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -487,7 +487,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
     struct output *o;
 
     pa_sink_input_assert_ref(i);
-    pa_assert(o = i->userdata);
+    pa_assert_se(o = i->userdata);
 
     pa_module_unload_request(o->userdata->module, TRUE);
     output_free(o);
index 805f5eef1bb88c7c2506377b3bd04dca133eeb8a..3fba7ef6cc5a3b88042bda2cabec11474d711990 100644 (file)
@@ -5,7 +5,7 @@
 
     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,
+    by the Free Software Foundation; either version 2.1 of the License,
     or (at your option) any later version.
 
     PulseAudio is distributed in the hope that it will be useful, but
index fb90cf345338d68fb5708c37933bf1459d61c53d..c0f5eea46b7c41daf0c7286ed2c76b1ceb8a24b9 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d299f40b67565516b8edd06a7ad6bb7f0dfb5a02..a25aafcbd8143159aec60d7ff7c52aeaf6b703e6 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 773e1d8757ca64c6ed714b6131fe194ef8a8e451..49127abcd633892a128440047e1b2bfc74955308 100644 (file)
@@ -7,7 +7,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e6a48814eab4627e5a6a17330ddb023a13093823..0ca3dd83e960185c95827c864786206487993b66 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 578ad3b5025c61f417808680007997cb45cab973..56cda4dfb3de65332bbdc2b17c41fdcacb91140a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 882dba8c6307a0844fc0cec2ee9ab040b2cc8ae4..5925f591e0b35aeaa64ea76023769ecef54d49c4 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 552cf75e5c19ce3c21b6f139d2ebae6f4c96659b..2b45e302fc137ae8a120b84f9d4d8fa6ca142390 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ce04f3670668cb3a017fa99e75d18a9f2c5dce28..fe601100ff66066c28d7a25c1af6c4d4dde2dab2 100644 (file)
@@ -6,7 +6,7 @@
 
     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,
+    by the Free Software Foundation; either version 2.1 of the License,
     or (at your option) any later version.
 
     PulseAudio is distributed in the hope that it will be useful, but
index 1739f46a815906b1fb7f78a71336704721f771e3..63fdd2db2cc076cbe37d6617aea9ec97b35386a9 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 38b63751a6e84c67d12c1e4c71829228eed56f38..c77c9581e098b185280e64cd731faa0851e7f6ba 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -163,7 +163,7 @@ static int jack_process(jack_nframes_t nframes, void *arg) {
     pa_assert(u);
 
     for (c = 0; c < u->channels; c++)
-        pa_assert(buffer[c] = jack_port_get_buffer(u->port[c], nframes));
+        pa_assert_se(buffer[c] = jack_port_get_buffer(u->port[c], nframes));
 
     /* We interleave the data and pass it on to the other RT thread */
 
index a4007b1a64e61236d9dfe6f6dd80c839dbfa84c4..33562b1049d060f4c7efe2b31c9b29affc9b553f 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9a782caccb8ed1fb009b295ef7e2ed33e08427a2..bdb8bb71ea5a37477cafbfa9bdcd61df678c9530 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 179361105c65ea00000e6ea65ca1898e2f101089..d7365ca73ff5a3c4a3d7627bedeca4399ad4f146 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a379923adeaf5db30e7b0821093bcb787aaa6eac..2f87dd223e83b5383533c3325cee205170de95b5 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f17f435ab8ceb20df60ef653127e7a5adce098bb..eed0505bf1e32a4d63ee105a58bf2fdb776e9837 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e18da5fd180022d3f9c34accf85395c0ee26bf46..183d4b2e0b8c655cd7f5907c268935fd1b50184a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f3b0e8b0e6297d819c737e60414931f7fd741015..def4f758f3b4183feb0c2e6ba02a83d6fd68a33a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a42c53c365f555da12b3376d90c71730a965a51c..3d40fdf3abed78e39c45a4ab87be2a58e408c076 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6252ebab89e0b1d7f6598f79fabcf70a3fe160b9..e191ec33c492cda57e6599059f1ead2f922d1abb 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ca9274d8655a5cb9b13de75ded19198ae2d00ac7..ce3dcd037b176235caaac48636f71d4cc9f969dc 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index df3931512a48346195698748540a7ad16c901863..5c2e062335d0f9317aab9d85bf9dde67f67d82b0 100644 (file)
@@ -6,7 +6,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -152,11 +152,18 @@ static void resolver_cb(
     if (event != AVAHI_RESOLVER_FOUND)
         pa_log("Resolving of '%s' failed: %s", name, avahi_strerror(avahi_client_errno(u->client)));
     else {
-        char *device = NULL, *dname, *vname, *args;
+        char *device = NULL, *nicename, *dname, *vname, *args;
         char at[AVAHI_ADDRESS_STR_MAX];
         AvahiStringList *l;
         pa_module *m;
 
+        if ((nicename = strstr(name, "@"))) {
+            ++nicename;
+            if (strlen(nicename) > 0) {
+                pa_log_debug("Found RAOP: %s", nicename);
+            }
+        }
+
         for (l = txt; l; l = l->next) {
             char *key, *value;
             pa_assert_se(avahi_string_list_get_pair(l, &key, &value, NULL) == 0);
@@ -190,10 +197,20 @@ static void resolver_cb(
                                  "sink_name=%s",
                                  avahi_address_snprint(at, sizeof(at), a), port,
                                  vname);*/
-        args = pa_sprintf_malloc("server=%s "
-                                 "sink_name=%s",
-                                 avahi_address_snprint(at, sizeof(at), a),
-                                 vname);
+        if (nicename) {
+            args = pa_sprintf_malloc("server=%s "
+                                     "sink_name=%s "
+                                     "description=\"%s\"",
+                                     avahi_address_snprint(at, sizeof(at), a),
+                                     vname,
+                                     nicename);
+
+        } else {
+            args = pa_sprintf_malloc("server=%s "
+                                     "sink_name=%s",
+                                     avahi_address_snprint(at, sizeof(at), a),
+                                     vname);
+        }
 
         pa_log_debug("Loading module-raop-sink with arguments '%s'", args);
 
index da338f5d736fb6357dcdbce085dbb2a365588f28..00f0c63c0cb39d0c42962e5d80764df75a242289 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -72,6 +72,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(FALSE);
 PA_MODULE_USAGE(
         "sink_name=<name for the sink> "
+        "description=<description for the sink> "
         "server=<address>  "
         "format=<sample format> "
         "channels=<number of channels> "
@@ -122,6 +123,7 @@ static const char* const valid_modargs[] = {
     "format",
     "channels",
     "sink_name",
+    "description",
     NULL
 };
 
@@ -502,7 +504,7 @@ int pa__init(pa_module*m) {
     struct userdata *u = NULL;
     pa_sample_spec ss;
     pa_modargs *ma = NULL;
-    const char *server;
+    const char *server, *desc;
     pa_sink_new_data data;
 
     pa_assert(m);
@@ -564,7 +566,10 @@ int pa__init(pa_module*m) {
     pa_sink_new_data_set_name(&data, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME));
     pa_sink_new_data_set_sample_spec(&data, &ss);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, server);
-    pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "RAOP sink '%s'", server);
+    if ((desc = pa_modargs_get_value(ma, "description", NULL)))
+        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, desc);
+    else
+        pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "RAOP sink '%s'", server);
 
     u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_NETWORK);
     pa_sink_new_data_done(&data);
index 89ddf95388a418d574566e2e235b438d9e66c970..31824bc525c9ecd5de2747a9b3914a04ec12a0d1 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e52e39c1799fc1c29fe75e542641beddf243c13a..4f616e0553b4b7e2880f1de5736b8bf7921b6005 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5626c2ab7e7b94b016c379e214bfe57dbe058524..206c45f43aecb986c87e05afa6b1f85dfc4004a7 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ce08c01dd99ef26cec71dd4b479c7a5dc98412dd..0be1d72286ade09be7a507e4a5c18529b2edae1f 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6f50543ac428b6950b85b23c8661066117ff0547..995b3c6316ef1a77fada13038904f37b18e2923b 100644 (file)
@@ -3,10 +3,11 @@
 
   Copyright 2006 Lennart Poettering
   Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB
+  Copyright 2009 Finn Thain
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -44,6 +45,7 @@
 #include <pulse/mainloop-signal.h>
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
+#include <pulse/util.h>
 
 #include <pulsecore/iochannel.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/thread-mq.h>
 #include <pulsecore/rtpoll.h>
 #include <pulsecore/thread.h>
+#include <pulsecore/rtclock.h>
 
 #include "module-solaris-symdef.h"
 
-PA_MODULE_AUTHOR("Pierre Ossman")
-PA_MODULE_DESCRIPTION("Solaris Sink/Source")
-PA_MODULE_VERSION(PACKAGE_VERSION)
+PA_MODULE_AUTHOR("Pierre Ossman");
+PA_MODULE_DESCRIPTION("Solaris Sink/Source");
+PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_USAGE(
     "sink_name=<name for the sink> "
     "source_name=<name for the source> "
-    "device=<OSS device> record=<enable source?> "
+    "device=<audio device file name> "
+    "record=<enable source?> "
     "playback=<enable sink?> "
     "format=<sample format> "
     "channels=<number of channels> "
     "rate=<sample rate> "
     "buffer_size=<record buffer size> "
-    "channel_map=<channel map>")
+    "channel_map=<channel map>");
+PA_MODULE_LOAD_ONCE(FALSE);
 
 struct userdata {
     pa_core *core;
@@ -87,15 +92,24 @@ struct userdata {
 
     pa_memchunk memchunk;
 
-    unsigned int page_size;
-
     uint32_t frame_size;
-    uint32_t buffer_size;
-    unsigned int written_bytes, read_bytes;
+    int32_t buffer_size;
+    volatile uint64_t written_bytes, read_bytes;
+    pa_mutex *written_bytes_lock;
 
+    char *device_name;
+    int mode;
     int fd;
     pa_rtpoll_item *rtpoll_item;
     pa_module *module;
+
+    pa_bool_t sink_suspended, source_suspended;
+
+    uint32_t play_samples_msw, record_samples_msw;
+    uint32_t prev_playback_samples, prev_record_samples;
+    pa_mutex *sample_counter_lock;
+
+    size_t min_request;
 };
 
 static const char* const valid_modargs[] = {
@@ -112,89 +126,303 @@ static const char* const valid_modargs[] = {
     NULL
 };
 
-#define DEFAULT_SINK_NAME "solaris_output"
-#define DEFAULT_SOURCE_NAME "solaris_input"
 #define DEFAULT_DEVICE "/dev/audio"
+#define MIN_BUFFER_SIZE (640)
+#define MAX_RENDER_HZ   (300)
 
-static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
-    struct userdata *u = PA_SINK(o)->userdata;
+/* This render rate limit implies a minimum latency,  but without it we waste too much CPU time in the
+ * IO thread. The maximum render rate and minimum latency (or minimum buffer size) are unachievable on
+ * common hardware anyway. Note that MIN_BUFFER_SIZE * MAX_RENDER_HZ >= 4 * 48000 Bps.
+ */
+
+static uint64_t get_playback_buffered_bytes(struct userdata *u) {
+    audio_info_t info;
+    uint64_t played_bytes;
     int err;
+
+    pa_assert(u->sink);
+
+    pa_mutex_lock(u->sample_counter_lock);
+
+    err = ioctl(u->fd, AUDIO_GETINFO, &info);
+    pa_assert(err >= 0);
+
+    /* Handle wrap-around of the device's sample counter, which is a uint_32. */
+    if (u->prev_playback_samples > info.play.samples) {
+        /* Unfortunately info.play.samples can sometimes go backwards, even before it wraps! */
+        if (u->prev_playback_samples + info.play.samples < 240000) {
+            ++u->play_samples_msw;
+        } else {
+            pa_log_debug("play.samples went backwards %d bytes", u->prev_playback_samples - info.play.samples);
+        }
+    }
+    u->prev_playback_samples = info.play.samples;
+    played_bytes = (((uint64_t)u->play_samples_msw << 32) + info.play.samples) * u->frame_size;
+
+    pa_mutex_unlock(u->sample_counter_lock);
+
+    return u->written_bytes - played_bytes;
+}
+
+static pa_usec_t sink_get_latency(struct userdata *u, pa_sample_spec *ss) {
+    pa_usec_t r = 0;
+
+    pa_assert(u);
+    pa_assert(ss);
+
+    if (u->fd >= 0) {
+        pa_mutex_lock(u->written_bytes_lock);
+        r = pa_bytes_to_usec(get_playback_buffered_bytes(u), ss);
+        if (u->memchunk.memblock)
+            r += pa_bytes_to_usec(u->memchunk.length, ss);
+        pa_mutex_unlock(u->written_bytes_lock);
+    }
+    return r;
+}
+
+static uint64_t get_recorded_bytes(struct userdata *u) {
     audio_info_t info;
+    uint64_t result;
+    int err;
 
-    switch (code) {
-    case PA_SINK_MESSAGE_GET_LATENCY: {
-        pa_usec_t r = 0;
+    pa_assert(u->source);
 
-        if (u->fd >= 0) {
+    err = ioctl(u->fd, AUDIO_GETINFO, &info);
+    pa_assert(err >= 0);
 
-            err = ioctl(u->fd, AUDIO_GETINFO, &info);
-            pa_assert(err >= 0);
+    if (u->prev_record_samples > info.record.samples)
+        ++u->record_samples_msw;
+    u->prev_record_samples = info.record.samples;
+    result = (((uint64_t)u->record_samples_msw << 32) + info.record.samples) * u->frame_size;
 
-            r += pa_bytes_to_usec(u->written_bytes, &PA_SINK(o)->sample_spec);
-            r -= pa_bytes_to_usec(info.play.samples * u->frame_size, &PA_SINK(o)->sample_spec);
+    return result;
+}
 
-            if (u->memchunk.memblock)
-                r += pa_bytes_to_usec(u->memchunk.length, &PA_SINK(o)->sample_spec);
-        }
+static pa_usec_t source_get_latency(struct userdata *u, pa_sample_spec *ss) {
+    pa_usec_t r = 0;
+    audio_info_t info;
+
+    pa_assert(u);
+    pa_assert(ss);
 
-        *((pa_usec_t*) data) = r;
+    if (u->fd) {
+        int err = ioctl(u->fd, AUDIO_GETINFO, &info);
+        pa_assert(err >= 0);
 
-        return 0;
+        r = pa_bytes_to_usec(get_recorded_bytes(u), ss) - pa_bytes_to_usec(u->read_bytes, ss);
     }
+    return r;
+}
 
-    case PA_SINK_MESSAGE_SET_VOLUME:
-        if (u->fd >= 0) {
-            AUDIO_INITINFO(&info);
+static void build_pollfd(struct userdata *u) {
+    struct pollfd *pollfd;
 
-            info.play.gain = pa_cvolume_avg((pa_cvolume*)data) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
-            assert(info.play.gain <= AUDIO_MAX_GAIN);
+    pa_assert(u);
+    pa_assert(!u->rtpoll_item);
+    u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
 
-            if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
-                if (errno == EINVAL)
-                    pa_log("AUDIO_SETINFO: Unsupported volume.");
-                else
-                    pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
-            } else {
-                return 0;
-            }
-        }
-        break;
+    pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
+    pollfd->fd = u->fd;
+    pollfd->events = 0;
+    pollfd->revents = 0;
+}
 
-    case PA_SINK_MESSAGE_GET_VOLUME:
-        if (u->fd >= 0) {
-            err = ioctl(u->fd, AUDIO_GETINFO, &info);
-            assert(err >= 0);
+static int set_buffer(int fd, int buffer_size) {
+    audio_info_t info;
 
-            pa_cvolume_set((pa_cvolume*) data, ((pa_cvolume*) data)->channels,
-                info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
+    pa_assert(fd >= 0);
 
-            return 0;
-        }
-        break;
+    AUDIO_INITINFO(&info);
+    info.play.buffer_size = buffer_size;
+    info.record.buffer_size = buffer_size;
 
-    case PA_SINK_MESSAGE_SET_MUTE:
-        if (u->fd >= 0) {
-            AUDIO_INITINFO(&info);
+    if (ioctl(fd, AUDIO_SETINFO, &info) < 0) {
+        if (errno == EINVAL)
+            pa_log("AUDIO_SETINFO: Unsupported buffer size.");
+        else
+            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        return -1;
+    }
 
-            info.output_muted = !!PA_PTR_TO_UINT(data);
+    return 0;
+}
 
-            if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
-                pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
-            else
-                return 0;
+static int auto_format(int fd, int mode, pa_sample_spec *ss) {
+    audio_info_t info;
+
+    pa_assert(fd >= 0);
+    pa_assert(ss);
+
+    AUDIO_INITINFO(&info);
+
+    if (mode != O_RDONLY) {
+        info.play.sample_rate = ss->rate;
+        info.play.channels = ss->channels;
+        switch (ss->format) {
+        case PA_SAMPLE_U8:
+            info.play.precision = 8;
+            info.play.encoding = AUDIO_ENCODING_LINEAR;
+            break;
+        case PA_SAMPLE_ALAW:
+            info.play.precision = 8;
+            info.play.encoding = AUDIO_ENCODING_ALAW;
+            break;
+        case PA_SAMPLE_ULAW:
+            info.play.precision = 8;
+            info.play.encoding = AUDIO_ENCODING_ULAW;
+            break;
+        case PA_SAMPLE_S16NE:
+            info.play.precision = 16;
+            info.play.encoding = AUDIO_ENCODING_LINEAR;
+            break;
+        default:
+            pa_log("AUDIO_SETINFO: Unsupported sample format.");
+            return -1;
         }
-        break;
+    }
 
-    case PA_SINK_MESSAGE_GET_MUTE:
-        if (u->fd >= 0) {
-            err = ioctl(u->fd, AUDIO_GETINFO, &info);
-            pa_assert(err >= 0);
+    if (mode != O_WRONLY) {
+        info.record.sample_rate = ss->rate;
+        info.record.channels = ss->channels;
+        switch (ss->format) {
+        case PA_SAMPLE_U8:
+            info.record.precision = 8;
+            info.record.encoding = AUDIO_ENCODING_LINEAR;
+            break;
+        case PA_SAMPLE_ALAW:
+            info.record.precision = 8;
+            info.record.encoding = AUDIO_ENCODING_ALAW;
+            break;
+        case PA_SAMPLE_ULAW:
+            info.record.precision = 8;
+            info.record.encoding = AUDIO_ENCODING_ULAW;
+            break;
+        case PA_SAMPLE_S16NE:
+            info.record.precision = 16;
+            info.record.encoding = AUDIO_ENCODING_LINEAR;
+            break;
+        default:
+             pa_log("AUDIO_SETINFO: Unsupported sample format.");
+             return -1;
+        }
+    }
+
+    if (ioctl(fd, AUDIO_SETINFO, &info) < 0) {
+        if (errno == EINVAL)
+            pa_log("AUDIO_SETINFO: Failed to set sample format.");
+        else
+            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        return -1;
+    }
+
+    return 0;
+}
+
+static int open_audio_device(struct userdata *u, pa_sample_spec *ss) {
+    pa_assert(u);
+    pa_assert(ss);
+
+    if ((u->fd = open(u->device_name, u->mode | O_NONBLOCK)) < 0) {
+        pa_log_warn("open %s failed (%s)", u->device_name, pa_cstrerror(errno));
+        return -1;
+    }
+
+    pa_log_info("device opened in %s mode.", u->mode == O_WRONLY ? "O_WRONLY" : (u->mode == O_RDONLY ? "O_RDONLY" : "O_RDWR"));
+
+    if (auto_format(u->fd, u->mode, ss) < 0)
+        return -1;
+
+    if (set_buffer(u->fd, u->buffer_size) < 0)
+        return -1;
+
+    u->written_bytes = u->read_bytes = 0;
+    u->play_samples_msw = u->record_samples_msw = 0;
+    u->prev_playback_samples = u->prev_record_samples = 0;
+
+    return u->fd;
+}
+
+static int suspend(struct userdata *u) {
+    pa_assert(u);
+    pa_assert(u->fd >= 0);
+
+    pa_log_info("Suspending...");
+
+    ioctl(u->fd, AUDIO_DRAIN, NULL);
+    pa_close(u->fd);
+    u->fd = -1;
+
+    if (u->rtpoll_item) {
+        pa_rtpoll_item_free(u->rtpoll_item);
+        u->rtpoll_item = NULL;
+    }
+
+    pa_log_info("Device suspended.");
+
+    return 0;
+}
+
+static int unsuspend(struct userdata *u) {
+    pa_assert(u);
+    pa_assert(u->fd < 0);
 
-            *(int*)data = !!info.output_muted;
+    pa_log_info("Resuming...");
 
+    if (open_audio_device(u, u->sink ? &u->sink->sample_spec : &u->source->sample_spec) < 0)
+        return -1;
+
+    build_pollfd(u);
+
+    pa_log_info("Device resumed.");
+
+    return 0;
+}
+
+static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
+    struct userdata *u = PA_SINK(o)->userdata;
+
+    switch (code) {
+
+        case PA_SINK_MESSAGE_GET_LATENCY:
+            *((pa_usec_t*) data) = sink_get_latency(u, &PA_SINK(o)->sample_spec);
             return 0;
-        }
-        break;
+
+        case PA_SINK_MESSAGE_SET_STATE:
+
+            switch ((pa_sink_state_t) PA_PTR_TO_UINT(data)) {
+
+                case PA_SINK_SUSPENDED:
+
+                    pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
+
+                    if (!u->source || u->source_suspended) {
+                        if (suspend(u) < 0)
+                            return -1;
+                    }
+                    u->sink_suspended = TRUE;
+                    break;
+
+                case PA_SINK_IDLE:
+                case PA_SINK_RUNNING:
+
+                    if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
+                        if (!u->source || u->source_suspended) {
+                            if (unsuspend(u) < 0)
+                                return -1;
+                            u->sink->get_volume(u->sink);
+                            u->sink->get_mute(u->sink);
+                        }
+                        u->sink_suspended = FALSE;
+                    }
+                    break;
+
+                case PA_SINK_INVALID_STATE:
+                case PA_SINK_UNLINKED:
+                case PA_SINK_INIT:
+                    ;
+            }
+
+            break;
     }
 
     return pa_sink_process_msg(o, code, data, offset, chunk);
@@ -202,95 +430,168 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
 
 static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
     struct userdata *u = PA_SOURCE(o)->userdata;
-    int err;
-    audio_info_t info;
 
     switch (code) {
-        case PA_SOURCE_MESSAGE_GET_LATENCY: {
-            pa_usec_t r = 0;
 
-            if (u->fd) {
-                err = ioctl(u->fd, AUDIO_GETINFO, &info);
-                pa_assert(err >= 0);
+        case PA_SOURCE_MESSAGE_GET_LATENCY:
+            *((pa_usec_t*) data) = source_get_latency(u, &PA_SOURCE(o)->sample_spec);
+            return 0;
 
-                r += pa_bytes_to_usec(info.record.samples * u->frame_size, &PA_SOURCE(o)->sample_spec);
-                r -= pa_bytes_to_usec(u->read_bytes, &PA_SOURCE(o)->sample_spec);
-            }
+        case PA_SOURCE_MESSAGE_SET_STATE:
 
-            *((pa_usec_t*) data) = r;
+            switch ((pa_source_state_t) PA_PTR_TO_UINT(data)) {
 
-            return 0;
-        }
+                case PA_SOURCE_SUSPENDED:
 
-        case PA_SOURCE_MESSAGE_SET_VOLUME:
-            if (u->fd >= 0) {
-                AUDIO_INITINFO(&info);
+                    pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state));
 
-                info.record.gain = pa_cvolume_avg((pa_cvolume*) data) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
-                assert(info.record.gain <= AUDIO_MAX_GAIN);
+                    if (!u->sink || u->sink_suspended) {
+                        if (suspend(u) < 0)
+                            return -1;
+                    }
+                    u->source_suspended = TRUE;
+                    break;
+
+                case PA_SOURCE_IDLE:
+                case PA_SOURCE_RUNNING:
+
+                    if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) {
+                        if (!u->sink || u->sink_suspended) {
+                            if (unsuspend(u) < 0)
+                                return -1;
+                            u->source->get_volume(u->source);
+                        }
+                        u->source_suspended = FALSE;
+                    }
+                    break;
+
+                case PA_SOURCE_UNLINKED:
+                case PA_SOURCE_INIT:
+                case PA_SOURCE_INVALID_STATE:
+                    ;
 
-                if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
-                    if (errno == EINVAL)
-                        pa_log("AUDIO_SETINFO: Unsupported volume.");
-                    else
-                        pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
-                } else {
-                    return 0;
-                }
             }
             break;
 
-        case PA_SOURCE_MESSAGE_GET_VOLUME:
-            if (u->fd >= 0) {
-                err = ioctl(u->fd, AUDIO_GETINFO, &info);
-                pa_assert(err >= 0);
+    }
 
-                pa_cvolume_set((pa_cvolume*) data, ((pa_cvolume*) data)->channels,
-                    info.record.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
+    return pa_source_process_msg(o, code, data, offset, chunk);
+}
 
-                return 0;
-            }
-            break;
+static void sink_set_volume(pa_sink *s) {
+    struct userdata *u;
+    audio_info_t info;
+
+    pa_assert_se(u = s->userdata);
+
+    if (u->fd >= 0) {
+        AUDIO_INITINFO(&info);
+
+        info.play.gain = pa_cvolume_avg(&s->virtual_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+        assert(info.play.gain <= AUDIO_MAX_GAIN);
+
+        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
+            if (errno == EINVAL)
+                pa_log("AUDIO_SETINFO: Unsupported volume.");
+            else
+                pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        }
     }
+}
 
-    return pa_source_process_msg(o, code, data, offset, chunk);
+static void sink_get_volume(pa_sink *s) {
+    struct userdata *u;
+    audio_info_t info;
+
+    pa_assert_se(u = s->userdata);
+
+    if (u->fd >= 0) {
+        if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0)
+            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        else
+            pa_cvolume_set(&s->virtual_volume, s->sample_spec.channels,
+                info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
+    }
 }
 
-static void clear_underflow(struct userdata *u)
-{
+static void source_set_volume(pa_source *s) {
+    struct userdata *u;
     audio_info_t info;
 
-    AUDIO_INITINFO(&info);
+    pa_assert_se(u = s->userdata);
+
+    if (u->fd >= 0) {
+        AUDIO_INITINFO(&info);
 
-    info.play.error = 0;
+        info.play.gain = pa_cvolume_avg(&s->virtual_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+        assert(info.play.gain <= AUDIO_MAX_GAIN);
 
-    if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
-        pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
+            if (errno == EINVAL)
+                pa_log("AUDIO_SETINFO: Unsupported volume.");
+            else
+                pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        }
+    }
 }
 
-static void clear_overflow(struct userdata *u)
-{
+static void source_get_volume(pa_source *s) {
+    struct userdata *u;
     audio_info_t info;
 
-    AUDIO_INITINFO(&info);
+    pa_assert_se(u = s->userdata);
 
-    info.record.error = 0;
+    if (u->fd >= 0) {
+        if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0)
+            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        else
+            pa_cvolume_set(&s->virtual_volume, s->sample_spec.channels,
+                info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
+    }
+}
+
+static void sink_set_mute(pa_sink *s) {
+    struct userdata *u = s->userdata;
+    audio_info_t info;
 
-    if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
-        pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+    pa_assert(u);
+
+    if (u->fd >= 0) {
+        AUDIO_INITINFO(&info);
+
+        info.output_muted = !!s->muted;
+
+        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
+            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+    }
+}
+
+static void sink_get_mute(pa_sink *s) {
+    struct userdata *u = s->userdata;
+    audio_info_t info;
+
+    pa_assert(u);
+
+    if (u->fd >= 0) {
+        if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0)
+            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+        else
+            s->muted = !!info.output_muted;
+    }
 }
 
 static void thread_func(void *userdata) {
     struct userdata *u = userdata;
     unsigned short revents = 0;
-    int ret;
+    int ret, err;
+    audio_info_t info;
 
     pa_assert(u);
 
     pa_log_debug("Thread starting up");
 
-    if (u->core->high_priority)
-        pa_make_realtime();
+    if (u->core->realtime_scheduling)
+        pa_make_realtime(u->core->realtime_priority);
 
     pa_thread_mq_install(&u->thread_mq);
     pa_rtpoll_install(u->rtpoll);
@@ -298,139 +599,158 @@ static void thread_func(void *userdata) {
     for (;;) {
         /* Render some data and write it to the dsp */
 
-        if (u->sink && PA_SINK_OPENED(u->sink->thread_info.state)) {
-            audio_info_t info;
-            int err;
-            size_t len;
+        if (u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
+            pa_usec_t xtime0;
+            uint64_t buffered_bytes;
+
+            if (u->sink->thread_info.rewind_requested)
+                pa_sink_process_rewind(u->sink, 0);
 
             err = ioctl(u->fd, AUDIO_GETINFO, &info);
             pa_assert(err >= 0);
 
-            /*
-             * Since we cannot modify the size of the output buffer we fake it
-             * by not filling it more than u->buffer_size.
-             */
-            len = u->buffer_size;
-            len -= u->written_bytes - (info.play.samples * u->frame_size);
-
-            /* The sample counter can sometimes go backwards :( */
-            if (len > u->buffer_size)
-                len = 0;
-
             if (info.play.error) {
-                pa_log_debug("Solaris buffer underflow!");
-                clear_underflow(u);
-            }
+                pa_log_debug("buffer under-run!");
 
-            len -= len % u->frame_size;
+                AUDIO_INITINFO(&info);
+                info.play.error = 0;
+                if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
+                    pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+            }
 
-            while (len) {
+            for (;;) {
                 void *p;
-                ssize_t r;
+                ssize_t w;
+                size_t len;
+
+                /*
+                 * Since we cannot modify the size of the output buffer we fake it
+                 * by not filling it more than u->buffer_size.
+                 */
+                xtime0 = pa_rtclock_usec();
+                buffered_bytes = get_playback_buffered_bytes(u);
+                if (buffered_bytes >= (uint64_t)u->buffer_size)
+                    break;
 
-                if (!u->memchunk.length)
-                    pa_sink_render(u->sink, len, &u->memchunk);
+                len = u->buffer_size - buffered_bytes;
+                len -= len % u->frame_size;
 
-                pa_assert(u->memchunk.length);
+                if (len < u->min_request)
+                    break;
+
+                if (u->memchunk.length < len)
+                    pa_sink_render(u->sink, u->sink->thread_info.max_request, &u->memchunk);
 
                 p = pa_memblock_acquire(u->memchunk.memblock);
-                r = pa_write(u->fd, (uint8_t*) p + u->memchunk.index, u->memchunk.length, NULL);
+                w = pa_write(u->fd, (uint8_t*) p + u->memchunk.index, u->memchunk.length, NULL);
                 pa_memblock_release(u->memchunk.memblock);
 
-                if (r < 0) {
-                    if (errno == EINTR)
-                        continue;
-                    else if (errno != EAGAIN) {
-                        pa_log("Failed to read data from DSP: %s", pa_cstrerror(errno));
-                        goto fail;
+                if (w <= 0) {
+                    switch (errno) {
+                        case EINTR:
+                            break;
+                        case EAGAIN:
+                            u->buffer_size = u->buffer_size * 18 / 25;
+                            u->buffer_size -= u->buffer_size % u->frame_size;
+                            u->buffer_size = PA_MAX(u->buffer_size, (int32_t)MIN_BUFFER_SIZE);
+                            pa_sink_set_max_request(u->sink, u->buffer_size);
+                            pa_log("EAGAIN. Buffer size is now %u bytes (%llu buffered)", u->buffer_size, buffered_bytes);
+                            break;
+                        default:
+                            pa_log("Failed to write data to DSP: %s", pa_cstrerror(errno));
+                            goto fail;
                     }
                 } else {
-                    pa_assert(r % u->frame_size == 0);
+                    pa_assert(w % u->frame_size == 0);
 
-                    u->memchunk.index += r;
-                    u->memchunk.length -= r;
+                    pa_mutex_lock(u->written_bytes_lock);
+                    u->written_bytes += w;
+                    u->memchunk.length -= w;
+                    pa_mutex_unlock(u->written_bytes_lock);
 
+                    u->memchunk.index += w;
                     if (u->memchunk.length <= 0) {
                         pa_memblock_unref(u->memchunk.memblock);
                         pa_memchunk_reset(&u->memchunk);
                     }
-
-                    len -= r;
-                    u->written_bytes += r;
                 }
             }
+
+            pa_rtpoll_set_timer_absolute(u->rtpoll, xtime0 + pa_bytes_to_usec(buffered_bytes / 2, &u->sink->sample_spec));
+        } else {
+            pa_rtpoll_set_timer_disabled(u->rtpoll);
         }
 
         /* Try to read some data and pass it on to the source driver */
 
-        if (u->source && PA_SOURCE_OPENED(u->source->thread_info.state) && ((revents & POLLIN))) {
+        if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state) && (revents & POLLIN)) {
             pa_memchunk memchunk;
-            int err;
-            size_t l;
             void *p;
             ssize_t r;
-            audio_info_t info;
+            size_t len;
 
             err = ioctl(u->fd, AUDIO_GETINFO, &info);
             pa_assert(err >= 0);
 
             if (info.record.error) {
-                pa_log_debug("Solaris buffer overflow!");
-                clear_overflow(u);
+                pa_log_debug("buffer overflow!");
+
+                AUDIO_INITINFO(&info);
+                info.record.error = 0;
+                if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0)
+                    pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
             }
 
-            err = ioctl(u->fd, I_NREAD, &l);
+            err = ioctl(u->fd, I_NREAD, &len);
             pa_assert(err >= 0);
 
-            if (l > 0) {
-                /* This is to make sure it fits in the memory pool. Also, a page
-                   should be the most efficient transfer size. */
-                if (l > u->page_size)
-                    l = u->page_size;
-
-                memchunk.memblock = pa_memblock_new(u->core->mempool, l);
+            if (len > 0) {
+                memchunk.memblock = pa_memblock_new(u->core->mempool, len);
                 pa_assert(memchunk.memblock);
 
                 p = pa_memblock_acquire(memchunk.memblock);
-                r = pa_read(u->fd, p, l, NULL);
+                r = pa_read(u->fd, p, len, NULL);
                 pa_memblock_release(memchunk.memblock);
 
                 if (r < 0) {
                     pa_memblock_unref(memchunk.memblock);
-                    if (errno != EAGAIN) {
+                    if (errno == EAGAIN)
+                        break;
+                    else {
                         pa_log("Failed to read data from DSP: %s", pa_cstrerror(errno));
                         goto fail;
                     }
                 } else {
+                    u->read_bytes += r;
+
                     memchunk.index = 0;
                     memchunk.length = r;
 
                     pa_source_post(u->source, &memchunk);
                     pa_memblock_unref(memchunk.memblock);
 
-                    u->read_bytes += r;
-
                     revents &= ~POLLIN;
                 }
             }
         }
 
-        if (u->fd >= 0) {
+        if (u->rtpoll_item) {
             struct pollfd *pollfd;
 
+            pa_assert(u->fd >= 0);
+
             pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
-            pollfd->events =
-                ((u->source && PA_SOURCE_OPENED(u->source->thread_info.state)) ? POLLIN : 0);
+            pollfd->events = (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) ? POLLIN : 0;
         }
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, 1)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)
             goto fail;
 
         if (ret == 0)
             goto finish;
 
-        if (u->fd >= 0) {
+        if (u->rtpoll_item) {
             struct pollfd *pollfd;
 
             pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
@@ -460,112 +780,29 @@ static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void
 
     assert(u);
 
+    pa_log_debug("caught signal");
+
     if (u->sink) {
-        pa_sink_get_volume(u->sink);
-        pa_sink_get_mute(u->sink);
+        pa_sink_get_volume(u->sink, TRUE);
+        pa_sink_get_mute(u->sink, TRUE);
     }
 
     if (u->source)
-        pa_source_get_volume(u->source);
-}
-
-static int pa_solaris_auto_format(int fd, int mode, pa_sample_spec *ss) {
-    audio_info_t info;
-
-    AUDIO_INITINFO(&info);
-
-    if (mode != O_RDONLY) {
-        info.play.sample_rate = ss->rate;
-        info.play.channels = ss->channels;
-        switch (ss->format) {
-        case PA_SAMPLE_U8:
-            info.play.precision = 8;
-            info.play.encoding = AUDIO_ENCODING_LINEAR;
-            break;
-        case PA_SAMPLE_ALAW:
-            info.play.precision = 8;
-            info.play.encoding = AUDIO_ENCODING_ALAW;
-            break;
-        case PA_SAMPLE_ULAW:
-            info.play.precision = 8;
-            info.play.encoding = AUDIO_ENCODING_ULAW;
-            break;
-        case PA_SAMPLE_S16NE:
-            info.play.precision = 16;
-            info.play.encoding = AUDIO_ENCODING_LINEAR;
-            break;
-        default:
-            return -1;
-        }
-    }
-
-    if (mode != O_WRONLY) {
-        info.record.sample_rate = ss->rate;
-        info.record.channels = ss->channels;
-        switch (ss->format) {
-        case PA_SAMPLE_U8:
-            info.record.precision = 8;
-            info.record.encoding = AUDIO_ENCODING_LINEAR;
-            break;
-        case PA_SAMPLE_ALAW:
-            info.record.precision = 8;
-            info.record.encoding = AUDIO_ENCODING_ALAW;
-            break;
-        case PA_SAMPLE_ULAW:
-            info.record.precision = 8;
-            info.record.encoding = AUDIO_ENCODING_ULAW;
-            break;
-        case PA_SAMPLE_S16NE:
-            info.record.precision = 16;
-            info.record.encoding = AUDIO_ENCODING_LINEAR;
-            break;
-        default:
-            return -1;
-        }
-    }
-
-    if (ioctl(fd, AUDIO_SETINFO, &info) < 0) {
-        if (errno == EINVAL)
-            pa_log("AUDIO_SETINFO: Unsupported sample format.");
-        else
-            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
-        return -1;
-    }
-
-    return 0;
-}
-
-static int pa_solaris_set_buffer(int fd, int buffer_size) {
-    audio_info_t info;
-
-    AUDIO_INITINFO(&info);
-
-    info.play.buffer_size = buffer_size;
-    info.record.buffer_size = buffer_size;
-
-    if (ioctl(fd, AUDIO_SETINFO, &info) < 0) {
-        if (errno == EINVAL)
-            pa_log("AUDIO_SETINFO: Unsupported buffer size.");
-        else
-            pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
-        return -1;
-    }
-
-    return 0;
+        pa_source_get_volume(u->source, TRUE);
 }
 
 int pa__init(pa_module *m) {
     struct userdata *u = NULL;
-    const char *p;
-    int fd = -1;
-    int buffer_size;
-    int mode;
-    int record = 1, playback = 1;
+    pa_bool_t record = TRUE, playback = TRUE;
     pa_sample_spec ss;
     pa_channel_map map;
     pa_modargs *ma = NULL;
-    char *t;
-    struct pollfd *pollfd;
+    int fd;
+    pa_sink_new_data sink_new_data;
+    pa_source_new_data source_new_data;
+    char const *name;
+    char *name_buf;
+    pa_bool_t namereg_fail;
 
     pa_assert(m);
 
@@ -575,7 +812,7 @@ int pa__init(pa_module *m) {
     }
 
     if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) {
-        pa_log("record= and playback= expect numeric argument.");
+        pa_log("record= and playback= expect a boolean argument.");
         goto fail;
     }
 
@@ -584,97 +821,133 @@ int pa__init(pa_module *m) {
         goto fail;
     }
 
-    mode = (playback&&record) ? O_RDWR : (playback ? O_WRONLY : (record ? O_RDONLY : 0));
+    u = pa_xnew0(struct userdata, 1);
+    u->sample_counter_lock = pa_mutex_new(FALSE, FALSE);
+    u->written_bytes_lock = pa_mutex_new(FALSE, FALSE);
 
-    buffer_size = 16384;
-    if (pa_modargs_get_value_s32(ma, "buffer_size", &buffer_size) < 0) {
-        pa_log("failed to parse buffer size argument");
-        goto fail;
-    }
+    /*
+     * For a process (or several processes) to use the same audio device for both
+     * record and playback at the same time, the device's mixer must be enabled.
+     * See mixerctl(1). It may be turned off for playback only or record only.
+     */
+    u->mode = (playback && record) ? O_RDWR : (playback ? O_WRONLY : (record ? O_RDONLY : 0));
 
     ss = m->core->default_sample_spec;
     if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0) {
         pa_log("failed to parse sample specification");
         goto fail;
     }
+    u->frame_size = pa_frame_size(&ss);
 
-    if ((fd = open(p = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), mode | O_NONBLOCK)) < 0)
+    u->buffer_size = 16384;
+    if (pa_modargs_get_value_s32(ma, "buffer_size", &u->buffer_size) < 0) {
+        pa_log("failed to parse buffer size argument");
         goto fail;
-
-    pa_log_info("device opened in %s mode.", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR"));
-
-    if (pa_solaris_auto_format(fd, mode, &ss) < 0)
+    }
+    u->buffer_size -= u->buffer_size % u->frame_size;
+    if (u->buffer_size < (int32_t)MIN_BUFFER_SIZE) {
+        pa_log("supplied buffer size argument is too small");
         goto fail;
+    }
+
+    u->device_name = pa_xstrdup(pa_modargs_get_value(ma, "device", DEFAULT_DEVICE));
 
-    if (pa_solaris_set_buffer(fd, buffer_size) < 0)
+    if ((fd = open_audio_device(u, &ss)) < 0)
         goto fail;
 
-    u = pa_xmalloc(sizeof(struct userdata));
     u->core = m->core;
-
-    u->fd = fd;
-
-    pa_memchunk_reset(&u->memchunk);
-
-    /* We use this to get a reasonable chunk size */
-    u->page_size = PA_PAGE_SIZE;
-
-    u->frame_size = pa_frame_size(&ss);
-    u->buffer_size = buffer_size;
-
-    u->written_bytes = 0;
-    u->read_bytes = 0;
-
     u->module = m;
     m->userdata = u;
 
-    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
+    pa_memchunk_reset(&u->memchunk);
 
     u->rtpoll = pa_rtpoll_new();
-    pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
 
-    pa_rtpoll_set_timer_periodic(u->rtpoll, pa_bytes_to_usec(u->buffer_size / 10, &ss));
+    u->rtpoll_item = NULL;
+    build_pollfd(u);
 
-    u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
-    pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
-    pollfd->fd = fd;
-    pollfd->events = 0;
-    pollfd->revents = 0;
+    if (u->mode != O_WRONLY) {
+        name_buf = NULL;
+        namereg_fail = TRUE;
 
-    if (mode != O_WRONLY) {
-        u->source = pa_source_new(m->core, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map);
-        pa_assert(u->source);
+        if (!(name = pa_modargs_get_value(ma, "source_name", NULL))) {
+            name = name_buf = pa_sprintf_malloc("solaris_input.%s", pa_path_get_filename(u->device_name));
+            namereg_fail = FALSE;
+        }
+
+        pa_source_new_data_init(&source_new_data);
+        source_new_data.driver = __FILE__;
+        source_new_data.module = m;
+        pa_source_new_data_set_name(&source_new_data, name);
+        source_new_data.namereg_fail = namereg_fail;
+        pa_source_new_data_set_sample_spec(&source_new_data, &ss);
+        pa_source_new_data_set_channel_map(&source_new_data, &map);
+        pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
+        pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_API, "solaris");
+        pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Solaris PCM source");
+        pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_ACCESS_MODE, "serial");
+        pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) u->buffer_size);
+
+        u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|PA_SOURCE_HW_VOLUME_CTRL);
+        pa_source_new_data_done(&source_new_data);
+        pa_xfree(name_buf);
+
+        if (!u->source) {
+            pa_log("Failed to create source object");
+            goto fail;
+        }
 
         u->source->userdata = u;
         u->source->parent.process_msg = source_process_msg;
 
-        pa_source_set_module(u->source, m);
-        pa_source_set_description(u->source, t = pa_sprintf_malloc("Solaris PCM on '%s'", p));
-        pa_xfree(t);
         pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
         pa_source_set_rtpoll(u->source, u->rtpoll);
 
-        u->source->flags = PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|PA_SOURCE_HW_VOLUME_CTRL;
-        u->source->refresh_volume = 1;
+        u->source->get_volume = source_get_volume;
+        u->source->set_volume = source_set_volume;
+        u->source->refresh_volume = TRUE;
     } else
         u->source = NULL;
 
-    if (mode != O_RDONLY) {
-        u->sink = pa_sink_new(m->core, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map);
-        pa_assert(u->sink);
+    if (u->mode != O_RDONLY) {
+        name_buf = NULL;
+        namereg_fail = TRUE;
+        if (!(name = pa_modargs_get_value(ma, "sink_name", NULL))) {
+            name = name_buf = pa_sprintf_malloc("solaris_output.%s", pa_path_get_filename(u->device_name));
+            namereg_fail = FALSE;
+        }
+
+        pa_sink_new_data_init(&sink_new_data);
+        sink_new_data.driver = __FILE__;
+        sink_new_data.module = m;
+        pa_sink_new_data_set_name(&sink_new_data, name);
+        sink_new_data.namereg_fail = namereg_fail;
+        pa_sink_new_data_set_sample_spec(&sink_new_data, &ss);
+        pa_sink_new_data_set_channel_map(&sink_new_data, &map);
+        pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
+        pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_API, "solaris");
+        pa_proplist_setf(sink_new_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Solaris PCM sink");
+        pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_ACCESS_MODE, "serial");
+
+        u->sink = pa_sink_new(m->core, &sink_new_data, PA_SINK_HARDWARE|PA_SINK_LATENCY|PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL);
+        pa_sink_new_data_done(&sink_new_data);
 
+        pa_assert(u->sink);
         u->sink->userdata = u;
         u->sink->parent.process_msg = sink_process_msg;
 
-        pa_sink_set_module(u->sink, m);
-        pa_sink_set_description(u->sink, t = pa_sprintf_malloc("Solaris PCM on '%s'", p));
-        pa_xfree(t);
         pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
         pa_sink_set_rtpoll(u->sink, u->rtpoll);
 
-        u->sink->flags = PA_SINK_HARDWARE|PA_SINK_LATENCY|PA_SINK_HW_VOLUME_CTRL;
-        u->sink->refresh_volume = 1;
-        u->sink->refresh_mute = 1;
+        u->sink->get_volume = sink_get_volume;
+        u->sink->set_volume = sink_set_volume;
+        u->sink->get_mute = sink_get_mute;
+        u->sink->set_mute = sink_set_mute;
+        u->sink->refresh_volume = u->sink->refresh_muted = TRUE;
+
+        u->sink->thread_info.max_request = u->buffer_size;
+        u->min_request = pa_usec_to_bytes(PA_USEC_PER_SEC / MAX_RENDER_HZ, &ss);
     } else
         u->sink = NULL;
 
@@ -690,17 +963,28 @@ int pa__init(pa_module *m) {
     }
 
     /* Read mixer settings */
-    if (u->source)
-        pa_asyncmsgq_send(u->thread_mq.inq, PA_MSGOBJECT(u->source), PA_SOURCE_MESSAGE_GET_VOLUME, &u->source->volume, 0, NULL);
     if (u->sink) {
-        pa_asyncmsgq_send(u->thread_mq.inq, PA_MSGOBJECT(u->sink), PA_SINK_MESSAGE_GET_VOLUME, &u->sink->volume, 0, NULL);
-        pa_asyncmsgq_send(u->thread_mq.inq, PA_MSGOBJECT(u->sink), PA_SINK_MESSAGE_GET_MUTE, &u->sink->muted, 0, NULL);
-    }
+        if (sink_new_data.volume_is_set)
+            u->sink->set_volume(u->sink);
+        else
+            u->sink->get_volume(u->sink);
+
+        if (sink_new_data.muted_is_set)
+            u->sink->set_mute(u->sink);
+        else
+            u->sink->get_mute(u->sink);
 
-    if (u->sink)
         pa_sink_put(u->sink);
-    if (u->source)
+    }
+
+    if (u->source) {
+        if (source_new_data.volume_is_set)
+            u->source->set_volume(u->source);
+        else
+            u->source->get_volume(u->source);
+
         pa_source_put(u->source);
+    }
 
     pa_modargs_free(ma);
 
@@ -748,7 +1032,7 @@ void pa__done(pa_module *m) {
     if (u->source)
         pa_source_unref(u->source);
 
-     if (u->memchunk.memblock)
+    if (u->memchunk.memblock)
         pa_memblock_unref(u->memchunk.memblock);
 
     if (u->rtpoll_item)
@@ -760,5 +1044,10 @@ void pa__done(pa_module *m) {
     if (u->fd >= 0)
         close(u->fd);
 
+    pa_mutex_free(u->written_bytes_lock);
+    pa_mutex_free(u->sample_counter_lock);
+
+    pa_xfree(u->device_name);
+
     pa_xfree(u);
 }
index d935caf6dc43a7824fd31c00f6830e82387272c6..723b5d7397b7b553b6a3cf693f9c0e95b19c9542 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a5a3571c5a592aeb521e76b12e5ca8e2aba7125a..7e17f8f75085c491c99d87d85d91feacb81f18b8 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -149,7 +149,12 @@ static pa_hook_result_t source_output_fixate_hook_cb(pa_core *c, pa_source_outpu
     pa_assert(data);
     pa_assert(u);
 
-    if ((d = pa_hashmap_get(u->device_infos, data->source)))
+    if (data->source->monitor_of)
+        d = pa_hashmap_get(u->device_infos, data->source->monitor_of);
+    else
+        d = pa_hashmap_get(u->device_infos, data->source);
+
+    if (d)
         resume(d);
 
     return PA_HOOK_OK;
@@ -173,6 +178,8 @@ static pa_hook_result_t sink_input_unlink_hook_cb(pa_core *c, pa_sink_input *s,
 }
 
 static pa_hook_result_t source_output_unlink_hook_cb(pa_core *c, pa_source_output *s, struct userdata *u) {
+    struct device_info *d = NULL;
+
     pa_assert(c);
     pa_source_output_assert_ref(s);
     pa_assert(u);
@@ -180,12 +187,17 @@ static pa_hook_result_t source_output_unlink_hook_cb(pa_core *c, pa_source_outpu
     if (!s->source)
         return PA_HOOK_OK;
 
-    if (pa_source_check_suspend(s->source) <= 0) {
-        struct device_info *d;
-        if ((d = pa_hashmap_get(u->device_infos, s->source)))
-            restart(d);
+    if (s->source->monitor_of) {
+        if (pa_sink_check_suspend(s->source->monitor_of) <= 0)
+            d = pa_hashmap_get(u->device_infos, s->source->monitor_of);
+    } else {
+        if (pa_source_check_suspend(s->source) <= 0)
+            d = pa_hashmap_get(u->device_infos, s->source);
     }
 
+    if (d)
+        restart(d);
+
     return PA_HOOK_OK;
 }
 
@@ -217,15 +229,22 @@ static pa_hook_result_t sink_input_move_finish_hook_cb(pa_core *c, pa_sink_input
 }
 
 static pa_hook_result_t source_output_move_start_hook_cb(pa_core *c, pa_source_output *s, struct userdata *u) {
-    struct device_info *d;
+    struct device_info *d = NULL;
 
     pa_assert(c);
     pa_source_output_assert_ref(s);
     pa_assert(u);
 
-    if (pa_source_check_suspend(s->source) <= 1)
-        if ((d = pa_hashmap_get(u->device_infos, s->source)))
-            restart(d);
+    if (s->source->monitor_of) {
+        if (pa_sink_check_suspend(s->source->monitor_of) <= 1)
+            d = pa_hashmap_get(u->device_infos, s->source->monitor_of);
+    } else {
+        if (pa_source_check_suspend(s->source) <= 1)
+            d = pa_hashmap_get(u->device_infos, s->source);
+    }
+
+    if (d)
+        restart(d);
 
     return PA_HOOK_OK;
 }
@@ -237,7 +256,12 @@ static pa_hook_result_t source_output_move_finish_hook_cb(pa_core *c, pa_source_
     pa_source_output_assert_ref(s);
     pa_assert(u);
 
-    if ((d = pa_hashmap_get(u->device_infos, s->source)))
+    if (s->source->monitor_of)
+        d = pa_hashmap_get(u->device_infos, s->source->monitor_of);
+    else
+        d = pa_hashmap_get(u->device_infos, s->source);
+
+    if (d)
         resume(d);
 
     return PA_HOOK_OK;
@@ -259,16 +283,25 @@ static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, pa_sink_inp
 }
 
 static pa_hook_result_t source_output_state_changed_hook_cb(pa_core *c, pa_source_output *s, struct userdata *u) {
-    struct device_info *d;
     pa_source_output_state_t state;
+
     pa_assert(c);
     pa_source_output_assert_ref(s);
     pa_assert(u);
 
     state = pa_source_output_get_state(s);
-    if (state == PA_SOURCE_OUTPUT_RUNNING)
-        if ((d = pa_hashmap_get(u->device_infos, s->source)))
+
+    if (state == PA_SOURCE_OUTPUT_RUNNING) {
+        struct device_info *d;
+
+        if (s->source->monitor_of)
+            d = pa_hashmap_get(u->device_infos, s->source->monitor_of);
+        else
+            d = pa_hashmap_get(u->device_infos, s->source);
+
+        if (d)
             resume(d);
+    }
 
     return PA_HOOK_OK;
 }
@@ -285,6 +318,10 @@ static pa_hook_result_t device_new_hook_cb(pa_core *c, pa_object *o, struct user
     source = pa_source_isinstance(o) ? PA_SOURCE(o) : NULL;
     sink = pa_sink_isinstance(o) ? PA_SINK(o) : NULL;
 
+    /* Never suspend monitors */
+    if (source && source->monitor_of)
+        return PA_HOOK_OK;
+
     pa_assert(source || sink);
 
     d = pa_xnew(struct device_info, 1);
index 63ae740aba6ebb92c83c0488a95dd72a030ee1b3..c148884147f143293ad5b1bdfc511d10eb9ccd2a 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 21c714915f6635d71ef074c957a9275a24248840..61858afa955463602d0ae2671e8631fc737f1c51 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b452c3bfb11cf7c09361ebdce913cd0a20361895..2d35828d8f188c6cfeee6e6d086ca5211f2639ca 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index bef02536aaef5d9de505b49664ef36ce9fdffe3a..ac303c3bb7d284b108e506a94db7511170a76386 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 0c9aedf47c878af9be05d39522103c0cde4ab3e6..c1380c271f67936710368774407e3a5968872d64 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fb27eba283bd97f1ce3cceb62f57398dbdd180e9..7d71067bdab37297437d7203228554940dfa79e6 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5fc8047d839391479f9bf1d7353c047f471c7722..28fd373a2bca28593b75b98b14274f2c1bec671c 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5123ead897185ae1b6f0ccb42e13ec27945f51c5..3da946e02cc1f4fa627bba79d9454864cf03e0fe 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 985564f4c80c5b40570e14753461a5997b94bf5f..692ffe912dfffec830aad18fd733eab1a986a56a 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 54d1679f74f9e90f767a988ecfc8478cac658b9a..7bce8d006344758a8dcd073422d8bff7cdfb288b 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f04b875d3d29290947a116672cc1900e9d3d4b38..5a109ae98196ee374196fa04e7824e4e26d485e5 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 654f7bbab87921f735ac2921ac4065379efdd21a..845b0c8f56992aaaf50e1cab9091759bed3da5cb 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 059c702842fe8d00dabf04191f76b24610bf524b..e1cbed026987913e6d4411365b996b15f1f55643 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index dac0e707c16a89efd39ae32691f4c2ad99db79b7..7a973b686b20e9b566f2e3c58ca95a9355910fbe 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4627545e1aa14ef70c4e1cc2345bef28091465ad..b3f243c3516cb72e43430cc0ba553a78e430f56d 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 #include <pulsecore/macro.h>
 #include <pulsecore/strbuf.h>
 #include <pulsecore/random.h>
+
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#else
 #include <pulsecore/poll.h>
+#endif
 
 #include "raop_client.h"
 #include "rtsp_client.h"
@@ -339,9 +344,13 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
             break;
 
         case STATE_TEARDOWN:
+            pa_log_debug("RAOP: TEARDOWN");
+            break;
+
         case STATE_SET_PARAMETER:
             pa_log_debug("RAOP: SET_PARAMETER");
             break;
+
         case STATE_DISCONNECTED:
             pa_assert(c->closed_callback);
             pa_assert(c->rtsp);
index ec3136a776cd539073eab7b9d93d7e6952a87e51..5ad3e3fad8a17b7b36c967c0ceaa8555fdeb1762 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 709cb0603bc1a2c07f52a325a67ba90a9a041511..7d339270d7b8bda2560a3b6391eb0d09f77a1afe 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4625fe68d70d123094823681375f759f3c243eaa..2b97c91c36d34deabf9d3086f80c7faafaccdb61 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ceb1ad11cb480914c7fbb70399f537942dc3fece..b315a08cc69d2dcdb5835d0e89b6064340cd5051 100644 (file)
 typedef struct rd_device rd_device;
 
 /* Prototype for a function that is called whenever someone else wants
- * your app to release the device you having locked. A return value <=
- * 0 denies the request, a positive return value agrees to it. Before
- * returning your application should close the device in question
- * completely to make sure the new application may acceess it. */
+ * your application to release the device it has locked. A return
+ * value <= 0 denies the request, a positive return value agrees to
+ * it. Before returning your application should close the device in
+ * question completely to make sure the new application may access
+ * it. */
 typedef int (*rd_request_cb_t)(
        rd_device *d,
        int forced);                  /* Non-zero if an application forcibly took the lock away without asking. If this is the case then the return value of this call is ignored. */
@@ -48,20 +49,20 @@ int rd_acquire(
        const char *device_name,      /* The device to lock, e.g. "Audio0" */
        const char *application_name, /* A human readable name of the application, e.g. "PulseAudio Sound Server" */
        int32_t priority,             /* The priority for this application. If unsure use 0 */
-       rd_request_cb_t request_cb,   /* Will be called whenever someone asks that this device shall be released. May be NULL if priority is INT32_MAX */
+       rd_request_cb_t request_cb,   /* Will be called whenever someone requests that this device shall be released. May be NULL if priority is INT32_MAX */
        DBusError *error);            /* If we fail due to a D-Bus related issue the error will be filled in here. May be NULL. */
 
-/* Unlock (if needed) and destroy a rd_device object again */
+/* Unlock (if needed) and destroy an rd_device object again */
 void rd_release(rd_device *d);
 
-/* Set the application device name for a rd_device object Returns 0 on
- * success, a negative errno style return value on error. */
+/* Set the application device name for an rd_device object. Returns 0
+ * on success, a negative errno style return value on error. */
 int rd_set_application_device_name(rd_device *d, const char *name);
 
-/* Attach a userdata pointer to a rd_device */
+/* Attach a userdata pointer to an rd_device */
 void rd_set_userdata(rd_device *d, void *userdata);
 
-/* Query the userdata pointer from a rd_device. Returns NULL if no
+/* Query the userdata pointer from an rd_device. Returns NULL if no
  * userdata was set. */
 void* rd_get_userdata(rd_device *d);
 
index 0d86459e99600dd42050c28d169059c6d1bc2e0d..33e23af20756c79b0bcff014d96cf9c7ee53a775 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fef745a1ad1f95af3ca4b1447ce125b7aa0b1cae..722d12bd921eb1e9903af5003d2e387bbf150d77 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c09c321f32a4475b524d68aee9ed7d5f84372614..7537c1f52b4e202b717f43bb182ad04cc4265c40 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a2728f054546caee92804de5d9d461ee9a492854..eff5e75b81971973c1d4efa63b2320536949ba58 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9eb3d9648bbeec6ff482988214c0de62c7ebeef8..98db05dd66cd312e53df4e5086968540b3e6ced3 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/strbuf.h>
-#include <pulsecore/poll.h>
 #include <pulsecore/ioline.h>
 
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#else
+#include <pulsecore/poll.h>
+#endif
+
 #include "rtsp_client.h"
 
 struct pa_rtsp_client {
@@ -101,26 +106,27 @@ pa_rtsp_client* pa_rtsp_client_new(pa_mainloop_api *mainloop, const char* hostna
 
 
 void pa_rtsp_client_free(pa_rtsp_client* c) {
-    if (c) {
-        if (c->sc)
-            pa_socket_client_unref(c->sc);
-        if (c->ioline)
-            pa_ioline_close(c->ioline);
-        else if (c->io)
-            pa_iochannel_free(c->io);
-
-        pa_xfree(c->hostname);
-        pa_xfree(c->url);
-        pa_xfree(c->localip);
-        pa_xfree(c->session);
-        pa_xfree(c->transport);
-        pa_xfree(c->last_header);
-        if (c->header_buffer)
-            pa_strbuf_free(c->header_buffer);
-        if (c->response_headers)
-            pa_headerlist_free(c->response_headers);
-        pa_headerlist_free(c->headers);
-    }
+    pa_assert(c);
+
+    if (c->sc)
+        pa_socket_client_unref(c->sc);
+    if (c->ioline)
+        pa_ioline_close(c->ioline);
+    else if (c->io)
+        pa_iochannel_free(c->io);
+
+    pa_xfree(c->hostname);
+    pa_xfree(c->url);
+    pa_xfree(c->localip);
+    pa_xfree(c->session);
+    pa_xfree(c->transport);
+    pa_xfree(c->last_header);
+    if (c->header_buffer)
+        pa_strbuf_free(c->header_buffer);
+    if (c->response_headers)
+        pa_headerlist_free(c->response_headers);
+    pa_headerlist_free(c->headers);
+
     pa_xfree(c);
 }
 
@@ -141,8 +147,6 @@ static void headers_read(pa_rtsp_client *c) {
         c->transport = pa_xstrdup(pa_headerlist_gets(c->response_headers, "Transport"));
 
         if (!c->session || !c->transport) {
-            pa_headerlist_free(c->response_headers);
-            c->response_headers = NULL;
             pa_log("Invalid SETUP response.");
             return;
         }
@@ -160,8 +164,6 @@ static void headers_read(pa_rtsp_client *c) {
         }
         if (0 == c->rtp_port) {
             /* Error no server_port in response */
-            pa_headerlist_free(c->response_headers);
-            c->response_headers = NULL;
             pa_log("Invalid SETUP response (no port number).");
             return;
         }
@@ -169,9 +171,6 @@ static void headers_read(pa_rtsp_client *c) {
 
     /* Call our callback */
     c->callback(c, c->state, c->response_headers, c->userdata);
-
-    pa_headerlist_free(c->response_headers);
-    c->response_headers = NULL;
 }
 
 
@@ -201,7 +200,8 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
     }
     if (c->waiting && 0 == strcmp("RTSP/1.0 200 OK", s2)) {
         c->waiting = 0;
-        pa_assert(!c->response_headers);
+        if (c->response_headers)
+            pa_headerlist_free(c->response_headers);
         c->response_headers = pa_headerlist_new();
         goto exit;
     }
@@ -353,9 +353,12 @@ void pa_rtsp_set_callback(pa_rtsp_client *c, pa_rtsp_cb_t callback, void *userda
 void pa_rtsp_disconnect(pa_rtsp_client *c) {
     pa_assert(c);
 
-    if (c->io)
+    if (c->ioline)
+        pa_ioline_close(c->ioline);
+    else if (c->io)
         pa_iochannel_free(c->io);
     c->io = NULL;
+    c->ioline = NULL;
 }
 
 
index 88fb3839d320919147ca8489fbb4b9ef6ac69fa9..b229f2618e6211b6041ac131e0dbc5b7f392e249 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b5d9df62c3f3491891765f3888a04c28d74dfbe7..adde16df2708db564e3097c86b3332bd7563454a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 69c757cb7f3a5f6f3cf851bc10cf040670872a3d..ae4ad42662f3b725154eb8ffa8fee0c51e234d83 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7c5474304ade74247ec3752ea4e761c2bae6fce1..7fc7e38cbff01a02df6c65db96912f316004215a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 933a602b7e9797e4b4d23406a73c1377d6639f3a..4cb3b203bf50c8fe8dd7f40f38cac1bd98c4447a 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
diff --git a/src/modules/udev-util.c b/src/modules/udev-util.c
new file mode 100644 (file)
index 0000000..8ffb76a
--- /dev/null
@@ -0,0 +1,142 @@
+/***
+  This file is part of PulseAudio.
+
+  Copyright 2009 Lennart Poettering
+
+  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.1 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 <libudev.h>
+
+#include <pulse/xmalloc.h>
+#include <pulse/proplist.h>
+
+#include <pulsecore/log.h>
+#include <pulsecore/core-util.h>
+
+#include "udev-util.h"
+
+static int read_id(struct udev_device *d, const char *n) {
+    const char *v;
+    unsigned u;
+
+    pa_assert(d);
+    pa_assert(n);
+
+    if (!(v = udev_device_get_property_value(d, n)))
+        return -1;
+
+    if (pa_startswith(v, "0x"))
+        v += 2;
+
+    if (!*v)
+        return -1;
+
+    if (sscanf(v, "%04x", &u) != 1)
+        return -1;
+
+    if (u > 0xFFFFU)
+        return -1;
+
+    return u;
+}
+
+int pa_udev_get_info(pa_core *core, pa_proplist *p, int card_idx) {
+    int r = -1;
+    struct udev *udev;
+    struct udev_device *card;
+    char *t;
+    const char *v;
+    int id;
+
+    pa_assert(core);
+    pa_assert(p);
+    pa_assert(card_idx >= 0);
+
+    if (!(udev = udev_new())) {
+        pa_log_error("Failed to allocate udev context.");
+        goto finish;
+    }
+
+    t = pa_sprintf_malloc("%s/class/sound/card%i", udev_get_sys_path(udev), card_idx);
+    card = udev_device_new_from_syspath(udev, t);
+    pa_xfree(t);
+
+    if (!card) {
+        pa_log_error("Failed to get card object.");
+        goto finish;
+    }
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_BUS))
+        if ((v = udev_device_get_property_value(card, "ID_BUS")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_BUS, v);
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_ID))
+        if ((id = read_id(card, "ID_VENDOR_ID")) > 0 && *v)
+            pa_proplist_setf(p, PA_PROP_DEVICE_VENDOR_ID, "%04x", id);
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_NAME)) {
+        if ((v = udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v);
+        else if ((v = udev_device_get_property_value(card, "ID_VENDOR")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v);
+    }
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_ID))
+        if ((id = read_id(card, "ID_MODEL_ID")) >= 0)
+            pa_proplist_setf(p, PA_PROP_DEVICE_PRODUCT_ID, "%04x", id);
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_NAME)) {
+        if ((v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
+        else if ((v = udev_device_get_property_value(card, "ID_MODEL")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
+    }
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_SERIAL))
+        if ((v = udev_device_get_property_value(card, "ID_SERIAL")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_SERIAL, v);
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_FORM_FACTOR))
+        if ((v = udev_device_get_property_value(card, "SOUND_FORM_FACTOR")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_FORM_FACTOR, v);
+
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_BUS_PATH))
+        if ((v = udev_device_get_devpath(card)))
+            pa_proplist_sets(p, PA_PROP_DEVICE_BUS_PATH, v);
+
+    /* This is normaly not set by th udev rules but may be useful to
+     * allow administrators to overwrite the device description.*/
+    if (!pa_proplist_contains(p, PA_PROP_DEVICE_DESCRIPTION))
+        if ((v = udev_device_get_property_value(card, "SOUND_DESCRIPTION")) && *v)
+            pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, v);
+
+    r = 0;
+
+finish:
+
+    if (card)
+        udev_device_unref(card);
+
+    if (udev)
+        udev_unref(udev);
+
+    return r;
+}
diff --git a/src/modules/udev-util.h b/src/modules/udev-util.h
new file mode 100644 (file)
index 0000000..5120abd
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef fooudevutilhfoo
+#define fooudevutilhfoo
+
+/***
+  This file is part of PulseAudio.
+
+  Copyright 2009 Lennart Poettering
+
+  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.1 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.
+***/
+
+
+#include <pulsecore/core.h>
+
+int pa_udev_get_info(pa_core *core, pa_proplist *p, int card);
+
+#endif
index 1a3f657f6e76cce2eace717712ce5ee2f5f1d533..4cf5d0c3c0e3acc2c57e89deae8a2dd1f510c007 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 499fae2e7bd02654238264b7d8c4dbc034ba9f52..c843e2a2b920778d52219a0a0ee351ab125020e4 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8c5b2d0faf9bb6f76e56801d2ab3d6b3a0db5347..dd0d14f7b55797e9da5d88284caa124bed4b7110 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 82e36c00f89f81ca043f56dea908c756a925a799..ce7dadc977639a2a6f9e6770d72f8141068194d1 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a6d37d859c79bf877db949961c056adace067d03..eef0ac1794fe905491f7490c588dfe634dbd79dd 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a8a90fb8b371fbf1310599ff92824447ea90c15b..3bec742f3ea5df08ac64cfeedc01ce2028214650 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f2f40e0358f12a9078599e3ad87b1f1cf6760e24..dca9f0d2e88610a4bf774c1c6eaad05c2ed41863 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 71f8443d6dad5dfb7dc48d467684e00f2f44b97a..58bc3f901c98246d5a4ba4c704340f4994b62ccd 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4eac467ea6518115d5206355612e022dbeb371c4..78844a126f8d056fdae9680a446c05118a653e8b 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 62fe53565d3e2022014b0bf0f44ae34f843d3bcd..00dffc2591673673d162fc3277d725c5cd411cd3 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -74,6 +74,7 @@
 #include "internal.h"
 
 #include "client-conf.h"
+#include "fork-detect.h"
 
 #ifdef HAVE_X11
 #include "client-conf-x11.h"
@@ -127,6 +128,9 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
 
     pa_assert(mainloop);
 
+    if (pa_detect_fork())
+        return NULL;
+
     pa_init_i18n();
 
     c = pa_xnew(pa_context, 1);
@@ -822,6 +826,7 @@ int pa_context_connect(
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(c, c->state == PA_CONTEXT_UNCONNECTED, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(c, !(flags & ~PA_CONTEXT_NOAUTOSPAWN), PA_ERR_INVALID);
     PA_CHECK_VALIDITY(c, !server || *server, PA_ERR_INVALID);
@@ -894,6 +899,9 @@ void pa_context_disconnect(pa_context *c) {
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (PA_CONTEXT_IS_GOOD(c->state))
         pa_context_set_state(c, PA_CONTEXT_TERMINATED);
 }
@@ -916,6 +924,9 @@ void pa_context_set_state_callback(pa_context *c, pa_context_notify_cb_t cb, voi
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (c->state == PA_CONTEXT_TERMINATED || c->state == PA_CONTEXT_FAILED)
         return;
 
@@ -927,6 +938,9 @@ void pa_context_set_event_callback(pa_context *c, pa_context_event_cb_t cb, void
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (c->state == PA_CONTEXT_TERMINATED || c->state == PA_CONTEXT_FAILED)
         return;
 
@@ -938,6 +952,7 @@ int pa_context_is_pending(pa_context *c) {
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(c, PA_CONTEXT_IS_GOOD(c->state), PA_ERR_BADSTATE);
 
     return (c->pstream && pa_pstream_is_pending(c->pstream)) ||
@@ -994,6 +1009,7 @@ pa_operation* pa_context_drain(pa_context *c, pa_context_notify_cb_t cb, void *u
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, pa_context_is_pending(c), PA_ERR_BADSTATE);
 
@@ -1042,6 +1058,7 @@ pa_operation* pa_context_send_simple_command(pa_context *c, uint32_t command, pa
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, cb, userdata);
@@ -1068,6 +1085,7 @@ pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_co
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
@@ -1087,6 +1105,7 @@ pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
@@ -1102,6 +1121,7 @@ int pa_context_is_local(pa_context *c) {
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(c, !pa_detect_fork(), PA_ERR_FORKED, -1);
     PA_CHECK_VALIDITY_RETURN_ANY(c, PA_CONTEXT_IS_GOOD(c->state), PA_ERR_BADSTATE, -1);
 
     return !!c->is_local;
@@ -1114,6 +1134,7 @@ pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_su
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(name);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     if (c->version >= 13) {
@@ -1144,8 +1165,8 @@ const char* pa_context_get_server(pa_context *c) {
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
-    if (!c->server)
-        return NULL;
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
+    PA_CHECK_VALIDITY_RETURN_NULL(c, c->server, PA_ERR_NOENTITY);
 
     if (*c->server == '{') {
         char *e = strchr(c->server+1, '}');
@@ -1163,6 +1184,7 @@ uint32_t pa_context_get_server_protocol_version(pa_context *c) {
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(c, !pa_detect_fork(), PA_ERR_FORKED, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(c, PA_CONTEXT_IS_GOOD(c->state), PA_ERR_BADSTATE, PA_INVALID_INDEX);
 
     return c->version;
@@ -1185,6 +1207,7 @@ uint32_t pa_context_get_index(pa_context *c) {
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(c, !pa_detect_fork(), PA_ERR_FORKED, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(c, c->version >= 13, PA_ERR_NOTSUPPORTED, PA_INVALID_INDEX);
 
@@ -1199,6 +1222,7 @@ pa_operation *pa_context_proplist_update(pa_context *c, pa_update_mode_t mode, p
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 13, PA_ERR_NOTSUPPORTED);
@@ -1227,6 +1251,7 @@ pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[]
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, keys && keys[0], PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 13, PA_ERR_NOTSUPPORTED);
index 2ae4c013562a2d6cbe5c0df534686896dda18a26..c32cf443d27759c509dff01707dbb66f6a491805 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7f3a0c5d6429e2317f70c4b2b80ee631a852d601..3629aabc7f82078140c75505a73f417d7e8000aa 100644 (file)
@@ -389,6 +389,7 @@ enum {
     PA_ERR_NOEXTENSION,            /**< Extension does not exist. \since 0.9.12 */
     PA_ERR_OBSOLETE,               /**< Obsolete functionality. \since 0.9.15 */
     PA_ERR_NOTIMPLEMENTED,         /**< Missing implementation. \since 0.9.15 */
+    PA_ERR_FORKED,                 /**< The caler forked without calling execve() and tried to reuse the context. \since 0.9.15 */
     PA_ERR_MAX                     /**< Not really an error but the first invalid error code */
 };
 
@@ -417,6 +418,7 @@ enum {
 #define PA_ERR_NOEXTENSION PA_ERR_NOEXTENSION
 #define PA_ERR_OBSOLETE PA_ERR_OBSOLETE
 #define PA_ERR_NOTIMPLEMENTED PA_ERR_NOTIMPLEMENTED
+#define PA_ERR_FORKED PA_ERR_FORKED
 #define PA_ERR_MAX PA_ERR_MAX
 /** \endcond */
 
index d37084bb6b4e29ccdc7fcefab3a846d6e0e81c43..93a13fc6e8589893fb396cb6115c2e9748ad93c0 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -63,12 +63,16 @@ const char*pa_strerror(int error) {
         [PA_ERR_UNKNOWN] = N_("Unknown error code"),
         [PA_ERR_NOEXTENSION] = N_("No such extension"),
         [PA_ERR_OBSOLETE] = N_("Obsolete functionality"),
-        [PA_ERR_NOTIMPLEMENTED] = N_("Missing implementation")
+        [PA_ERR_NOTIMPLEMENTED] = N_("Missing implementation"),
+        [PA_ERR_FORKED] = N_("Client forked")
     };
 
     pa_init_i18n();
 
-    if (error < 0 || error >= PA_ERR_MAX)
+    if (error < 0)
+        error = -error;
+
+    if (error >= PA_ERR_MAX)
         return NULL;
 
     return _(errortab[error]);
index c30b80bd4b77a4bf481cc57606cd1be6963eddca..ea535608d8e3256d2b64f5253427cb158993ea3e 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 469c822a74fc1103ed6115d44e9ea961ef04e897..63c911f805949b1d0d40fd2c4d2803d75dd0cf7c 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -31,6 +31,7 @@
 
 #include "internal.h"
 #include "operation.h"
+#include "fork-detect.h"
 
 #include "ext-stream-restore.h"
 
@@ -87,6 +88,7 @@ pa_operation *pa_ext_stream_restore_test(
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
 
@@ -167,6 +169,7 @@ pa_operation *pa_ext_stream_restore_read(
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
 
@@ -200,6 +203,7 @@ pa_operation *pa_ext_stream_restore_write(
     pa_assert(mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE || mode == PA_UPDATE_SET);
     pa_assert(data);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
 
@@ -262,6 +266,7 @@ pa_operation *pa_ext_stream_restore_delete(
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(s);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
 
@@ -310,6 +315,7 @@ pa_operation *pa_ext_stream_restore_subscribe(
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
 
@@ -334,6 +340,9 @@ void pa_ext_stream_restore_set_subscribe_cb(
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     c->ext_stream_restore.callback = cb;
     c->ext_stream_restore.userdata = userdata;
 }
index cf9f4ccc738db3f0903805d09e4f743db7af7d3b..0b5d8eb65f03f04e82c71a84da40e4edd0d3c5ff 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
diff --git a/src/pulse/fork-detect.c b/src/pulse/fork-detect.c
new file mode 100644 (file)
index 0000000..f10fc02
--- /dev/null
@@ -0,0 +1,59 @@
+/***
+  This file is part of PulseAudio.
+
+  Copyright 2009 Lennart Poettering
+
+  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.1 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 <unistd.h>
+
+#include <pulsecore/atomic.h>
+#include <pulsecore/macro.h>
+
+#include "fork-detect.h"
+
+int pa_detect_fork(void) {
+    static pa_atomic_t pid = PA_ATOMIC_INIT((int) -1);
+
+    /* Some really stupid applications (Hey, vim, that means you!)
+     * love to fork after initializing
+     * gtk/libcanberra/pulseaudio. 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. */
+
+    pa_assert(sizeof(pa_atomic_t) >= sizeof(pid_t));
+
+    for (;;) {
+        pid_t stored_pid = (pid_t) pa_atomic_load(&pid);
+
+        /* First let's check whether the current pid matches the stored one */
+        if (stored_pid == getpid())
+            return FALSE;
+
+        /* Does it contain a different PID than ours? Then the process got forked. */
+        if ((int) stored_pid != (int) -1)
+            return TRUE;
+
+        /* Ok, it still contains no PID, then store it */
+        if (pa_atomic_cmpxchg(&pid, (int) -1, (int) getpid()))
+            return FALSE;
+    }
+}
diff --git a/src/pulse/fork-detect.h b/src/pulse/fork-detect.h
new file mode 100644 (file)
index 0000000..649d981
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef fooforkdetecthfoo
+#define fooforkdetecthfoo
+
+/***
+  This file is part of PulseAudio.
+
+  Copyright 2009 Lennart Poettering
+
+  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.1 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.
+***/
+
+int pa_detect_fork(void);
+
+#endif
index 58188ee29e2c00a6ee94cfed0211834590e12409..e85ecb6617da731eb2286a2c574de5778dd532eb 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5f5dc4940388a94d3a6c8586fd2fdfbb9bf4efc4..6afb7a2d38ac7efa8154ac105d31a77e6b407e7b 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fd68f8ac17db1bbfef1bb270b25e06c4136a98a7..189513a8ed81844d6344131f99de86add9269cf3 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e533625d5340f40607c7502a1a8f37cca7a01936..9646d8a6b2466b6c40940b34e4609e62e16e20e2 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index befeb242fe201f79e33715337c8156f6324975be..ac8a11aa94a050d0ae6686bff2fd461129688e50 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -35,6 +35,7 @@
 #include <pulsecore/pstream-util.h>
 
 #include "internal.h"
+#include "fork-detect.h"
 
 #include "introspect.h"
 
@@ -232,6 +233,7 @@ pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t idx, pa_
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
@@ -254,6 +256,7 @@ pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name,
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
 
@@ -365,6 +368,7 @@ pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t idx, p
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
@@ -387,6 +391,7 @@ pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
 
@@ -466,6 +471,7 @@ pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
 
@@ -528,7 +534,8 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
                     if (pa_tagstruct_gets(t, &i.profiles[j].name) < 0 ||
                         pa_tagstruct_gets(t, &i.profiles[j].description) < 0 ||
                         pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 ||
-                        pa_tagstruct_getu32(t, &i.profiles[j].n_sources)< 0) {
+                        pa_tagstruct_getu32(t, &i.profiles[j].n_sources) < 0 ||
+                        pa_tagstruct_getu32(t, &i.profiles[j].priority) < 0) {
 
                         pa_context_fail(o->context, PA_ERR_PROTOCOL);
                         pa_xfree(i.profiles);
@@ -589,6 +596,7 @@ pa_operation* pa_context_get_card_info_by_index(pa_context *c, uint32_t idx, pa_
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 15, PA_ERR_NOTSUPPORTED);
@@ -613,6 +621,7 @@ pa_operation* pa_context_get_card_info_by_name(pa_context *c, const char*name, p
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 15, PA_ERR_NOTSUPPORTED);
@@ -640,6 +649,7 @@ pa_operation* pa_context_set_card_profile_by_index(pa_context *c, uint32_t idx,
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 15, PA_ERR_NOTSUPPORTED);
@@ -664,6 +674,7 @@ pa_operation* pa_context_set_card_profile_by_name(pa_context *c, const char *nam
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 15, PA_ERR_NOTSUPPORTED);
@@ -747,6 +758,7 @@ pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
 
@@ -841,6 +853,7 @@ pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sin
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
 
@@ -930,6 +943,7 @@ pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
 
@@ -958,6 +972,7 @@ pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, c
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(volume);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
 
@@ -983,6 +998,7 @@ pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name
     pa_assert(name);
     pa_assert(volume);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
@@ -1007,6 +1023,7 @@ pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
@@ -1030,6 +1047,7 @@ pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name,
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(name);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
 
@@ -1054,6 +1072,7 @@ pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, cons
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(volume);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
@@ -1077,6 +1096,7 @@ pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mu
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 11, PA_ERR_NOTSUPPORTED);
@@ -1101,6 +1121,7 @@ pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx,
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(volume);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
 
@@ -1126,6 +1147,7 @@ pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *na
     pa_assert(name);
     pa_assert(volume);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, pa_cvolume_valid(volume), PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
@@ -1150,6 +1172,7 @@ pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, i
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
@@ -1173,6 +1196,7 @@ pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(name);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !name || *name, PA_ERR_INVALID);
 
@@ -1260,6 +1284,7 @@ pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
 
@@ -1283,6 +1308,7 @@ pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, p
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(cb);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
 
@@ -1309,6 +1335,7 @@ static pa_operation* command_kill(pa_context *c, uint32_t command, uint32_t idx,
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
 
@@ -1375,6 +1402,7 @@ pa_operation* pa_context_load_module(pa_context *c, const char*name, const char
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
 
@@ -1458,6 +1486,7 @@ pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, co
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 10, PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
@@ -1483,6 +1512,7 @@ pa_operation* pa_context_move_sink_input_by_index(pa_context *c, uint32_t idx, u
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 10, PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
@@ -1508,6 +1538,7 @@ pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx,
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 10, PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
@@ -1533,6 +1564,7 @@ pa_operation* pa_context_move_source_output_by_index(pa_context *c, uint32_t idx
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 10, PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
@@ -1558,6 +1590,7 @@ pa_operation* pa_context_suspend_sink_by_name(pa_context *c, const char *sink_na
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 11, PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !sink_name || *sink_name, PA_ERR_INVALID);
@@ -1582,6 +1615,7 @@ pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 11, PA_ERR_NOTSUPPORTED);
 
@@ -1605,6 +1639,7 @@ pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *sourc
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 11, PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, !source_name || *source_name, PA_ERR_INVALID);
@@ -1629,6 +1664,7 @@ pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, in
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 11, PA_ERR_NOTSUPPORTED);
 
index aa67e43d5b92db5ec917b4528e0a09464e956049..ec8a2c06744010ef3f562d6d9ff133e1b669401d 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -401,6 +401,7 @@ typedef struct pa_card_profile_info {
     const char *description;            /**< Description of this profile */
     uint32_t n_sinks;                   /**< Number of sinks this profile would create */
     uint32_t n_sources;                 /**< Number of sources this profile would create */
+    uint32_t priority;                  /**< The higher this value is the more useful this profile is as a default */
 } pa_card_profile_info;
 
 /** Stores information about cards. Please note that this structure
index d09f4b0a5af822d275f2b58a8b4e1e9132158a62..52f11c8096ec4c3298c5b93985d57b997a1571d0 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a9e250bcd8a2c73e1326e67aae8967d70610450d..fdb1f9db1982576d026c432a0c795b9a460703c7 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 60e5d1ffb7769d2351de655ec16dbe79b555de5d..225fd0981451e095b491b9ddecfeb19d909ca430 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 907e94a7d0362cdcc8314c513ea432d44b5c4a3a..3a03ac9ad3aedcce5528e64ee48c45ddf76c5be6 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index aa2bbc05d2078ca9a65cf19e5c41ba3e7e269b57..fe160a3c74ef7e0d786f70bfd36c0e675cc6213a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b68e78164094203818a6deb5b1e8c60b23f99182..7b0dabdd12e2ede6bda43542a3b4d7e12548aca3 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d30dc3b9e980fde44b760eff7426bf442615148c..d5f5bc0409c2149f9655ba5603184ee66755ad47 100644 (file)
@@ -45,8 +45,10 @@ PA_C_DECL_BEGIN
 /** For streams: source filename if applicable, in URI format or local path. e.g. "/home/lennart/music/foobar.ogg" */
 #define PA_PROP_MEDIA_FILENAME                 "media.filename"
 
+/** \cond fulldocs */
 /** For streams: icon for the media. A binary blob containing PNG image data */
 #define PA_PROP_MEDIA_ICON                     "media.icon"
+/** \endcond */
 
 /** For streams: an XDG icon name for the media. e.g. "audio-x-mp3" */
 #define PA_PROP_MEDIA_ICON_NAME                "media.icon_name"
@@ -81,8 +83,10 @@ PA_C_DECL_BEGIN
 /** For streams that belong to a window on the screen: a textual id for identifying a window logically. e.g. "org.gnome.Totem.MainWindow" */
 #define PA_PROP_WINDOW_ID                      "window.id"
 
+/** \cond fulldocs */
 /** For streams that belong to a window on the screen: window icon. A binary blob containing PNG image data */
 #define PA_PROP_WINDOW_ICON                    "window.icon"
+/** \endcond */
 
 /** For streams that belong to a window on the screen: an XDG icon name for the window. e.g. "totem" */
 #define PA_PROP_WINDOW_ICON_NAME               "window.icon_name"
@@ -108,8 +112,10 @@ PA_C_DECL_BEGIN
 /** For clients/streams: a version string e.g. "0.6.88" */
 #define PA_PROP_APPLICATION_VERSION            "application.version"
 
+/** \cond fulldocs */
 /** For clients/streams: application icon. A binary blob containing PNG image data */
 #define PA_PROP_APPLICATION_ICON               "application.icon"
+/** \endcond */
 
 /** For clients/streams: an XDG icon name for the application. e.g. "totem" */
 #define PA_PROP_APPLICATION_ICON_NAME          "application.icon_name"
@@ -150,17 +156,34 @@ PA_C_DECL_BEGIN
 /** For devices: serial number if applicable. e.g. "4711-0815-1234" */
 #define PA_PROP_DEVICE_SERIAL                  "device.serial"
 
-/** For devices: vendor/product ID if applicable. e.g. 1274:1371 */
-#define PA_PROP_DEVICE_VENDOR_PRODUCT_ID       "device.vendor_product_id"
+/** For devices: vendor ID if applicable. e.g. 1274 */
+#define PA_PROP_DEVICE_VENDOR_ID               "device.vendor.id"
+
+/** For devices: vendor name if applicable. e.g. "Foocorp Heavy Industries" */
+#define PA_PROP_DEVICE_VENDOR_NAME             "device.vendor.name"
+
+/** For devices: product ID if applicable. e.g. 4565 */
+#define PA_PROP_DEVICE_PRODUCT_ID              "device.product.id"
+
+/** For devices: product name if applicable. e.g. "SuperSpeakers 2000 Pro" */
+#define PA_PROP_DEVICE_PRODUCT_NAME            "device.product.name"
 
 /** For devices: device class. One of "sound", "modem", "monitor", "filter" */
 #define PA_PROP_DEVICE_CLASS                   "device.class"
 
-/** For devices: form factor if applicable. One of "laptop-speakers", "external-speakers", "telephone", "tv-capture", "webcam-capture", "microphone-capture", "headset", "headphones", "hands-free", "car", "hifi", "computer", "portable" */
+/** For devices: form factor if applicable. One of "internal", "speaker", "handset", "tv", "webcam", "microphone", "headset", "headphone", "hands-free", "car", "hifi", "computer", "portable" */
 #define PA_PROP_DEVICE_FORM_FACTOR             "device.form_factor"
 
-/** For devices: connector of the device if applicable. One of "isa", "pci", "usb", "firewire", "bluetooth" */
-#define PA_PROP_DEVICE_CONNECTOR               "device.connector"
+/** For devices: bus of the device if applicable. One of "isa", "pci", "usb", "firewire", "bluetooth" */
+#define PA_PROP_DEVICE_BUS                     "device.bus"
+
+/** \cond fulldocs */
+/** For devices: icon for the device. A binary blob containing PNG image data */
+#define PA_PROP_DEVICE_ICON                    "device.icon"
+/** \endcond */
+
+/** For devices: an XDG icon name for the device. e.g. "sound-card-speakers-usb" */
+#define PA_PROP_DEVICE_ICON_NAME               "device.icon_name"
 
 /** For devices: access mode of the device if applicable. One of "mmap", "mmap_rewrite", "serial" */
 #define PA_PROP_DEVICE_ACCESS_MODE             "device.access_mode"
index 4b13a3370705b028f2d0ae018b28f819fd6cdc44..1e67b037382628d964c464c290c36dd4e7aaedc1 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 3c05b54a0f480cc40473b9d402d345054f9a66d9..aef34b6b09a00a8a2568d25554eb5f8259804a64 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a7e3cd81c5de3e6c1d15d40a71ea956d0dad2d2b..77f60d72c4fdbaa8588d39e34a30aa3a2904ce31 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 79fcfbc5755dfb72cd76cbcb21e7352c55339291..cd579d2ec933e333a769d3452998d1d576fd0b65 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 79e39ebbc9782caf5bcdce776406fc20a3d82ce8..e70b7b1fdb352b6e3cbe924ea225dd936b724e36 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 3f57a6540868fe103bd82faec9aef77b00cac8af..6f1ba414bca9c61755da26c8ce0d0f3bba5cd642 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b36bf9b10054fb9ca626c98ba6da963ad905b1b3..9a0ea0fd445d7785fb55f0ff08408b84c55e26a3 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -38,6 +38,7 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/rtclock.h>
 
+#include "fork-detect.h"
 #include "internal.h"
 
 #define LATENCY_IPOL_INTERVAL_USEC (333*PA_USEC_PER_MSEC)
@@ -87,6 +88,7 @@ pa_stream *pa_stream_new_with_proplist(
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, ss && pa_sample_spec_valid(ss), PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 12 || (ss->format != PA_SAMPLE_S32LE && ss->format != PA_SAMPLE_S32BE), PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 15 || (ss->format != PA_SAMPLE_S24LE && ss->format != PA_SAMPLE_S24BE), PA_ERR_NOTSUPPORTED);
@@ -267,6 +269,7 @@ uint32_t pa_stream_get_index(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(s->context, !pa_detect_fork(), PA_ERR_FORKED, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE, PA_INVALID_INDEX);
 
     return s->stream_index;
@@ -921,6 +924,7 @@ static int create_stream(
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
     pa_assert(direction == PA_STREAM_PLAYBACK || direction == PA_STREAM_RECORD);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direct_on_input == PA_INVALID_INDEX || direction == PA_STREAM_RECORD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, !(flags & ~(PA_STREAM_START_CORKED|
@@ -1122,6 +1126,7 @@ int pa_stream_write(
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
     pa_assert(data);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction == PA_STREAM_PLAYBACK || s->direction == PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, seek <= PA_SEEK_RELATIVE_END, PA_ERR_INVALID);
@@ -1216,6 +1221,7 @@ int pa_stream_peek(pa_stream *s, const void **data, size_t *length) {
     pa_assert(data);
     pa_assert(length);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction == PA_STREAM_RECORD, PA_ERR_BADSTATE);
 
@@ -1240,6 +1246,7 @@ int pa_stream_drop(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction == PA_STREAM_RECORD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->peek_memchunk.memblock, PA_ERR_BADSTATE);
@@ -1262,6 +1269,7 @@ size_t pa_stream_writable_size(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(s->context, !pa_detect_fork(), PA_ERR_FORKED, (size_t) -1);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE, (size_t) -1);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->direction != PA_STREAM_RECORD, PA_ERR_BADSTATE, (size_t) -1);
 
@@ -1272,6 +1280,7 @@ size_t pa_stream_readable_size(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(s->context, !pa_detect_fork(), PA_ERR_FORKED, (size_t) -1);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE, (size_t) -1);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->direction == PA_STREAM_RECORD, PA_ERR_BADSTATE, (size_t) -1);
 
@@ -1286,6 +1295,7 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
 
@@ -1557,6 +1567,7 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
@@ -1627,6 +1638,7 @@ int pa_stream_disconnect(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->channel_valid, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->context->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
@@ -1649,6 +1661,9 @@ void pa_stream_set_read_callback(pa_stream *s, pa_stream_request_cb_t cb, void *
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1660,6 +1675,9 @@ void pa_stream_set_write_callback(pa_stream *s, pa_stream_request_cb_t cb, void
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1671,6 +1689,9 @@ void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1682,6 +1703,9 @@ void pa_stream_set_overflow_callback(pa_stream *s, pa_stream_notify_cb_t cb, voi
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1693,6 +1717,9 @@ void pa_stream_set_underflow_callback(pa_stream *s, pa_stream_notify_cb_t cb, vo
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1704,6 +1731,9 @@ void pa_stream_set_latency_update_callback(pa_stream *s, pa_stream_notify_cb_t c
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1715,6 +1745,9 @@ void pa_stream_set_moved_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1726,6 +1759,9 @@ void pa_stream_set_suspended_callback(pa_stream *s, pa_stream_notify_cb_t cb, vo
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1737,6 +1773,9 @@ void pa_stream_set_started_callback(pa_stream *s, pa_stream_notify_cb_t cb, void
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1748,6 +1787,9 @@ void pa_stream_set_event_callback(pa_stream *s, pa_stream_event_cb_t cb, void *u
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    if (pa_detect_fork())
+        return;
+
     if (s->state == PA_STREAM_TERMINATED || s->state == PA_STREAM_FAILED)
         return;
 
@@ -1794,6 +1836,7 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
@@ -1827,6 +1870,7 @@ static pa_operation* stream_send_simple_command(pa_stream *s, uint32_t command,
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
 
     o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
@@ -1845,6 +1889,7 @@ pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *use
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
@@ -1877,6 +1922,7 @@ pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *us
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->buffer_attr.prebuf > 0, PA_ERR_BADSTATE);
@@ -1897,6 +1943,7 @@ pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *u
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->buffer_attr.prebuf > 0, PA_ERR_BADSTATE);
@@ -1918,6 +1965,7 @@ pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_succe
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
     pa_assert(name);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
@@ -1951,6 +1999,7 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->timing_info_valid, PA_ERR_NODATA);
@@ -2003,6 +2052,7 @@ int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative) {
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
     pa_assert(r_usec);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->timing_info_valid, PA_ERR_NODATA);
@@ -2034,6 +2084,7 @@ const pa_timing_info* pa_stream_get_timing_info(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->timing_info_valid, PA_ERR_NODATA);
@@ -2045,6 +2096,8 @@ const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
+
     return &s->sample_spec;
 }
 
@@ -2052,6 +2105,8 @@ const pa_channel_map* pa_stream_get_channel_map(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
+
     return &s->channel_map;
 }
 
@@ -2139,6 +2194,7 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
     pa_assert(attr);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->context->version >= 12, PA_ERR_NOTSUPPORTED);
@@ -2183,6 +2239,7 @@ uint32_t pa_stream_get_device_index(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(s->context, !pa_detect_fork(), PA_ERR_FORKED, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->context->version >= 12, PA_ERR_NOTSUPPORTED, PA_INVALID_INDEX);
@@ -2195,6 +2252,7 @@ const char *pa_stream_get_device_name(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->context->version >= 12, PA_ERR_NOTSUPPORTED);
@@ -2207,6 +2265,7 @@ int pa_stream_is_suspended(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->context->version >= 12, PA_ERR_NOTSUPPORTED);
@@ -2218,6 +2277,7 @@ int pa_stream_is_corked(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
@@ -2270,6 +2330,7 @@ pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_strea
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, rate > 0 && rate <= PA_RATE_MAX, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
@@ -2300,6 +2361,7 @@ pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE, PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
@@ -2333,6 +2395,7 @@ pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[],
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, keys && keys[0], PA_ERR_INVALID);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
@@ -2364,6 +2427,7 @@ int pa_stream_set_monitor_stream(pa_stream *s, uint32_t sink_input_idx) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED);
     PA_CHECK_VALIDITY(s->context, sink_input_idx != PA_INVALID_INDEX, PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, s->context->version >= 13, PA_ERR_NOTSUPPORTED);
@@ -2377,6 +2441,7 @@ uint32_t pa_stream_get_monitor_stream(pa_stream *s) {
     pa_assert(s);
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
 
+    PA_CHECK_VALIDITY_RETURN_ANY(s->context, !pa_detect_fork(), PA_ERR_FORKED, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->direct_on_input != PA_INVALID_INDEX, PA_ERR_BADSTATE, PA_INVALID_INDEX);
     PA_CHECK_VALIDITY_RETURN_ANY(s->context, s->context->version >= 13, PA_ERR_NOTSUPPORTED, PA_INVALID_INDEX);
 
index 3965e9a2e8aa08b187f0d8567b82cd7c893c7db7..e80bc65d39a52b56d4d17b173ade9d1c5a1745e4 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e12d14464ddcb58fd23e644204b8ff10d15715db..203bc928e5f7d288a067cefd9fd082a59948b1c7 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2707cec5d6a303f279ba8dd61cc2cc2480b26ea2..a93510adf4e40a69122faa41ad16b870a00214f7 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fb73ff1bee27a603747615d5233eea656b609040..c77cc64e307ebb218ca6d07238aa7fb77712899f 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4de338a14c3bc3cd8af623e59e045b5a48f5bab5..8eddce4c45eebf75c2aa4351c8ffdce48c6aff5b 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -108,10 +108,10 @@ PA_C_DECL_BEGIN
  * Example:
  *
  * \code
- * static void my_drain_callback(pa_stream*s, int success, void *userdata) {
+ * static void my_drain_callback(pa_stream *s, int success, void *userdata) {
  *     pa_threaded_mainloop *m;
  *
- *     m = (pa_threaded_mainloop*)userdata;
+ *     m = userdata;
  *     assert(m);
  *
  *     pa_threaded_mainloop_signal(m, 0);
@@ -125,7 +125,7 @@ PA_C_DECL_BEGIN
  *     o = pa_stream_drain(s, my_drain_callback, m);
  *     assert(o);
  *
- *     while (pa_operation_get_state(o) != OPERATION_DONE)
+ *     while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
  *         pa_threaded_mainloop_wait(m);
  *
  *     pa_operation_unref(o);
@@ -167,7 +167,7 @@ PA_C_DECL_BEGIN
  * static void my_drain_callback(pa_stream*s, int success, void *userdata) {
  *     pa_threaded_mainloop *m;
  *
- *     m = (pa_threaded_mainloop*)userdata;
+ *     m = userdata;
  *     assert(m);
  *
  *     drain_result = &success;
@@ -183,7 +183,7 @@ PA_C_DECL_BEGIN
  *     o = pa_stream_drain(s, my_drain_callback, m);
  *     assert(o);
  *
- *     while (pa_operation_get_state(o) != OPERATION_DONE)
+ *     while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
  *         pa_threaded_mainloop_wait(m);
  *
  *     pa_operation_unref(o);
index 54838e89cf2ae7ffd7695d6d86a48836c80d78f9..c865058d671c7506e67d73394a953292a9d5ddc7 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8bfd0687ca74d0da0b7f35da5eedabb9ecb5ebfe..c3c396c8dc364e113840e8114a794eaf796e0e92 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c570e40f635b235467487bc53076a0a781729aa0..e17a354a465f21a7503aae8167d468a63d2b737a 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c30d4df1e227756399b8d9c93a75baa158983eee..db20496ff72d383b0cd7b2ddd412c9c514522f69 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6e33a0e6708afdce23e3829a36f109f22d7b9208..119c445be9379402909b09f1e08c86e0695d5ec6 100644 (file)
@@ -9,7 +9,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 68b01473a06cda7bd864c313998d28a2fb717f23..2f45eca07631cc7798123a71d689bd149099d143 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c08cbd82a592c5d291e605ceb4d1879e747211f1..3db40bcdfa2aacf7c303245259cd7180440a7f6e 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d5f40d8345e0f1cbeeff895924e0c139df5d37db..56d9d3ddae0704aa313f3f4e79b448df5173e1ca 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7d8995bb52c62591236fb5b61d6f459113a781b5..5a0c2ef8b70fb3c928ea131151ea529d7a12a68c 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4beeb1cc659c68fd3e00a2c93284b2d08978c04d..4b62fc4f19fe4e69d92d8f5706e32518745c2146 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 95f5cfceff36d4350d0287e6f32d0e79e2a6a9d3..a86a15e7e99cc22e13fc33d92cafed0625f007fb 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 515d1f90881f46d6b30cd8e8bfd395de8816acb1..6419c2347ef6294608e91a046262b751ccfbfbb6 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -160,6 +160,9 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
     c->userdata = NULL;
     c->set_profile = NULL;
 
+    pa_device_init_description(c->proplist);
+    pa_device_init_icon(c->proplist, TRUE);
+
     pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0);
 
     pa_log_info("Created %u \"%s\"", c->index, c->name);
index b179831ed5afd4ee66bc21a9b22123ef7baed8ab..c80d4e2ed13abc0a169abf82cd9b0f473495959d 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4ce87d6df5833ba7a0794faac9401ac0d70f2abb..b5f7e7f51d7e6ba198e8eb5c939ff7223e26a5f9 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -32,6 +32,7 @@
 #include <ltdl.h>
 
 #include <pulse/xmalloc.h>
+#include <pulse/error.h>
 
 #include <pulsecore/module.h>
 #include <pulsecore/sink.h>
@@ -1236,7 +1237,7 @@ static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_str
 static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
     const char *n, *m;
     pa_sink *sink;
-    int suspend;
+    int suspend, r;
 
     pa_core_assert_ref(c);
     pa_assert(t);
@@ -1263,14 +1264,16 @@ static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *b
         return -1;
     }
 
-    pa_sink_suspend(sink, suspend);
+    if ((r = pa_sink_suspend(sink, suspend)) < 0)
+        pa_strbuf_printf(buf, "Failed to resume/suspend sink: %s\n", pa_strerror(r));
+
     return 0;
 }
 
 static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
     const char *n, *m;
     pa_source *source;
-    int suspend;
+    int suspend, r;
 
     pa_core_assert_ref(c);
     pa_assert(t);
@@ -1297,14 +1300,15 @@ static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf
         return -1;
     }
 
-    pa_source_suspend(source, suspend);
+    if ((r = pa_source_suspend(source, suspend)) < 0)
+        pa_strbuf_printf(buf, "Failed to resume/suspend source: %s\n", pa_strerror(r));
+
     return 0;
 }
 
 static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
     const char *m;
-    int suspend;
-    int ret;
+    int suspend, r;
 
     pa_core_assert_ref(c);
     pa_assert(t);
@@ -1321,12 +1325,11 @@ static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p
         return -1;
     }
 
-    ret = - (pa_sink_suspend_all(c, suspend) < 0);
-    if (pa_source_suspend_all(c, suspend) < 0)
-        ret = -1;
+    if ((r = pa_sink_suspend_all(c, suspend)) < 0)
+        pa_strbuf_printf(buf, "Failed to resume/suspend all sinks: %s\n", pa_strerror(r));
 
-    if (ret < 0)
-        pa_strbuf_puts(buf, "Failed to resume/suspend all sinks/sources.\n");
+    if ((r = pa_source_suspend_all(c, suspend)) < 0)
+        pa_strbuf_printf(buf, "Failed to resume/suspend all sources: %s\n", pa_strerror(r));
 
     return 0;
 }
index 9bf35dc330fc928842d86931a083b5a8338bddd1..8c33ec089f583706ba5dd97dd4cf53f065d293b5 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8ca8f2d9feedef13efd72193f66433a67a81d577..76adc4dd8ad798592ea8e6edce62f655ac9f3bf4 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index aad51648bb2e625f2a0a17ad22354f6fe3a2f805..a5dd10e20e4c0021c7088c2bdae3a2577e2e9606 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 25a4f74859603fb49e84b723f6b6f4f1e27cf723..a784f583c84181980912bd3abe8df117d78a5076 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d8604611cc87a0c5f11d58a652848a4c70a3204c..ebab6c2112edb50d4b9f5bf71c02d49f531928d9 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e6e8b528e8c393273f19600bfd7662d46178783e..c956b101676f28f5e97e72f1526b7a5201927ad4 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 845a8babebd7d1dc580f97251b47b6b618ca1102..18b62dacd2a42c4a551cfa751c1161083ba3b63e 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1d98f36c22ef717cd22dc0e7f39693cca91a3eb7..a6eb581c41ec3ce02e758995c9895cc621bf5cf0 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f8f059fef43ca885de9c7db4e9e60222729f3d9d..08e17ca7b90df191cd4a2973a430d4eba7ab1613 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d9caa9465b5a430382f624aca718dde1d48fe9e1..c4408069648ace97bae7487e4ccc1d4f4ab47e79 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b0c306c79a3b19de0697d17a30507ed4210d8698..e7bc4fca35d15a896d84204152885d0fa902dbcd 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e5489415ff6c778bf02d49f91c7c68c9bb67a380..34d60a8f2cc0a6bc215c745b445a68ef1b4f770f 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1fe3c309729982ef037c61c0aa31737a82f5ec2d..fdfc7754a958173971174088a07b283de5071677 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c70d8adcb458e7e348a0dd635e94bfca443e1c56..54fb7ec2326943cebc4fea52221a480a092fa62e 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2f9730d947216a58474598357da4f8125db65c2c..dd748d36b4ee69acfa1ce25a4ad2b5ce6a6d5b8f 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index a184bebd544dbd254a65006dfcb5540cd0e83e3a..0d243ee619861ccab5112ac9fcd86d681a9553a0 100644 (file)
@@ -2505,7 +2505,7 @@ char *pa_machine_id(void) {
 char *pa_uname_string(void) {
     struct utsname u;
 
-    pa_assert_se(uname(&u) == 0);
+    pa_assert_se(uname(&u) >= 0);
 
     return pa_sprintf_malloc("%s %s %s %s", u.sysname, u.machine, u.release, u.version);
 }
index eef967a660973c5997c73f949e035237dbcf5a40..06573f17fad7ffaa7f7e63bc64608eecd73bac28 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -250,3 +250,14 @@ int pa_core_exit(pa_core *c, pa_bool_t force, int retval) {
     c->mainloop->quit(c->mainloop, retval);
     return 0;
 }
+
+void pa_core_maybe_vacuum(pa_core *c) {
+    pa_assert(c);
+
+    if (!pa_idxset_isempty(c->sink_inputs) ||
+        !pa_idxset_isempty(c->source_outputs))
+        return;
+
+    pa_log_debug("Hmm, no streams around, trying to vacuum.");
+    pa_mempool_vacuum(c->mempool);
+}
index 7660bd3b92876667ca952ef9958a112b4b1213b7..c67944450e7af897ecfcef0dcbfc70b1e19b144a 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -171,4 +171,6 @@ void pa_core_check_idle(pa_core *c);
 
 int pa_core_exit(pa_core *c, pa_bool_t force, int retval);
 
+void pa_core_maybe_vacuum(pa_core *c);
+
 #endif
index 269de6043f8bee56eab9edc8f808010deb39a8e5..491ec75f451dc9b23a31308959b0b4b2fd4bca49 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index eea1c743656c5535101e104cd927a4e719b5be30..22579376e0321dc5c9509aa63901a65c58c154a4 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 79322ae46e1ec7bc51fcb835a81a532d252c583d..abc2355f55a24ee7a330700f9829f7b590c8b76a 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ed59448a49d2d3b5cf64dcf35f0cc3ca689f3a9e..ac9db73c8ca7b9cebbab097f4d776e442c433160 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file resample2.c
+ * @file libavcodec/resample2.c
  * audio resampling
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
@@ -175,10 +175,6 @@ void av_build_filter(FELEM *filter, double factor, int tap_count, int phase_coun
 #endif
 }
 
-/**
- * Initializes an audio resampler.
- * Note, if either rate is not an integer then simply scale both rates up so they are.
- */
 AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
     AVResampleContext *c= av_mallocz(sizeof(AVResampleContext));
     double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
@@ -206,33 +202,12 @@ void av_resample_close(AVResampleContext *c){
     av_freep(&c);
 }
 
-/**
- * Compensates samplerate/timestamp drift. The compensation is done by changing
- * the resampler parameters, so no audible clicks or similar distortions occur
- * @param compensation_distance distance in output samples over which the compensation should be performed
- * @param sample_delta number of output samples which should be output less
- *
- * example: av_resample_compensate(c, 10, 500)
- * here instead of 510 samples only 500 samples would be output
- *
- * note, due to rounding the actual compensation might be slightly different,
- * especially if the compensation_distance is large and the in_rate used during init is small
- */
 void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){
 //    sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
     c->compensation_distance= compensation_distance;
     c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
 }
 
-/**
- * resamples.
- * @param src an array of unconsumed samples
- * @param consumed the number of samples of src which have been consumed are returned here
- * @param src_size the number of unconsumed samples available
- * @param dst_size the amount of space in samples available in dst
- * @param update_ctx if this is 0 then the context wont be modified, that way several channels can be resampled with the same context
- * @return the number of samples written in dst or -1 if an error occurred
- */
 int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx){
     int dst_index, i;
     int index= c->index;
index 512dd357dddd671a63533061b1eee17090eb13ba..e147486e1ed68bac880f876abcdcd3c00bd5f84a 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 57607b69e251c65772e31dc52287dc7682157b0d..e957c5ba7c0574b3a8fd8963927d843c0f3a4388 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 70d78b7570499f96587e4411c3f3e6062bb4c09c..08e18ead92e99c8b2f45c68e9bbf99b7a172f687 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 396940382a06eb0687a3020aacf69bb3aa8c6433..5f7a8665edfa7c9b72c8485dce90e1f674358f92 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index de947ad56e99356597714b1623d5feacbca93b4e..8514cced3dbfff42701c829b7af19329a64e00aa 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 88174c058258b9b24ff1e85b40332b9f8996de41..5c38d6e5f72d52eeae5851951bf495ad70df4752 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b9a3d9f4749252301958f2616477b2f429f1461e..9f32d60f4a07875214d0d715a0f9981c6a83771f 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 46b54eb39e30a5b1111cdb0c3585cd8c87ba7952..77a1749f2b1c9f2d53a2a4b2223a194ae96e05fe 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d36b669ea536584d7c3d4e0bc0a5884e49e1f165..4436974d316e07a8fdd9ad3e6b7de6bcadcbde96 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9931586d507abdf87aa2bc4bbd2e2d4ae9d675f0..d4d3b76ebafdeb97798e54b80bccbc25c8c6b660 100644 (file)
@@ -6,7 +6,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6e7bfc35f2a85a88d4364b2fa0b51d5d52dfb247..153e11e8d7545b1884b2aa1a0f22ce0d8c45eada 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ed0b63af65e5e8fb3c1e4bb785067e27d5ff7737..be200ca2cf5473f339b0052ddf3b8c86309b517d 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ea73de54d441e8dff6315fea1fde7c5ae06f31c2..4c4f018acb86e6b01a304a33ea37bf4802b27534 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 59460012741bdeed5269fccdc9b397d336f911e1..20015bf5b115df507525985b53565c1848cbef83 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 265da37fc2b9f9c5cb06172860b5b17f9f815e9b..e2be42b3a228f215e5b26898fb6e6546ceeffca9 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 31f908dfc2a6fe44d46513a4110617484e550a36..0a74aa3787412cfa24f8d3a1081c0120e090e435 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4a30f52a0ca880b05414155ac8cc590891e7fe95..73c67a8b085996cfe1730e312e8733e7e15fff28 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 23766cfc71260ae501e79f994c9d3d51614adddc..809fb27ed1e5f34ee1285022a12bd400c79b1ec5 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ac4ca88a973a82f16644584c1ead7c644f2b67e0..00fb9c4358fb6465c25903825025fa50b232a3e1 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 605637c4f878aadef7e377998bab55c11a1bd2f2..407e602a6078ed97e78e2026fa9a95f996decf83 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1eb70c8e241f3a71b1b13ec6068e0c06012c4552..42fd912ce213b276375c625efbbc83984569821a 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6ab43dcfd19f2a5abfd39e822e70933135789750..3f697348fedffa034e05969a64358147b2fad613 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 81417ea4687d84f834fcd01f0df08fd354088a9a..6a2a612d1230cdb57032dba0a968f2f9aeaa534c 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1a43fa35ded605917a2a5bfb3b981ecd1d4696eb..a35a23b57581869cf2de197b2a8dc34b541a8fcd 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c3ead97d3a82d1c7cadefe4ab69fbdbb6be192f9..b3e5256a30ec4ad8292470f9c347e0707bc17b09 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5e884e7fc89464d9b6a44624c8eb3506b0b72121..3a910b037b59913cdf4eee43266703efc8808c93 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8e0b1f2e45acfd4dbd8d1dab2bffbe3b84b526c5..a4dd67384844a08d257445eacd11a8cb488d0127 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5ab3036eaeaeaafd65fe5bba453915888b6f9338..9df2f583a18936ed010e0ff696281d7760616362 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ff99525e2005ae0d833004b7b5342387255762e6..38fae6f58858b87647fd02f3573c226b7ff0ddd2 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9a2f28f3175ecbeb01e7114a45f3a019ce944d60..8fd05fb6aa389188a2b40f1994ce555b8ab71768 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2ee4fc31ff42cf76766fcaa315862957148f4e75..43e79327da1f52733b7de33ce9273278b827be6d 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 3d4543cb5ad340980b388f6dc713b70705d81664..05a3ad2c839f4750adbf43a2bcec330c0337e220 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c0191ef092533faee5fdd65a62599d890644659d..50ac18c1460fc4454d35811949d26ce5df95a1a0 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index bf9ba983f104639f3cac3827178d058fdb6dec49..008784629de97b899580773aaf42af3568276f93 100644 (file)
@@ -6,7 +6,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 3c8a9de35bb9643fbe1630724b7458403551934c..d8458bf7fc16705dcb9171ad132ee4ecfd80b334 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 93d78a22b0fef57ab2256b5216784255b649d95e..c21e4b1fa582c64f561fbc22a74faa2b99a25f9f 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9a7e62c86836078878abed1e46e240e870412c41..597d5e525ce4f1950a7a39707e0768c3f09bb14d 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 44aa6bf0ec6a2ce99c8d5c40b75054552a99f5af..fceb2ca146cbc102c7e9e99715e75a11facb54f0 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1a42867bfc3a4bf5632d3683f8d63a844680a595..9d5f40fddf1936076ab6c8d0cb4778beaf8b367f 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 0dd482515aeb1bb819c7f14965148ce94bfcf628..f127d7a487d606a92d8a8e5cd2520e4cf7bc6ed0 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c312ae82b9f26fde890ac3a320599f66e6a51f77..c813611ed35feb0c2e6ba9f686a844c959b076dc 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 88ac21e46f1eeb6982abfc848a59031f01f6e579..46a69c5f568ee2e84f10b445f8c18a68d4d6f41e 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 86c37a085d4635eb0bcf88a0ecad4ccfeff381ae..fe0c6af65083a385217c5df06f2d27633fea86ac 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 693dc51744e5897de4922e67e116a82dc078def2..983db0f1617d4d72f2af6c714c3f728b407442f9 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9247bb40329bfc1291c5ec70148e1ae6be197ce5..da64874488557f9d95fe0ec9c977521fe2f53f95 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9e26dcd97f00093b7cd753cd0999f0ec866cf994..906b13f34d162ae665d306e0a121d35615691ff7 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2d4e62fae0363752f7ade30df661f2d86f3f1ac0..2b80c65ffd6402af5b287eb37c65ddceff52c915 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -1290,6 +1290,9 @@ static int connection_process_msg(pa_msgobject *o, int code, void*userdata, int6
     connection *c = CONNECTION(o);
     connection_assert_ref(c);
 
+    if (!c->protocol)
+        return -1;
+
     switch (code) {
         case CONNECTION_MESSAGE_REQUEST_DATA:
             do_work(c);
index 232df6601b8f8f850cf35912503fca24e34288bb..63a29ce8d2caa9374c659496cd9765e97d70e3b4 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5379a36c0711f403083b9c4438443db8b9405fa2..f3b93819f247b83e65afc67797e5ec2fb71920ec 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7e8f9760d48caac8c9295496e05cc9446b0300c1..40b3d82c4edd92125ca40ea387cb5338f0999eb5 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 10b9e7da330909ef5ad6ed9506ebba0a9862c21d..50a9191b344237714fd8e1c726f2c1d890e2fc64 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -2829,6 +2829,7 @@ static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_car
             pa_tagstruct_puts(t, p->description);
             pa_tagstruct_putu32(t, p->n_sinks);
             pa_tagstruct_putu32(t, p->n_sources);
+            pa_tagstruct_putu32(t, p->priority);
         }
     }
 
@@ -2955,7 +2956,6 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
 
     if (pa_tagstruct_getu32(t, &idx) < 0 ||
         (command != PA_COMMAND_GET_CLIENT_INFO &&
-         command != PA_COMMAND_GET_CARD_INFO &&
          command != PA_COMMAND_GET_MODULE_INFO &&
          command != PA_COMMAND_GET_SINK_INPUT_INFO &&
          command != PA_COMMAND_GET_SOURCE_OUTPUT_INFO &&
index 06731c0ccd35ef0cde7350cfbd1c1e5c2a4ae456..8a8d601ce93cc225508aebda83af5ab5c0fc7361 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e149c40dcb4ca60f2c9b57cfbcc29401ac716b8c..44fe5973d07cd7b9536a0f3112ce0a989a5d6c9f 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -283,6 +283,9 @@ static int connection_process_msg(pa_msgobject *o, int code, void*userdata, int6
     connection *c = CONNECTION(o);
     connection_assert_ref(c);
 
+    if (!c->protocol)
+        return -1;
+
     switch (code) {
         case CONNECTION_MESSAGE_REQUEST_DATA:
             do_work(c);
index c10eabe7db734a28cc721a91ac223e9c94a2af5c..a25ab80a983c30c60511f104aae04f07559e207f 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8ce78579bbea71ce12d8b4a5d868308ab30fef9a..29e6fb102b046ee80d577f9f08c82e1f62855ef4 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e652c5208274e354ac80ee094e79ba80aadeb509..ec3b5a38a7c8087d23a1d78eac6fea2664a41d1e 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 291f4504a8ca79075412ed8263de206f064d4ebc..1e9883269d16ed3212235881cbc9969e0e055df5 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 78ad553078af3537f056f3fd7a01fc175a07cfc5..17fb8480a2c0fe08f6d44860394116ec28b66af9 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 54dfa559333c71e13faa6bc91f7776ef346e21f3..742de6aff6abfbaa0238bd96a89b91d8eb94d80b 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index dcbd1184c5da10675fb52b2fa811ffcd77198d72..56ab2ef02a593d76f37d6f6504c9aac92567ede6 100644 (file)
 #include <stddef.h>
 #include <time.h>
 #include <sys/time.h>
-#include <sys/prctl.h>
 #include <errno.h>
 
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
+
 #include <pulse/timeval.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-error.h>
index 905ba5df5e9275b728ae69dd4375ff4e856496f1..3a9b384d3664e9891e90a887b8fdd8784282c7b4 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2230aaf094874806c7adde5eb1dca58286e7731c..79af9efc0678a2a3763401fff5e6c782ff93e5b8 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 0d5146aa542eb69935670c52300c680625df5def..bf4f717d0fd240787a9e9f26a03358bd3e4f0335 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 0263333380d25d4e8fbf22d7914083f89a4db61d..ae9e23135f68449f4e8b71b57bf4d7db1fcc74f7 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 79f0391c427eff2136dc389b24dace92e54e3c4b..307ce7b7de89fdd3a91b59e59b4c0cf64ffce729 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f7b00645d9d501e254a92c2cbead88b92da431ab..609fa04bfd3d1cd0171e591cb9d9bc8d6dca2404 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fcd0309c13125110d4c83a1cf849e609bc751398..29a9a453ade72661c1ed12d7345b8e95cf4a90ff 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 59710369c992ee85de6d159a14d724e67dff1628..b00a16a4923d4c4cf659bd403d4176a1d7c2e74a 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7c9f859d2477e3bc82f205fe1a1af622058930e9..616d897d0fd2176de52d2c5968029e3ba963462e 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 41e0b8d4d1fd76e3dde7ed64585ac6335f81d85c..9ffbde662f95b98d003a3bb144a979722148dc03 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 850ae8171035e9f2806fcbf50c1a1255fabc153e..dc3ca6a52c3eaa086ee8511f63209333c1d1cda5 100644 (file)
@@ -8,7 +8,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 9485dc3332b37f9df2796446d4d22f7cb9002585..edd7b7fe44e2c6177387247901cdd0864c336c02 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f6f8d3cf0f3c17801b6b2c1287ba27c66a96abcf..82819f071067d3f89ca4ec3b3d1accff3dc2f0a2 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 34217c86726f39db3479e1b9530686703094ef40..53e727bb7b04dcacd5f4422192aae9398b64959b 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -158,7 +158,6 @@ int pa_sink_input_new(
     pa_return_val_if_fail(data->sink, -PA_ERR_NOENTITY);
     pa_return_val_if_fail(PA_SINK_IS_LINKED(pa_sink_get_state(data->sink)), -PA_ERR_BADSTATE);
     pa_return_val_if_fail(!data->sync_base || (data->sync_base->sink == data->sink && pa_sink_input_get_state(data->sync_base) == PA_SINK_INPUT_CORKED), -PA_ERR_INVALID);
-    pa_return_val_if_fail(!(flags & PA_SINK_INPUT_FAIL_ON_SUSPEND) || pa_sink_get_state(data->sink) != PA_SINK_SUSPENDED, -PA_ERR_BADSTATE);
 
     if (!data->sample_spec_is_set)
         data->sample_spec = data->sink->sample_spec;
@@ -228,6 +227,12 @@ int pa_sink_input_new(
     if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], data)) < 0)
         return r;
 
+    if ((flags & PA_SINK_INPUT_FAIL_ON_SUSPEND) &&
+        pa_sink_get_state(data->sink) == PA_SINK_SUSPENDED) {
+        pa_log_warn("Failed to create sink input: sink is suspended.");
+        return -PA_ERR_BADSTATE;
+    }
+
     if (pa_idxset_size(data->sink->inputs) >= PA_MAX_INPUTS_PER_SINK) {
         pa_log_warn("Failed to create sink input: too many inputs per sink.");
         return -PA_ERR_TOOLARGE;
@@ -463,6 +468,8 @@ void pa_sink_input_unlink(pa_sink_input *i) {
         i->sink = NULL;
     }
 
+    pa_core_maybe_vacuum(i->core);
+
     pa_sink_input_unref(i);
 }
 
index b4f053197e3df99de7125c1c297b870b1093d272..e38016878f43f159d66b776ef0db2645671246e3 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7441e9717c6608f22b9f589a0dfc016853f2c30d..ff8700c71edc8aeabea771bc23d7c9c453a0a018 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -33,6 +33,7 @@
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
 #include <pulse/util.h>
+#include <pulse/i18n.h>
 
 #include <pulsecore/sink-input.h>
 #include <pulsecore/namereg.h>
@@ -172,6 +173,9 @@ pa_sink* pa_sink_new(
     if (data->card)
         pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist);
 
+    pa_device_init_description(data->proplist);
+    pa_device_init_icon(data->proplist, TRUE);
+
     if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_FIXATE], data) < 0) {
         pa_xfree(s);
         pa_namereg_unregister(core, name);
@@ -322,6 +326,9 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t state) {
                 pa_sink_input_kill(i);
             else if (i->suspend)
                 i->suspend(i, state == PA_SINK_SUSPENDED);
+
+        if (s->monitor_source)
+            pa_source_sync_suspend(s->monitor_source);
     }
 
     return 0;
@@ -1525,8 +1532,10 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
 
             s->thread_info.state = PA_PTR_TO_UINT(userdata);
 
-            if (s->thread_info.state == PA_SINK_SUSPENDED)
+            if (s->thread_info.state == PA_SINK_SUSPENDED) {
+                s->thread_info.rewind_nbytes = 0;
                 s->thread_info.rewind_requested = FALSE;
+            }
 
             return 0;
 
@@ -1596,8 +1605,12 @@ int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend) {
 
     pa_core_assert_ref(c);
 
-    for (sink = PA_SINK(pa_idxset_first(c->sinks, &idx)); sink; sink = PA_SINK(pa_idxset_next(c->sinks, &idx)))
-        ret -= pa_sink_suspend(sink, suspend) < 0;
+    for (sink = PA_SINK(pa_idxset_first(c->sinks, &idx)); sink; sink = PA_SINK(pa_idxset_next(c->sinks, &idx))) {
+        int r;
+
+        if ((r = pa_sink_suspend(sink, suspend)) < 0)
+            ret = r;
+    }
 
     return ret;
 }
@@ -1726,7 +1739,7 @@ pa_usec_t pa_sink_get_requested_latency(pa_sink *s) {
     return usec;
 }
 
-/* Called from IO thread */
+/* Called from IO as well as the main thread -- the latter only before the IO thread started up */
 void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
     pa_sink_input *i;
     void *state = NULL;
@@ -1747,7 +1760,7 @@ void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
         pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);
 }
 
-/* Called from IO thread */
+/* Called from IO as well as the main thread -- the latter only before the IO thread started up */
 void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
     void *state = NULL;
 
@@ -1886,3 +1899,81 @@ size_t pa_sink_get_max_request(pa_sink *s) {
 
     return r;
 }
+
+/* Called from main context */
+pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink) {
+    const char *ff, *c, *t = NULL, *s = "", *profile, *bus;
+
+    pa_assert(p);
+
+    if (pa_proplist_contains(p, PA_PROP_DEVICE_ICON_NAME))
+        return TRUE;
+
+    if ((ff = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR))) {
+
+        if (pa_streq(ff, "microphone"))
+            t = "audio-input-microphone";
+        else if (pa_streq(ff, "webcam"))
+            t = "camera-web";
+        else if (pa_streq(ff, "computer"))
+            t = "computer";
+        else if (pa_streq(ff, "handset"))
+            t = "phone";
+        else if (pa_streq(ff, "portable"))
+            t = "multimedia-player";
+    }
+
+    if (!t)
+        if ((c = pa_proplist_gets(p, PA_PROP_DEVICE_CLASS)))
+            if (pa_streq(c, "modem"))
+                t = "modem";
+
+    if (!t) {
+        if (is_sink)
+            t = "audio-card";
+        else
+            t = "audio-input-microphone";
+    }
+
+    if ((profile = pa_proplist_gets(p, PA_PROP_DEVICE_PROFILE_NAME))) {
+        if (strstr(profile, "analog"))
+            s = "-analog";
+        else if (strstr(profile, "iec958"))
+            s = "-iec958";
+        else if (strstr(profile, "hdmi"))
+            s = "-hdmi";
+    }
+
+    bus = pa_proplist_gets(p, PA_PROP_DEVICE_BUS);
+
+    pa_proplist_setf(p, PA_PROP_DEVICE_ICON_NAME, "%s%s%s%s", t, pa_strempty(s), bus ? "-" : "", pa_strempty(bus));
+
+    return TRUE;
+}
+
+pa_bool_t pa_device_init_description(pa_proplist *p) {
+    const char *s;
+    pa_assert(p);
+
+    if (pa_proplist_contains(p, PA_PROP_DEVICE_DESCRIPTION))
+        return TRUE;
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR)))
+        if (pa_streq(s, "internal")) {
+            pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, _("Internal Audio"));
+            return TRUE;
+        }
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_CLASS)))
+        if (pa_streq(s, "modem")) {
+            pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, _("Modem"));
+            return TRUE;
+        }
+
+    if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_PRODUCT_NAME))) {
+        pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s);
+        return TRUE;
+    }
+
+    return FALSE;
+}
index 124b4e11b5567a3b24617fa4bfbae0832edce3a4..0d33679fa1ec049543ece50552ce0e40a383ef07 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -225,6 +225,9 @@ void pa_sink_attach(pa_sink *s);
 
 void pa_sink_set_soft_volume(pa_sink *s, const pa_cvolume *volume);
 
+pa_bool_t pa_device_init_description(pa_proplist *p);
+pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink);
+
 /**** May be called by everyone, from main context */
 
 /* The returned value is supposed to be in the time domain of the sound card! */
index 7e5b186ca8ae769d74246cd25b3c1cbfe775a4dd..24c046cf91b6454b74b041748f5d0278554dea43 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d0cacc9b00d0fa8efd1a074736da23084f4c67b2..88ff92afd0d69ceb611f4fc0ef13a9752f562e5f 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 19c2fd09dd1bb2e967c444b8d736aa1af6b51572..6a4405e3a8221c9377cf677940731c75c2c69c43 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b9a2c40e42f82fcbb8797b7355e9a0b283e2aad3..72b6eda4a777bd72c955f6c82e517b4d8f733771 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e44f6460d13a4dfd4be80e1c69d2c2e273c4b327..5fd5dd6763266ce79b7daada12eb95131064b45f 100644 (file)
@@ -7,7 +7,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7a40285a142376790ab4e20b4e914a8516f5ee10..f6d163766ff7b93038eb4b29a33236e30f95628d 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c3de3067e0de905a11fbc5732567af8f51a05056..3453637fc859f2fda7997cf6f8fad65323d34215 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4cc69146f4ef6b1070b7936857059ece5b25c556..a788c34298b86a35da47339cea64107c2991120e 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 380cef1631a527dd7e845db380d16e35a4182327..db75ae08506cae46a7a43f5923aa1a01399cd21c 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index e4d703d34712c547d666ce04b49a05630bc9e58e..34e0261602ae1753c92118154f57758aaa7430c4 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d63aca1563141bd3caa1444e2c3b1fe6fe9809b7..373d56376b7877499bb7bb48f219c1662d55779b 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -127,7 +127,6 @@ int pa_source_output_new(
     pa_return_val_if_fail(data->source, -PA_ERR_NOENTITY);
     pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE);
     pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID);
-    pa_return_val_if_fail(!(flags & PA_SOURCE_OUTPUT_FAIL_ON_SUSPEND) || pa_source_get_state(data->source) != PA_SOURCE_SUSPENDED, -PA_ERR_BADSTATE);
 
     if (!data->sample_spec_is_set)
         data->sample_spec = data->source->sample_spec;
@@ -166,6 +165,12 @@ int pa_source_output_new(
     if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], data)) < 0)
         return r;
 
+    if ((flags & PA_SOURCE_OUTPUT_FAIL_ON_SUSPEND) &&
+        pa_source_get_state(data->source) == PA_SOURCE_SUSPENDED) {
+        pa_log("Failed to create source output: source is suspended.");
+        return -PA_ERR_BADSTATE;
+    }
+
     if (pa_idxset_size(data->source->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) {
         pa_log("Failed to create source output: too many outputs per source.");
         return -PA_ERR_TOOLARGE;
@@ -330,6 +335,8 @@ void pa_source_output_unlink(pa_source_output*o) {
         o->source = NULL;
     }
 
+    pa_core_maybe_vacuum(o->core);
+
     pa_source_output_unref(o);
 }
 
index 9369568c89d5c95633d2f0f5a8d05b3da85896ab..018ec8861b56f87aff3961556881a47845f60e16 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c0d6d9ea3318589186e4c31d36502d4c6434e2ee..cc6dfc4037b3a28688afc9d2d6f2be9170850caa 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -163,6 +163,9 @@ pa_source* pa_source_new(
     if (data->card)
         pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist);
 
+    pa_device_init_description(data->proplist);
+    pa_device_init_icon(data->proplist, FALSE);
+
     if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_FIXATE], data) < 0) {
         pa_xfree(s);
         pa_namereg_unregister(core, name);
@@ -421,12 +424,33 @@ int pa_source_suspend(pa_source *s, pa_bool_t suspend) {
     pa_source_assert_ref(s);
     pa_assert(PA_SOURCE_IS_LINKED(s->state));
 
+    if (s->monitor_of)
+        return -PA_ERR_NOTSUPPORTED;
+
     if (suspend)
         return source_set_state(s, PA_SOURCE_SUSPENDED);
     else
         return source_set_state(s, pa_source_used_by(s) ? PA_SOURCE_RUNNING : PA_SOURCE_IDLE);
 }
 
+/* Called from main context */
+int pa_source_sync_suspend(pa_source *s) {
+    pa_sink_state_t state;
+
+    pa_source_assert_ref(s);
+    pa_assert(PA_SOURCE_IS_LINKED(s->state));
+    pa_assert(s->monitor_of);
+
+    state = pa_sink_get_state(s->monitor_of);
+
+    if (state == PA_SINK_SUSPENDED)
+        return source_set_state(s, PA_SOURCE_SUSPENDED);
+
+    pa_assert(PA_SINK_IS_OPENED(state));
+
+    return source_set_state(s, pa_source_used_by(s) ? PA_SOURCE_RUNNING : PA_SOURCE_IDLE);
+}
+
 /* Called from main context */
 pa_queue *pa_source_move_all_start(pa_source *s) {
     pa_queue *q;
@@ -931,8 +955,15 @@ int pa_source_suspend_all(pa_core *c, pa_bool_t suspend) {
 
     pa_core_assert_ref(c);
 
-    for (source = PA_SOURCE(pa_idxset_first(c->sources, &idx)); source; source = PA_SOURCE(pa_idxset_next(c->sources, &idx)))
-        ret -= pa_source_suspend(source, suspend) < 0;
+    for (source = PA_SOURCE(pa_idxset_first(c->sources, &idx)); source; source = PA_SOURCE(pa_idxset_next(c->sources, &idx))) {
+        int r;
+
+        if (source->monitor_of)
+            continue;
+
+        if ((r = pa_source_suspend(source, suspend)) < 0)
+            ret = r;
+    }
 
     return ret;
 }
index 8a91016a0bdcc5c3ad4f9ed3909e69a1bd7b51b2..26471de0c51e9c67cffacc831cc5cb5e4892c320 100644 (file)
@@ -9,7 +9,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -212,6 +212,8 @@ void pa_source_attach(pa_source *s);
 
 void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume);
 
+int pa_source_sync_suspend(pa_source *s);
+
 /*** May be called by everyone, from main context */
 
 /* The returned value is supposed to be in the time domain of the sound card! */
index 8b952788648d10743cf8e4e0297db98fcca033f8..9f5a84b47a4c009ef947b582f66cc1b00ace6793 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1d2a588fee17365e24aeb17263380d90142649d6..05e69e03dafdc3c9b1cd293c3dca5649a912aaa6 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f587a2f821b5b17069fc27fa90afbdfe88f4e73f..cbafbba6b451d32b553596fc537cfe3acb522646 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 1cb7537aa111f940c2e4c55743eeb1b6332a0570..2584e86c689d0bc11474e59acfe409cd3362a676 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ade398f982e866b60d3bf3d6c2723f09450254f8..fdab270f06a80181b759f2b44ac95a82942a4fa5 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c40d33428e3f2f17073c104e608abc2df1ff6abb..0a1baa54c282bde2c22c197cf5d23c1e3eaeeaf3 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index eabe9ba4967163e278c74e2d6e9a4effbc35e18a..25eace63b0be94904aed9b591abb95a19f82d824 100644 (file)
@@ -9,7 +9,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 07a9f3acfd10b8e5265e6b3ddb95b8947a7592b1..1eb466dd819e2abcb564a8f31bde7a3dcc236cd7 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d51cd73ed1d9f9981ff718850bd1859124b66bf6..a47c07e7ff909d4d131b75ff1a05d57d2700b20c 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 076bd6c001a3ac1a7386ef2d4a03513802f5b726..924e3cb867d4f557fdd604ca8d7324257ae09198 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7f91ba3ccc179a06f66d1c126c8a3ed9a327743e..873a76e7d4ef6468663ff03094d48fd1070a3c9d 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c5998d3e68537f3874b34759aa735cf6797176bf..dc675263137f5b64b1f86f2f2c74052dbe28a335 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 332ebb2e9b083e6a2fd37bd6041d9c20430df6b4..1960a12fe16519af95899a9a017eb270cb1cd59e 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index badc3a1f34d38c449036ce2e5e52894937366553..b57541f2941f357064503a69031412c26bd32f65 100644 (file)
@@ -8,7 +8,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 08ad3dd4edbaa69b81df740f579f4bb7f34284b0..40c74f7682f07c0ff07e621c52979e1522b77ad7 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 4e8a12073e1d14a743b0669734b56b5949d20984..a617e1a0ca8b5ebbf64561e14a4912e98bf4b1b2 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index fdc0162e7f07991c352d8f7e145878bfbaebeaf1..9d0f4eef4dee14bd817eeb3234b9fa4b8d50dbf4 100644 (file)
@@ -3,7 +3,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 11a80a14f2909392126f73409699c9039aa4f87e..3af3044ee35f35c887a2f5243f88337673d2f070 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b2c648dad7491c2352efe3a129f8a88e0aca3581..64c0add22f85c7238dbf3411f3f4b2039e50cdfa 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 7c7a8996180d4d596a7b1d2256374fad4142ed25..a34e38fd1980181689140001f6a5fad92b023a90 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 092ba25c53800c7d3a86ca280557da65f7f7c6cd..f82aca58e7590ea6e422f53a97b6dfaf7d9f3be8 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d7da660c8f48386b2718df955f588fa71e5059d4..dd24e829b143ba4481f6ea60948c04f944643337 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -107,6 +107,7 @@ int main(int argc, char *argv[]) {
     int k, r;
     struct timeval start, last_info = { 0, 0 };
     pa_usec_t old_t = 0, old_rtc = 0;
+    pa_bool_t corked = FALSE;
 
     playback = argc <= 1 || !pa_streq(argv[1], "-r");
 
@@ -129,7 +130,7 @@ int main(int argc, char *argv[]) {
     r = pa_threaded_mainloop_start(m);
     assert(r >= 0);
 
-    for (k = 0; k < 5000; k++) {
+    for (k = 0; k < 20000; k++) {
         pa_bool_t success = FALSE, changed = FALSE;
         pa_usec_t t, rtc;
         struct timeval now, tv;
@@ -158,6 +159,8 @@ int main(int argc, char *argv[]) {
         pa_gettimeofday(&now);
 
         if (success) {
+            pa_bool_t cork_now;
+
             rtc = pa_timeval_diff(&now, &start);
             printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\t%u\n", k,
                    (unsigned long long) rtc,
@@ -170,6 +173,18 @@ int main(int argc, char *argv[]) {
             fflush(stdout);
             old_t = t;
             old_rtc = rtc;
+
+            cork_now = (rtc / (2*PA_USEC_PER_SEC)) % 2 == 1;
+
+            if (corked != cork_now) {
+                pa_threaded_mainloop_lock(m);
+                pa_operation_unref(pa_stream_cork(stream, cork_now, NULL, NULL));
+                pa_threaded_mainloop_unlock(m);
+
+                pa_log(cork_now ? "Corking" : "Uncorking");
+
+                corked = cork_now;
+            }
         }
 
         /* Spin loop, ugly but normal usleep() is just too badly grained */
index 80cfda6aa6e4520279968ed9ffabe9003afcebe4..c754e2308eb0e88a00d3c796c9cd78adcf2fc227 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2580fa72f2e437a6d8410ca8d8a0d6624f2cbc68..d8926233688558e796ddb3d0da022061858f4a84 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 37b5b403a31d458d072c18fc0f6da6de49bafee3..9cf6c78b0fdff10f05d666f53d6ced935e365325 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index b01a4fd5293a56450780d5a4b4449fb2920f4bc9..127fb1971cc229c4e2f72dc14ad489123dba33f5 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index db8ac6e3ae7f1724fb3dddd1bf1885baec3257a4..ac4b57b5b0c43fd2e91583db274c17b2bfe9780e 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ffe3176a8d1a000c41270eade48283814d27e619..d4224e110710187f6c988dd2178c0af1fe389c32 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index c9d3bef510c74d35cced3cb230e3549c1b60187b..9f19ff47c0f8c57e2acc7bcdda9d0bb99f6927fe 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 5526bb7e8d7823e0aefb0c95f27cedf3491bb996..3e723561a5fa9b07558ad5e2f6a9679bed8d8f3b 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index ceae4e47895291b8df5e3cee6f6666dc5b3268a9..7ee2693d576c14aecd0c3bb9cc1a46827f36eea5 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 3da4ee3346d047d241e2aa66024f9bbb97029c9b..9d110d6b547994b3ce4ea623ba63b414920e234b 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index da8d3756ea53e161cdac770290a6da98492e89bc..6b4a64ca278571256e1ae7ff6c7a35ecfb91874b 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 953fd61dae1764fc9c248179458b86cfbb47bb5d..4ac96446046cb3fab660c72985b33b8fd5c9e4fd 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d8aff342b32e0e8b7f06f69f6baa1a87c8d1b616..f04d43af239cf8a5fdbfd1dfd1eefd7a7a3c68c4 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index d64a8902c74d5f3da4140a4681949217311864cd..0cd929cac768c0a79cae19a12f5d5f9e8e6aafe0 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 15700ec2162005242e64128737d3dbf378989d29..798dfed5a48ca62966b8a709040863296e6a6fa5 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2b8aa08364967e3f5b13ea467c2ee52cdc8ae30c..1d8c4938f8e77353204c82ddb8b2cc4e358090d1 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f2a15601be0c7f92cf7a5c84a3de0dbd0e0dff42..bb64a91fc431c42c64f42d022eed40bc53b21ae4 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 3bcf4f16fa31924e54b410067e308e3293951a9e..ad89414feec39efca9c4f8fd131ed9113a34927e 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f29b5e712ca7da7fd1ea4e8722246030620ab26e..2c07b1ccb02708e67650ad771ab1a88f5b2ad23b 100644 (file)
@@ -3,7 +3,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f7344172228d83570805664f0c4b2b1c99960af1..7494348c1250918cd0f3bd62421416c1b4353405 100644 (file)
@@ -5,7 +5,7 @@
 
   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
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index f2ed9553f99cfdc2cf614984511c78eb25a77db9..288d44a902642376d9183fd19d9dc6354fe78550 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 2224da9a26544756be1e18252635a8690aaef585..e886c15c544dbb3139595822fe96edcbdd62e404 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 507e229f5924edda14caa55e9ec8f35d3b3f4d40..d94f2665b1fd93019e882559b64a231ab9a8e5f3 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 6524bf9007d9f3a57f561436b3f2ad109af5c458..de1c6d3dccbe0bbfde2c61dea049da82eab91c0d 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -427,7 +427,7 @@ static void get_card_info_callback(pa_context *c, const pa_card_info *i, int is_
 
         printf(_("\tProfiles:\n"));
         for (p = i->profiles; p->name; p++)
-            printf("\t\t%s: %s\n", p->name, p->description);
+            printf("\t\t%s: %s (sinks: %u, sources: %u, priority. %u)\n", p->name, p->description, p->n_sinks, p->n_sources, p->priority);
     }
 
     if (i->active_profile)
index 76e86c8d1f7b4f5cad1f4a215d91812b8a225788..dfa5aac200aeb46cc9b23cb191febbba642d73fe 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index dec80e5cd4062ecb771c86601d3c36b732d20f74..f6ba6f6dbf86eea2b40a1d2ba5d8c97a1db5ae08 100644 (file)
@@ -6,7 +6,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 8a59d5e452981b5c2b63983693f76a7801744e59..b4bccd5684f17ab6891442d9ec0216a6468b59fd 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
index 50d621d471232ea0e32f66418d5750e38b419b53..a9eb329f0ff77638c199c7b9e66f9fae94c9afe7 100644 (file)
@@ -5,7 +5,7 @@
 
   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,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but