--- alsa-plugins-1.0.20.orig/debian/rules +++ alsa-plugins-1.0.20/debian/rules @@ -0,0 +1,176 @@ +#!/usr/bin/make -f +export DH_VERBOSE=1 + +PACKAGE:= alsa-plugins +include /usr/share/quilt/quilt.make + +export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU) +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) + +biarch_map := i386=amd64 powerpc=ppc64 sparc=sparc64 s390=s390x \ + amd64=i386 ppc64=powerpc +biarch_cpu := $(strip $(patsubst $(DEB_BUILD_ARCH_CPU)=%, %, \ + $(filter $(DEB_BUILD_ARCH_CPU)=%, $(biarch_map)))) + +ifneq (,$(biarch_cpu)) + ifneq (,$(findstring /$(DEB_HOST_ARCH)/, /i386/powerpc/sparc/s390/)) + bi = 64 + bilibdir = usr/lib64 + endif + ifneq (,$(findstring /$(DEB_HOST_ARCH)/, /amd64/ppc64/)) + bi = 32 + bilibdir = usr/lib32 + endif + ifneq (,$(bi)) + configure_biarch_stamp = configure-biarch-stamp + build_biarch_stamp = build-biarch-stamp + BIARCH_CC = gcc -m$(bi) + dpkg_ctrl_args = -- '-Vbilib:depends=libc6-$(biarch_cpu)' \ + '-Vbidev:depends=libc6-dev-$(biarch_cpu)' + BIARCH_TEMPLIBDIR = $(CURDIR)/debian/biarch-templibdir + BIARCH_PKGCONFIGDIR = $(BIARCH_TEMPLIBDIR)/pkgconfig + BIARCH_LIBPULSE = $(wildcard /$(bilibdir)/libpulse.so*) + BIARCH_LIBDBUS = $(wildcard /$(bilibdir)/libdbus-1.so*) +# BIARCH_LIBJACK = $(wildcard /$(bilibdir)/libjack.so*) + endif +endif + +CFLAGS = -g -Wall + +INSTALL_UAG := -o root -g audio + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +configure-stamp: debian/stamp-patched $(configure_biarch_stamp) + dh_testdir + -rm -f config.sub config.guess + ln -s /usr/share/misc/config.sub config.sub + ln -s /usr/share/misc/config.guess config.guess + ./configure --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --with-avcodec-includedir=\$${prefix}/include/libavcodec \ + --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --enable-static + touch configure-stamp + +biarch-lib-dev-setup: + dh_testdir + mkdir $(BIARCH_TEMPLIBDIR) + mkdir $(BIARCH_PKGCONFIGDIR) + # We build-depend on lib$(BI)asound2-dev, so we are guaranteed + # to have linkable alsa libraries... + cp /usr/lib/pkgconfig/alsa.pc $(BIARCH_PKGCONFIGDIR)/ + + # We don't necessarily have pulse, dbus, or jack biarch libraries + # and even if we do, we don't have the .so symlink for them + # since ia32-libs-dev doesn't exist. + # SO: we need to detect these libs when they exist, provide .so + # symlinks, and copy the pkg-config files. +ifneq ($(strip $(BIARCH_LIBPULSE)),) + cp /usr/lib/pkgconfig/libpulse.pc $(BIARCH_PKGCONFIGDIR)/ + ln -s $(word 1, $(BIARCH_LIBPULSE)) $(BIARCH_TEMPLIBDIR)/libpulse.so +endif +ifneq ($(strip $(BIARCH_LIBDBUS)),) + cp /usr/lib/pkgconfig/dbus-1.pc $(BIARCH_PKGCONFIGDIR)/ + ln -s $(word 1, $(BIARCH_LIBDBUS)) $(BIARCH_TEMPLIBDIR)/libdbus-1.so +endif +#ifneq ($(strip $(BIARCH_LIBJACK)),) +# cp /usr/lib/pkgconfig/jack.pc $(BIARCH_PKGCONFIGDIR)/ +# ln -s $(word 1, $(BIARCH_LIBJACK)) $(BIARCH_TEMPLIBDIR)/libjack.so +#endif + touch biarch-lib-dev-setup + +configure-biarch-stamp: debian/stamp-patched biarch-lib-dev-setup + dh_testdir + -rm -f config.sub config.guess + ln -s /usr/share/misc/config.sub config.sub + ln -s /usr/share/misc/config.guess config.guess + rm -rf bibuild + mkdir bibuild + cd bibuild && PKG_CONFIG_LIBDIR=$(BIARCH_PKGCONFIGDIR) \ + CC="$(BIARCH_CC)" ../configure --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --host=$(DEB_HOST_GNU_TYPE) \ + --with-avcodec-includedir=\$${prefix}/include/libavcodec \ + --enable-static + cp -p bibuild/Makefile bibuild/Makefile.old + sed -i -e'/^SUBDIRS/s/doc//' bibuild/Makefile + touch -r bibuild/Makefile.old bibuild/Makefile + touch configure-biarch-stamp + +configure: configure-stamp + +build-arch-stamp: configure-stamp + dh_testdir + $(MAKE) CFLAGS="$(CFLAGS)" + touch build-arch-stamp + +build-biarch-stamp: configure-biarch-stamp + dh_testdir + $(MAKE) -C bibuild CFLAGS="$(CFLAGS)" LDFLAGS="-L$(BIARCH_TEMPLIBDIR)" + touch build-biarch-stamp + +build-arch: $(build_biarch_stamp) build-arch-stamp + +build: build-arch + +install-arch: build-arch-stamp + dh_testdir + dh_testroot + dh_prep + $(MAKE) install DESTDIR=$(CURDIR)/debian/libasound2-plugins + rm -f $(CURDIR)/debian/libasound2-plugins/usr/lib/alsa-lib/*.la \ + $(CURDIR)/debian/libasound2-plugins/usr/lib/alsa-lib/*.a +ifneq (,$(build_biarch_stamp)) + rm -rf debian/bitmp + $(MAKE) -C bibuild install DESTDIR=$(CURDIR)/debian/bitmp + mkdir -p debian/lib$(bi)asound2-plugins/$(bilibdir)/alsa-lib + cp -a debian/bitmp/usr/lib/alsa-lib/libasound_module*.so \ + debian/lib$(bi)asound2-plugins/$(bilibdir)/alsa-lib +endif + dh_installdirs -plibasound2-plugins usr/lib/alsa-lib + dh_install + #install $(INSTALL_UAG) jack/.libs/libasound_module_pcm_jack.so \ + # debian/libasound2-plugins/usr/lib/alsa-lib/libasound_module_pcm_jack.so.2.0.0 + #ln -s libasound_module_pcm_jack.so.2.0.0 \ + # debian/libasound2-plugins/usr/lib/alsa-lib/libasound_module_pcm_jack.so + dh_installdocs + dh_installexamples + dh_installchangelogs debian/changelog.ALSA + dh_strip + dh_compress + dh_fixperms + +binary-arch: build-arch-stamp install-arch + dh_makeshlibs -n -s + dh_installdeb -s + dh_shlibdeps -s + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s + +binary: binary-arch + +clean: unpatch + dh_testdir + dh_testroot + [ ! -f Makefile ] || $(MAKE) distclean + -rm -f configure-stamp build-arch-stamp build-indep-stamp biarch-lib-dev-setup + -rm -f config.sub config.guess config.status config.cache +ifneq (,$(build_biarch_stamp)) + -rm -rf $(CURDIR)/debian/bitmp + -rm -rf $(BIARCH_TEMPLIBDIR) +endif + dh_clean + +.PHONY: configure build-arch build install-arch binary-arch binary clean --- alsa-plugins-1.0.20.orig/debian/watch +++ alsa-plugins-1.0.20/debian/watch @@ -0,0 +1,2 @@ +version=2 +ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-(.*).tar.bz2 debian uupdate --- alsa-plugins-1.0.20.orig/debian/control +++ alsa-plugins-1.0.20/debian/control @@ -0,0 +1,74 @@ +Source: alsa-plugins +Section: libs +Priority: optional +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Debian ALSA Maintainers +Uploaders: Jordi Mallach , Elimar Riesebieter +Build-Depends: debhelper (>= 7), quilt (>= 0.40), autotools-dev, + libasound2-dev (>= 1.0.18), + lib32asound2-dev (>= 1.0.18) [amd64 ppc64], + lib64asound2-dev (>= 1.0.18) [sparc s390 i386 powerpc], + libpulse-dev (>= 0.9.11), + libsamplerate0-dev | libsamplerate-dev, + libc6-dev-powerpc [ppc64], libc6-dev-i386 [amd64], + libc6-dev-amd64 [i386], libc6-dev-ppc64 [powerpc], + libc6-dev-s390x [s390], libc6-dev-sparc64 [sparc], + lib32gcc1 [amd64 ppc64], lib64gcc1 [i386 powerpc sparc s390], + gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc] +Standards-Version: 3.8.1 +Homepage: http://www.alsa-project.org/ +Vcs-Svn: svn://svn.debian.org/pkg-alsa/trunk/alsa-plugins +Vcs-Bzr: https://code.launchpad.net/~ubuntu-core-dev/alsa-plugins/ubuntu +Vcs-Browser: http://svn.debian.org/wsvn/pkg-alsa/trunk/alsa-plugins/ + +Package: libasound2-plugins +Architecture: alpha amd64 arm armeb armel hppa i386 ia64 lpia m32r m68k mips mipsel powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc +Section: libs +Depends: ${shlibs:Depends} +Enhances: libasound2 +Description: ALSA library additional plugins + This package contains plugins for the ALSA library that are + not included in the main libasound2 package. + . + The following plugins are included, among other: + - oss: run native ALSA apps on OSS drivers + - pulse: play or capture via Pulse Audio + - lavcrate, samplerate and speexrate: rate converters + - upmix and vdownmix: convert from/to 2 and 4/6 channel streams + . + ALSA is the Advanced Linux Sound Architecture. + +Package: lib32asound2-plugins +Architecture: amd64 ppc64 +Section: libs +Depends: ${shlibs:Depends}, ${bilib:depends} +Enhances: lib32asound2 +Replaces: ia32-libs [amd64] +Description: ALSA library additional plugins (32 bit) + This package contains plugins for the 32 bit ALSA library that are + not included in the main lib32asound2 package. + . + The following plugins are included, among other: + - oss: run native ALSA apps on OSS drivers + - pulse: play or capture via Pulse Audio + - lavcrate, samplerate and speexrate: rate converters + - upmix and vdownmix: convert from/to 2 and 4/6 channel streams + . + ALSA is the Advanced Linux Sound Architecture. + +Package: lib64asound2-plugins +Architecture: sparc s390 i386 powerpc +Section: libs +Depends: ${shlibs:Depends}, ${bilib:depends} +Enhances: lib64asound2 +Description: ALSA library additional plugins (64 bit) + This package contains plugins for the 64 bit ALSA library that are + not included in the main lib64asound2 package. + . + The following plugins are included, among other: + - oss: run native ALSA apps on OSS drivers + - pulse: play or capture via Pulse Audio + - lavcrate, samplerate and speexrate: rate converters + - upmix and vdownmix: convert from/to 2 and 4/6 channel streams + . + ALSA is the Advanced Linux Sound Architecture. --- alsa-plugins-1.0.20.orig/debian/copyright +++ alsa-plugins-1.0.20/debian/copyright @@ -0,0 +1,35 @@ +This package was debianized by Thomas Hood on 25 March 2005. + +Since September 2002 it has been maintained by the participants in +the pkg-alsa project at alioth.debian.org. + +Bugs in the source code (as opposed to bugs in the packaging) are best +reported to the upstream bug tracking system: + + https://bugtrack.alsa-project.org/alsa-bug + +The source code was downloaded from the ALSA homepage: + + http://alsa.sourceforge.net + +alsa-plugins +------------ +Copyright (C) 1998 Jarsolav Kysela and others. + + This library is free software; you can redistribute it 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. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. + +On Debian systems, the complete text of the GNU Lesser General Public License +can be found in /usr/share/common-licenses/LGPL. --- alsa-plugins-1.0.20.orig/debian/changelog +++ alsa-plugins-1.0.20/debian/changelog @@ -0,0 +1,494 @@ +alsa-plugins (1.0.20-1ubuntu6) karmic; urgency=low + + * Make sure all patches are in the series file + * debian/patches/0001_validate_optimise_lookup.patch: Remove pulse changes + in this patch, as they are applied in a later patch + * Also drop the oss fragment of the patch, so this patch is no longer needed + + -- Luke Yelavich Wed, 05 Aug 2009 10:51:50 +0100 + +alsa-plugins (1.0.20-1ubuntu5) karmic; urgency=low + + * Apply latest updates from git master to the pulse plugins, consolidating + all pulse patches since 1.0.20 into a single patch file + + -- Luke Yelavich Wed, 05 Aug 2009 10:30:10 +0100 + +alsa-plugins (1.0.20-1ubuntu4) karmic; urgency=low + + * debian/control: Readd Vcs-Bzr information since we carry a + delta + * debian/patches: + Add from upstream + + 02-alsa-plugins-oss-Fix-missing-frags-init.patch + Add from Lennart's tree + + 03-alsa-plugins-pulse-Fix-asserts-Use-safer-checks-Call-in-loop.patch + + -- Daniel T Chen Mon, 03 Aug 2009 22:18:03 -0400 + +alsa-plugins (1.0.20-1ubuntu3) karmic; urgency=low + + * Replace ia32-libs rather than conflicting with it (LP: #305860). + + -- Colin Watson Sat, 18 Jul 2009 10:13:06 +0100 + +alsa-plugins (1.0.20-1ubuntu2) karmic; urgency=low + + * 01-alsa-plugins-pulse-Implement-pause.patch: Add pause support to the + pulseaudio plugin, taken from git master. + + -- Luke Yelavich Fri, 17 Jul 2009 12:59:36 +1000 + +alsa-plugins (1.0.20-1ubuntu1) karmic; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + Do not build-depend on libjack-dev and libavcodec-dev + + lib32asound-plugins conflicts against ia32-libs + + -- Luke Yelavich Tue, 09 Jun 2009 11:00:28 +1000 + +alsa-plugins (1.0.20-1) unstable; urgency=low + + * New upstream release. + + [ Elimar Riesebieter ] + * Bumped Standard-Version to 3.8.1, no changes needed. + + [ Jordi Mallach ] + * Improve sed usage where possible. + * Remove *.la and *.a files, as nothing should be building against + plugins. Thanks Marc-Andre Lureau (closes: #506432). + + -- Jordi Mallach Wed, 03 Jun 2009 22:58:52 +0200 + +alsa-plugins (1.0.19-3) unstable; urgency=low + + * Build-Depend again on libavcodec-dev to bring back the a52 and + lavcrate plugins, now that the ffmpeg transition is over. + + -- Jordi Mallach Mon, 30 Mar 2009 20:01:16 +0200 + +alsa-plugins (1.0.19-2ubuntu2) karmic; urgency=low + + * re-introduce 0001_validate_optimise_lookup.patch to go with the numid + changes in alsa-lib + * tighten libasound2-dev build dependency + + -- Luke Yelavich Tue, 05 May 2009 15:33:20 +1000 + +alsa-plugins (1.0.19-2ubuntu1) karmic; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + Do not build-depend on libjack-dev and libavcodec-dev + + lib32asound-plugins conflicts against ia32-libs + + -- Luke Yelavich Mon, 04 May 2009 17:01:25 +1000 + +alsa-plugins (1.0.19-2) unstable; urgency=low + + [ Jordi Mallach ] + * Fix non-UTF-8 content in the previous changelog entry, which made + the previous upload being rejected by the archive software. + + [ Elimar Riesebieter ] + * Added a new version of the pulseaudio example provided by Carsten + Lüdtke which will work better with systems with more than one card. + + -- Jordi Mallach Mon, 23 Mar 2009 13:12:33 +0100 + +alsa-plugins (1.0.19-1) unstable; urgency=low + + * New upstream release. (closes: #519001) + * Upload to unstable. + + [ Elimar Riesebieter ] + * Indent the description list in control + * Added '--with-avcodec-includedir=\$${prefix}/include/libavcodec' + (closes: #518194) + * Added a52 setup for pulseaudio in examples. Thanks Carsten Lüdtke. + (closes: #518384) + + [ Jordi Mallach ] + * Temporarily remove Build-Depends on libavcodec-dev by request of + the Release Team in order to not interfere with the ffmpeg transition. + + -- Jordi Mallach Thu, 12 Mar 2009 20:31:39 +0100 + +alsa-plugins (1.0.18-2) experimental; urgency=low + + [ Elimar Riesebieter ] + * Fixed FTBS on sparc: The Build-Dependency on + amd64-libs should probably be "amd64-libs [i386]", not + "amd64-libs [i386 powerpc sparc s390]". Thanks Frank Lichtenheld. + (closes: #505170) + + -- Jordi Mallach Sun, 18 Jan 2009 14:43:43 +0100 + +alsa-plugins (1.0.18-1ubuntu4) jaunty; urgency=low + + [ Daniel T Chen ] + * Backport from git HEAD: + - 0001_validate_optimise_lookup.patch + + [ Luke Yelavich ] + * debian/control: bump libasound2-dev build dependency to 1.0.18-1ubuntu7 + + -- Luke Yelavich Fri, 20 Feb 2009 15:14:08 +1100 + +alsa-plugins (1.0.18-1ubuntu3) jaunty; urgency=low + + * debian/control: lib32asound2-plugins should conflict against ia32-libs. + (LP: #305860) + + -- Luke Yelavich Sun, 07 Dec 2008 10:26:02 -0800 + +alsa-plugins (1.0.18-1ubuntu2) jaunty; urgency=critical + + * Dropped build-dep on ia32-libs/amd64-libs to clear + dep-wait FTBFS (LP: #295278) + + -- Michael Casadevall Sat, 08 Nov 2008 04:10:20 -0500 + +alsa-plugins (1.0.18-1ubuntu1) jaunty; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + - Do not build-depend on libjack-dev and libavcodec-dev. + + -- Luke Yelavich Thu, 06 Nov 2008 14:43:55 +1100 + +alsa-plugins (1.0.18-1) experimental; urgency=low + + * New upstream release. + + [ Elimar Riesebieter ] + * Bumped libasound2-dev version to >= 1.0.18 in Build-Depends. + * Removed pulse_fixes.patch. Applied differently upstream. + + [ Jordi Mallach ] + * Add lpia to the list of supported architectures. + * Extend package descriptions to mention the most prominent plugins + (closes: #497636). + * Require debhelper 7. + + [ Christopher James Halse Rogers ] + * debian/control, debian/rules: import the multi-arch magic from + alsa-lib to build a lib32asound2-plugins package wherever + lib32asound2 is built, and similarly for lib64asound2 (closes: #436201). + + -- Jordi Mallach Thu, 06 Nov 2008 00:46:19 +0100 + +alsa-plugins (1.0.17-1) experimental; urgency=low + + * New upstream release. + + [ Elimar Riesebieter ] + * Reworked pulse_fixes.patch + * Switched to debhelper 7. + * Bumped Standard-Version to 3.8.0; no changes needed. + + -- Elimar Riesebieter Sat, 30 Aug 2008 16:23:08 +0200 + +alsa-plugins (1.0.17-0ubuntu4) intrepid; urgency=low + + * Revert commit b05f0176d1427586e411a91cda02a8877c5c8c0d from alsa-plugins + git. This commit enabled the pulseaudio alsa plugin to use 32-bit sample + lengths via PulseAudio, however PulseAudio 0.9.10 in Intrepid doesn't + support these sample lenths in its API. This resulted in gstreamer + applications failing to play audio with an error, when attempting to use + pulseaudio output via the alsa pulseaudio plugin. It was also breaking + SDL applications/games that were using SDL's ALSA output. (LP: #274124) + + -- Luke Yelavich Tue, 30 Sep 2008 13:44:03 +1000 + +alsa-plugins (1.0.17-0ubuntu3) intrepid; urgency=low + + * debian/patches/pulse_update.patch: Added some further fixes from Lennart's + alsa-plugins tree. + + -- Luke Yelavich Thu, 25 Sep 2008 12:21:51 +1000 + +alsa-plugins (1.0.17-0ubuntu2) intrepid; urgency=low + + * debian/patches/pulse_update.patch: Latest pulseaudio plugin taken from + alsa-plugins GIT. This code update massively improves the plugin's + behavior, particularly with some applications that may work with alsa + in an unusual way. + + -- Luke Yelavich Mon, 22 Sep 2008 10:30:50 +1000 + +alsa-plugins (1.0.17-0ubuntu1) intrepid; urgency=low + + * New upstream release. + * debian/control: Update libasound2 build dep. + + -- Luke Yelavich Thu, 28 Aug 2008 10:17:38 +1000 + +alsa-plugins (1.0.16-1ubuntu2) intrepid; urgency=low + + * debian/patches/pulse-remove-useless-asserts.diff: Remove an extra + assert from pulseaudio plugin. + + -- Luke Yelavich Thu, 08 May 2008 23:31:48 +1000 + +alsa-plugins (1.0.16-1ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + - Do not build-depend on libjack-dev and libavcodec-dev. + - add lpia to supported arches; + - adhere to DebianMaintainerField spec. + + -- Luke Yelavich Thu, 08 May 2008 23:09:21 +1000 + +alsa-plugins (1.0.16-1) unstable; urgency=low + + * New upstream release + + [Jordi Mallach] + * Switch to now official Vcs-* control fields. + * Apply some important Pulse fixes, provided by lool, neurocyte and sjoerd. + + [ Elimar Riesebieter ] + * Switched to debhelper 6. + * Bumped Standard-Version to 3.7.3; no changes needed. + * Fullified copyright not in copyright file. + * Removed pulse patches. Applied upstream. + + -- Jordi Mallach Tue, 26 Feb 2008 17:42:37 +0100 + +alsa-plugins (1.0.15-1ubuntu3) hardy; urgency=low + + * Backport remaining pcm_pulse.c patches from hg tip (LP: #112948) + that allow Ekiga to work again with PulseAudio + - debian/patches/pulse-{minmax,assert}.diff + + -- Daniel T Chen Fri, 29 Feb 2008 12:28:40 -0500 + +alsa-plugins (1.0.15-1ubuntu2) hardy; urgency=low + + * libavcodec cannot be shipped on CDs, disabled the dependency again to make + CDs installable + + -- Oliver Grawert Thu, 29 Nov 2007 14:59:58 +0100 + +alsa-plugins (1.0.15-1ubuntu1) hardy; urgency=low + + * Merge from Debian unstable. + * Apply Ubuntu-specific change: + - debian/control: + + drop libjack-dev build-dependency since we don't build the + jack plugin [yet]; + + add lpia to supported arches; + + adhere to DebianMaintainerField spec. + * Drop unnecessary Ubuntu-specific change: + - debian/control: drop libavcodec-dev build-dependency to save + space [this Ubuntu delta didn't save significant space and + removed a feature]. + + -- Daniel T Chen Sat, 17 Nov 2007 18:00:56 -0500 + +alsa-plugins (1.0.15-1) unstable; urgency=low + + * New upstream release. + + [ Elimar Riesebieter ] + * Added Homepage header in debian/control. + * debian/rules: s/-$(MAKE) distclean/[ ! -f Makefile ] || $(MAKE) distclean/ + + [ Jordi Mallach ] + * Add patches pulse-buffer_attr.diff and pulse-state_xrun.diff, taken from + Fedora, to fix various issues with the Pulse plugin. Thanks Sjoerd Simons + for the pointer. + + -- Jordi Mallach Tue, 30 Oct 2007 17:10:08 +0100 + +alsa-plugins (1.0.14-1ubuntu3) gutsy; urgency=low + + * Build packages for lpia as well. + + -- Adam Conrad Wed, 15 Aug 2007 23:49:36 +1000 + +alsa-plugins (1.0.14-1ubuntu2) gutsy; urgency=low + + * debian/control: + - Don't build-depend on libavcodec-dev (saves space for cd image), + thus disabling the a52 alsa-lib plugin, + - Amend Description to note the above change. + + -- Daniel T Chen Mon, 25 Jun 2007 04:56:35 -0400 + +alsa-plugins (1.0.14-1ubuntu1) gutsy; urgency=low + + * Merge from Debian unstable, remaining changes: + - debian/control: + + Don't build-depend on JACK, as it's in universe. Clarify and + update the Description to note the above restriction and + {in,ex}clusion of newer plugins (LP: #57089), + + Adhere to DebianMaintainerField. + + -- Daniel T Chen Tue, 12 Jun 2007 19:03:08 -0400 + +alsa-plugins (1.0.14-1) unstable; urgency=low + + * New upstream release. + + [ Elimar Riesebieter ] + * Prepared to use quilt as the patch manager. + + [ Jordi Mallach ] + * debian/control: build-depend on libavcodec-dev, to enable the a52 + plugin (closes: #407428). + + -- Jordi Mallach Sat, 09 Jun 2007 21:41:47 +0200 + +alsa-plugins (1.0.14~rc4-1) experimental; urgency=low + + * New upstream release candidate. + + [ Elimar Riesebieter ] + * Changed Build-Depends from libjack0.100-dev to libjack-dev as the headers + are really in libjack-dev. + * Removed 01_hgnew.patch: Done upstream. + + [ Jordi Mallach ] + * debian/control: add XS-Vcs-Svn and XS-Vcs-Browser headers. + + -- Jordi Mallach Sun, 13 May 2007 11:44:15 +0200 + +alsa-plugins (1.0.14~rc3-2) experimental; urgency=low + + [ Elimar Riesebieter ] + * Updated to latest mercurial version via 01_hgnew.dpatch as some files were + missing. It is still 1.0.14rc3. Removed the stolen gcd.h ;) + + -- Jordi Mallach Tue, 17 Apr 2007 11:30:22 +0200 + +alsa-plugins (1.0.14~rc3-1) experimental; urgency=low + + * New upstream release candidate. + + [ Elimar Riesebieter ] + * Added missing gcd.h. Stolen from gnulibs which installs the libs not in + include. + + -- Elimar Riesebieter Sat, 31 Mar 2007 18:40:48 +0200 + +alsa-plugins (1.0.14~rc1a-1) experimental; urgency=low + + * New upstream release candidate. + + [ Elimar Riesebieter ] + * Added arch armel to libasound2-plugins. (closes: #408771) + + -- Elimar Riesebieter Sat, 30 Dec 2006 02:48:26 +0100 + +alsa-plugins (1.0.13-3ubuntu1) feisty; urgency=low + + * disable jack dependencies for main inclusion + + -- Oliver Grawert Fri, 2 Feb 2007 15:30:22 +0100 + +alsa-plugins (1.0.13-3) unstable; urgency=low + + [ Elimar Riesebieter ] + * Added XS-X-Vcs-Svn field in control. + + [ Jordi Mallach ] + * Upload to unstable. + + -- Jordi Mallach Mon, 16 Oct 2006 14:49:06 +0200 + +alsa-plugins (1.0.13-2) experimental; urgency=low + + * debian/control: + - build-depend on libsamplerate0-dev, to enable the samplerate plugin. + - build-depend on libpulse-dev, to enable the pulseaudio plugin. + * Target experimental, while pulseaudio gets shaked out by the buildds. + + -- Jordi Mallach Thu, 5 Oct 2006 11:19:06 +0200 + +alsa-plugins (1.0.13-1) unstable; urgency=low + + * New upstream release + + [ Jordi Mallach ] + * Add Enhances: libasound2. + + -- Jordi Mallach Tue, 3 Oct 2006 14:22:54 +0200 + +alsa-plugins (1.0.12-1) unstable; urgency=low + + * New upstream release + + [ Elimar Riesebieter ] + * debian/control: bumped build-deps to libasound2-dev (>= 1.0.12) + * debian/control: bumped Standards-Version to 3.7.2, no changes. + * Bumped compat to 5 and debhelper version >=5.0.37 + * Enabled all plugins (closes: #384029) + * Completed /usr/share/doc/libasound2-plugins. + + -- Jordi Mallach Mon, 11 Sep 2006 13:10:10 +0200 + +alsa-plugins (1.0.11-1) unstable; urgency=low + + [ Elimar Riesebieter ] + * New upstream release + * Added myself to Uploaders + * Updated changelog.ALSA + * Adjusted rules: + sed s/pcm\/jack/jack/ + + [ Jordi Mallach ] + * debian/control: bump build-deps to libasound2-dev (>= 1.0.11). + + -- Jordi Mallach Sun, 23 Apr 2006 18:07:36 +0200 + +alsa-plugins (1.0.10-1) unstable; urgency=low + + * New upstream release + + -- Jordi Mallach Tue, 22 Nov 2005 23:24:32 +0100 + +alsa-plugins (1.0.9+1.0.10rc2-1) experimental; urgency=low + + * New upstream release candidate + * Thomas Hood + - debian/control: s/Architecture: any/Architecture: / + + -- Thomas Hood Wed, 12 Oct 2005 12:10:54 +0200 + +alsa-plugins (1.0.9+1.0.10rc1-1) experimental; urgency=low + + * New upstream release candidate + * Thomas Hood + - Build-Depend on new libasound2-dev (otherwise build fails) + - Fix watch file + + -- Jordi Mallach Mon, 19 Sep 2005 21:35:27 +0200 + +alsa-plugins (1.0.9-2) unstable; urgency=low + + * Thomas Hood + - Simplify versioned dependency on libasound2 + - Bump Standards-Version to 3.6.2.1; no changes required + - Add upstream changelog + * Jordi Mallach + - debian/control: switch to libjack0.100.0-dev. + + -- Jordi Mallach Wed, 6 Jul 2005 20:35:02 +0200 + +alsa-plugins (1.0.9-1) unstable; urgency=low + + * New source package generating the libasound2-plugins binary package, + formerly generated by alsa-lib. libasound2-plugins contains the "jack" + ALSA library plugin. + * An "oss" ALSA library plugin is also available. Please file a wish + if you have some use for it. + * Thomas Hood + - Include asound.conf example of how to use the jack plugin + + -- Jordi Mallach Sat, 4 Jun 2005 13:00:00 +0200 + --- alsa-plugins-1.0.20.orig/debian/libasound2-plugins.docs +++ alsa-plugins-1.0.20/debian/libasound2-plugins.docs @@ -0,0 +1,2 @@ +doc/*.txt +doc/README* --- alsa-plugins-1.0.20.orig/debian/compat +++ alsa-plugins-1.0.20/debian/compat @@ -0,0 +1 @@ +7 --- alsa-plugins-1.0.20.orig/debian/NOTES +++ alsa-plugins-1.0.20/debian/NOTES @@ -0,0 +1,9 @@ + MAINTAINER NOTES + for alsa-plugins + + +TODO for each new upstream release +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Check Ubuntu patches at http://people.ubuntulinux.org/~scott/patches/ +* Update debian/changelog.ALSA from release announcement + --- alsa-plugins-1.0.20.orig/debian/changelog.ALSA +++ alsa-plugins-1.0.20/debian/changelog.ALSA @@ -0,0 +1,353 @@ +Changelog between 1.0.19 and 1.0.20 releases +(http://www.alsa-project.org/main/index.php/Changes_v1.0.19_v1.0.20) +(Reformated as ASCII text) +******************************************** + +* alsa-plugins + + Core + -Fix build of pph plugin with speex-1.2rc1 + -Add Speex pre-processing plugin + -Add arcam-av plugin + -Release v1.0.20 + + /Makefile.am + -Add Speex pre-processing plugin + -Add arcam-av plugin + -Clean up Makefile.am + + Arcam AV control plugin + -Add arcam-av plugin + -arcam_av: Remove incorrect usage of the static SHM ID variable + -arcam_av: Refactor control specifications to facilitate addition of "numid" optimisation + -arcam_av: Refactor event callback to facilitate addition of "numid" optimisation + + Automatic upmix / downmix plugins + -Add missing continue in config parser of pcm-upmix plugin + -Fix build of pph plugin with speex-1.2rc1 + -Add missing continue in config parser of pcm-upmix plugin (again) + + Documentation + -Add Speex pre-processing plugin + -Add arcam-av plugin + + OSS Mixer -> ALSA Control plugin + -oss: Add numid check in ctl plugin + + Public Parrot Hack rate converter + -Add missing -lm to pph plugin + + PulseAudio -> ALSA plugin + -pulse: Add numid check in ctl plugin + + Speex PCM plugin + -Add Speex pre-processing plugin + +Changelog between 1.0.18 and 1.0.19 releases +(http://www.alsa-project.org/main/index.php/Changes_v1.0.18_v1.0.19) +(Reformated as ASCII text) +******************************************** + +* alsa-plugins + + Core + -Allow opt-out from jack, pulseaudio and avcodec dependencies. + -Add the attributes.m4 macro file from xine/lscube. + -Check for --no-undefined linker flag and use it. + -Release v1.0.19 + + /Makefile.am + -Add the attributes.m4 macro file from xine/lscube. + -Added m4/attributes.m4 to extra dist. + + A52 Output plugin + -Check for --no-undefined linker flag and use it. + + Alsa support for Maemo SDK (n770) + -Cleanup flags in maemo/Makefile.am + -[RFC] Don't use pow() for calculating a power of 2, use shift instead. + -Make some static tables and strings constants. + -Mark as static the functions not used outside their unit. + + Automatic upmix / downmix plugins + -Make some static tables and strings constants. + + Jack PCM plugin + -Check for --no-undefined linker flag and use it. + + PulseAudio -> ALSA plugin + -Mark as static the functions not used outside their unit. + +Changelog between 1.0.17 and 1.0.18 releases +(http://www.alsa-project.org/main/index.php/Changes_v1.0.17_v1.0.18) +(Reformated as ASCII text) +******************************************** + +* alsa-plugins + + Core + -Add usb_stream PCM plugin + -Release v1.0.18rc1 + -Release v1.0.18rc2 + -Fix build with recent ffmpeg + -Release v1.0.18rc3 + -Release v1.0.18 + + /Makefile.am + -Add usb_stream PCM plugin + + A52 Output plugin + -Fix build with recent ffmpeg + + PulseAudio -> ALSA plugin + -pulse - Returns errors instead of assert() + -send both an uncork and a trigger in _start() + -Reindent to Linux kernel style + -Add Emacs-style /*-*- linux-c -*-*/ header comment + -Make pulse_new() a proper C function + -Don't modify the SIGPIPE handler + -Call pa_context_disconnect() explicitly + -use SNDERR instead of fprintf to print error messages + -Support S32 sample types + -Add trailing NUL character to snprintf output + -Get rid of pulse_poll_revents() + -Add more error checking + -Remove fix for bug 0003470 + -Rework hardware parameter selection + -A bag of minor clean ups for ctl_pulse.c + -Make pulse_ext_callback const + -Drop our own implementation of the poll() callbacks + -A bag of minor clean-ups for pulse.c + -Split out O_NONBLOCK setting into seperate function + -Save a byte of memory + -Adjust buffering metrics to match what PA internally uses + -Make sure we always have a sensible channel mapping + -Use PA_STREAM_EARLY_REQUESTS if available + -Use S32/FLOAT32 only where available in the PA libs + -Add const to our snd_pcm_ioplug_callback_t instances + -Don't implement our own poll handlers, we can use the default ones + -Remove our own poll handler implementation entirely + -A bag of clean-ups for pcm_ctl.c + -pulse - Start PA event loop after we have created the context + -pulse - fix minor memory leak + -pulse - Fix destruction order on failure + -pulse - Fix destruction logic on failed construction + -pulse - Fix capture problem + + USB stream plugin + -Add usb_stream PCM plugin + -Add missing noinst_HEADERS to usb_stream/Makefile.am + + libavcodec's resampler + -Fix build with recent ffmpeg + +Changelog between 1.0.16 and 1.0.17 releases +(http://www.alsa-project.org/main/index.php/Changes_v1.0.16_v1.0.17) +(Reformated as ASCII text) +******************************************** + +* alsa-plugins + + Core + - removed .hg* files and renamed hgcompile to gitcompile + - Improve configure for maemo plugin + - Release v1.0.17rc2 + - Fix invalid withval in configure script + - Release v1.0.17 + + /Makefile.am + - hgcompile -> gitcompile change + - Improve configure for maemo plugin + + A52 Output plugin + - Various plugins don't support "hint" sections + + Alsa support for Maemo SDK (n770) + - Various plugins don't support "hint" sections + - Fix close in maemo callback + + Jack PCM plugin + - Various plugins don't support "hint" sections + + PulseAudio -> ALSA plugin + - pulse - Fix useless assert + - pulse - Remove another assert + - Pulseaudio alsa configure hook + - pulse - Change to hook load_if_running + +Changelog between 1.0.15 and 1.0.16 releases +(http://www.alsa-project.org/main/index.php/Changes_v1.0.15_v1.0.16) +(Reformated as ASCII text) +******************************************** + +* alsa-plugins + + PulseAudio -> ALSA plugin + - PulseAudio plugin: report XRUN state back to application + - Fix wrong assert in pulse plugin + - Use different buffer metrics in the PulseAudio plugin + - Fix unexpected assert with pulse plugin + - pulse - Add minmax condition for period_bytes and periods + +Changelog between 1.0.14 and 1.0.15 releases +(http://www.alsa-project.org/main/index.php/Changes_v1.0.14_v1.0.15) +(Reformated as ASCII text) +******************************************** + +* alsa-plugins + + A52 Output plugin + - Add -no-undefined option to LDFLAGS + + Alsa support for Maemo SDK (n770) + - Add -no-undefined option to LDFLAGS + + Jack PCM plugin + - Add -no-undefined option to LDFLAGS + + Public Parrot Hack rate converter + - Disable direct sinc table + - Update speex rate converter code + + Rate Converter plugins + - Fix the pop noise with samplerate plugin + +Changelog between 1.0.14rc3 and 1.0.14 releases +http://www.alsa-project.org/changes/v1-0-14rc4--v1-0-14.txt) +******************************************** + +* alsa-plugins + + Core + - Fix plugindir config setting + - Add plugin directory configure option + - Enable link with external libspeex + + /Makefile.am + - Enable link with external libspeex + + A52 Output plugin + - Add plugin directory configure option + - Fix segfault of a52 plugin + + Jack PCM plugin + - Add plugin directory configure option + + Public Parrot Hack rate converter + - Enable link with external libspeex + +Changelog between 1.0.14rc2 and 1.0.14rc3 releases +http://www.alsa-project.org/changes/v1-0-14rc2--v1-0-14rc3.txt) +******************************************** + +* alsa-plugins + + Documentation + - Add documentation for speex rate plugin + + Public Parrot Hack rate converter + - Add missing files for pph + - pph - do not include in rate_speexrate.c + - Update version of speex resampler plugin + - Add missing header files for pph + + PulseAudio -> ALSA plugin + - Improve parameter constraints in alsa-pulse + + libavcodec's resampler + - Add missing gcd.h to rate-lavc/Makefile.am + +Changelog between 1.0.14rc2 and 1.0.14rc3 releases +http://www.alsa-project.org/changes/v1-0-14rc2--v1-0-14rc3.txt) +******************************************** + +* alsa-plugins + + Core + - Add rate resampler plugin based on speex + - Add livavcodec resampler plugin + + /Makefile.am + - Add rate resampler plugin based on speex + - Add livavcodec resampler plugin + + Documentation + - Add livavcodec resampler plugin + + Public Parrot Hack rate converter + - pph - do not include in rate_speexrate.c + - Add rate resampler plugin based on speex + + Rate Converter plugins + - Fix wrong implementation of input/output_frames in samplerate plugin + + libavcodec's resampler + - Add livavcodec resampler plugin + +Changelog between 1.0.14rc1 and 1.0.14rc2 releases +http://www.alsa-project.org/changes/v1-0-14rc1--v1-0-14rc2.txt) +******************************************** +* alsa-plugins + + /Makefile.am + - compile maemo only if DBUS is present + + Alsa support for Maemo SDK (n770) + - release 1.0.14rc1 + +Changelog between 1.0.13 and 1.0.14rc1a releases +http://www.alsa-project.org/changes/v1-0-13--v1-0-14rc1.txt) +******************************************** + +* alsa-plugins + + Core + - Alsa support for Maemo SDK (n770): Build configuration + + /Makefile.am + - compile maemo only if DBUS is present + - Alsa support for Maemo SDK (n770): Build configuration + + Alsa support for Maemo SDK (n770) + - Alsa support for Maemo SDK (n770): Header files + - Alsa support for Maemo SDK (n770): DSP protocol + - Alsa support for Maemo SDK (n770): External PCM IO plugin + - Alsa support for Maemo SDK (n770): External Control plugin + - Alsa support for Maemo SDK (n770): Build configuration + - Alsa support for Maemo SDK (n770) - Remove compile warnings + + Documentation + - Alsa support for Maemo SDK (n770): Documentation + +Changelog between 1.0.12 and 1.0.13 releases +http://www.alsa-project.org/changes/v1-0-12--v1-0-13.txt) +******************************************** + +* alsa-plugins + + Core + - release 1.0.12 + + PulseAudio -> ALSA plugin + - Remove stray Polypaudio strings + +Changelog between 1.0.11 and 1.0.12 releases +http://www.alsa-project.org/changes/v1-0-11--v1-0-12.txt) +******************************************** + +* alsa-plugins + + Core + - Add hgcompile script + - Update Polypaudio plug-in to the 0.9.0 API + - Fix capsed name in configure + - Follow Polypaudio/PulseAudio name change + + /Makefile.am + - Add hgcompile script + - Follow Polypaudio/PulseAudio name change + + A52 Output plugin + - a52 - Add slavepcm option + + Documentation + - Follow Polypaudio/PulseAudio name change + - Add missing a52.txt + - a52 - Add slavepcm option + + Jack PCM plugin + - Fix port names in jack plugin + + Polyp -> ALSA plugin + - Update Polypaudio plug-in to the 0.9.0 API + - Follow Polypaudio/PulseAudio name change + +Changelog between 1.0.10 and 1.0.11 releases +http://www.alsa-project.org/changes/v1-0-10--v1-0-11.txt) +******************************************** + +* alsa-plugins + + Core + - Add samplerate rate converter plugin + - Add a52 output plugin + - Structure reorganziation, added polyp plugin + - Add upmix and vdownmix plugins + - Change autoconf requirement to 2.59 + - Fixes for polyp plugin + + /Makefile.am + - Add samplerate rate converter plugin + - Add a52 output plugin + - Structure reorganziation, added polyp plugin + - Add upmix and vdownmix plugins + + /ctl/Makefile.am + - Structure reorganziation, added polyp plugin + + A52 Output plugin + - a52 plugin - Fix iec958 frames for S16-BE + - Add a52 output plugin + - Fix XRUN detection in a52 plugin + - Accept integer for card option + + Automatic upmix / downmix plugins + - Misc fixes for upmix plugin + - Add upmix and vdownmix plugins + + Documentation + - Fix a typo + - Add samplerate rate converter plugin + - Misc fixes for upmix plugin + - Add a52 output plugin + - Update polyp plugin + - Fix Makefile.am entry + - Add upmix and vdownmix plugins + + Jack PCM plugin + - Allow concurrent runs with different names + - Fix a compile warning + - jack plugin closes stdin if jack is unavailable + + OSS Mixer -> ALSA Control plugin + - Fix misc compile warnings + - Check the malloc error + - Structure reorganziation, added polyp plugin + + Polyp -> ALSA plugin + - Fix handling of ctl elements + - Update polyp plugin + - Fixes for polyp plugin + - Properly terminate stream in polypaudio plugin + - Incorrect revents in polypaudio plugin + - Make polypaudio plugin thread safe + + Rate Converter plugins + - Add samplerate rate converter plugin --- alsa-plugins-1.0.20.orig/debian/libasound2-plugins.examples +++ alsa-plugins-1.0.20/debian/libasound2-plugins.examples @@ -0,0 +1 @@ +debian/examples/* --- alsa-plugins-1.0.20.orig/debian/patches/0002_alsa-plugins-oss-Fix-missing-frags-init.patch +++ alsa-plugins-1.0.20/debian/patches/0002_alsa-plugins-oss-Fix-missing-frags-init.patch @@ -0,0 +1,12 @@ +Index: alsa-plugins-1.0.20/oss/pcm_oss.c +=================================================================== +--- alsa-plugins-1.0.20.orig/oss/pcm_oss.c 2009-08-03 22:44:11.000000000 -0400 ++++ alsa-plugins-1.0.20/oss/pcm_oss.c 2009-08-03 22:46:45.000000000 -0400 +@@ -181,6 +181,7 @@ + fprintf(stderr, "*** OSS: invalid period size %d\n", (int)io->period_size); + return -EINVAL; + } ++ oss->periods = io->buffer_size / io->period_size; + + _retry: + tmp = oss->period_shift | (oss->periods << 16); --- alsa-plugins-1.0.20.orig/debian/patches/0001_alsa-plugins-oss-Fix-missing-frags-init.patch +++ alsa-plugins-1.0.20/debian/patches/0001_alsa-plugins-oss-Fix-missing-frags-init.patch @@ -0,0 +1,12 @@ +Index: alsa-plugins-1.0.20/oss/pcm_oss.c +=================================================================== +--- alsa-plugins-1.0.20.orig/oss/pcm_oss.c 2009-08-03 22:44:11.000000000 -0400 ++++ alsa-plugins-1.0.20/oss/pcm_oss.c 2009-08-03 22:46:45.000000000 -0400 +@@ -181,6 +181,7 @@ + fprintf(stderr, "*** OSS: invalid period size %d\n", (int)io->period_size); + return -EINVAL; + } ++ oss->periods = io->buffer_size / io->period_size; + + _retry: + tmp = oss->period_shift | (oss->periods << 16); --- alsa-plugins-1.0.20.orig/debian/patches/series +++ alsa-plugins-1.0.20/debian/patches/series @@ -0,0 +1,2 @@ +0001_alsa-plugins-oss-Fix-missing-frags-init.patch +0002_pulse-updates.patch --- alsa-plugins-1.0.20.orig/debian/patches/0002_pulse-updates.patch +++ alsa-plugins-1.0.20/debian/patches/0002_pulse-updates.patch @@ -0,0 +1,975 @@ +diff --git a/pulse/conf_pulse.c b/pulse/conf_pulse.c +index 3f9e071..35dd383 100644 +--- a/pulse/conf_pulse.c ++++ b/pulse/conf_pulse.c +@@ -61,15 +61,7 @@ conf_pulse_hook_load_if_running(snd_config_t * root, snd_config_t * config, + goto out; + + do { +- err = pa_mainloop_prepare(loop, -1); +- if (err < 0) +- goto out; +- +- err = pa_mainloop_poll(loop); +- if (err < 0) +- goto out; +- +- err = pa_mainloop_dispatch(loop); ++ err = pa_mainloop_iterate(loop, 1, NULL); + if (err < 0) + goto out; + +diff --git a/pulse/ctl_pulse.c b/pulse/ctl_pulse.c +index c6cf9e2..85863ed 100644 +--- a/pulse/ctl_pulse.c ++++ b/pulse/ctl_pulse.c +@@ -125,8 +125,9 @@ static void event_cb(pa_context * c, pa_subscription_event_type_t t, + pa_operation *o; + + assert(ctl); +- assert(ctl->p); +- assert(ctl->p->context); ++ ++ if (!ctl->p || !ctl->p->mainloop || !ctl->p->context) ++ return; + + o = pa_context_get_sink_info_by_name(ctl->p->context, ctl->sink, + sink_info_cb, ctl); +@@ -148,8 +149,13 @@ static int pulse_update_volume(snd_ctl_pulse_t * ctl) + pa_operation *o; + + assert(ctl); +- assert(ctl->p); +- assert(ctl->p->context); ++ ++ if (!ctl->p) ++ return -EBADFD; ++ ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ return err; + + o = pa_context_get_sink_info_by_name(ctl->p->context, ctl->sink, + sink_info_cb, ctl); +@@ -180,17 +186,27 @@ static int pulse_update_volume(snd_ctl_pulse_t * ctl) + static int pulse_elem_count(snd_ctl_ext_t * ext) + { + snd_ctl_pulse_t *ctl = ext->private_data; +- int count = 0; ++ int count = 0, err; + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; ++ + pa_threaded_mainloop_lock(ctl->p->mainloop); + ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) { ++ count = err; ++ goto finish; ++ } ++ + if (ctl->source) + count += 2; + if (ctl->sink) + count += 2; + ++finish: + pa_threaded_mainloop_unlock(ctl->p->mainloop); + + return count; +@@ -200,13 +216,21 @@ static int pulse_elem_list(snd_ctl_ext_t * ext, unsigned int offset, + snd_ctl_elem_id_t * id) + { + snd_ctl_pulse_t *ctl = ext->private_data; ++ int err; + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; ++ + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); + + pa_threaded_mainloop_lock(ctl->p->mainloop); + ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ goto finish; ++ + if (ctl->source) { + if (offset == 0) + snd_ctl_elem_id_set_name(id, SOURCE_VOL_NAME); +@@ -215,14 +239,19 @@ static int pulse_elem_list(snd_ctl_ext_t * ext, unsigned int offset, + } else + offset += 2; + ++ err = 0; ++ ++finish: + pa_threaded_mainloop_unlock(ctl->p->mainloop); + +- if (offset == 2) +- snd_ctl_elem_id_set_name(id, SINK_VOL_NAME); +- else if (offset == 3) +- snd_ctl_elem_id_set_name(id, SINK_MUTE_NAME); ++ if (err >= 0) { ++ if (offset == 2) ++ snd_ctl_elem_id_set_name(id, SINK_VOL_NAME); ++ else if (offset == 3) ++ snd_ctl_elem_id_set_name(id, SINK_MUTE_NAME); ++ } + +- return 0; ++ return err; + } + + static snd_ctl_ext_key_t pulse_find_elem(snd_ctl_ext_t * ext, +@@ -260,7 +289,9 @@ static int pulse_get_attribute(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key, + return -EINVAL; + + assert(ctl); +- assert(ctl->p); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + +@@ -311,7 +342,9 @@ static int pulse_read_integer(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key, + pa_cvolume *vol = NULL; + + assert(ctl); +- assert(ctl->p); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + +@@ -361,7 +394,9 @@ static int pulse_write_integer(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key, + pa_cvolume *vol = NULL; + + assert(ctl); +- assert(ctl->p && ctl->p->context); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + +@@ -465,6 +500,9 @@ static void pulse_subscribe_events(snd_ctl_ext_t * ext, int subscribe) + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return; ++ + pa_threaded_mainloop_lock(ctl->p->mainloop); + + ctl->subscribed = !!(subscribe & SND_CTL_EVENT_MASK_VALUE); +@@ -477,14 +515,23 @@ static int pulse_read_event(snd_ctl_ext_t * ext, snd_ctl_elem_id_t * id, + { + snd_ctl_pulse_t *ctl = ext->private_data; + int offset; +- int err = -EAGAIN; ++ int err; + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; ++ + pa_threaded_mainloop_lock(ctl->p->mainloop); + +- if (!ctl->updated || !ctl->subscribed) ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ goto finish; ++ ++ if (!ctl->updated || !ctl->subscribed) { ++ err = -EAGAIN; + goto finish; ++ } + + if (ctl->source) + offset = 2; +@@ -523,18 +570,28 @@ static int pulse_ctl_poll_revents(snd_ctl_ext_t * ext, struct pollfd *pfd, + unsigned short *revents) + { + snd_ctl_pulse_t *ctl = ext->private_data; +- int err = 0; ++ int err; + + assert(ctl); +- assert(ctl->p); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ goto finish; ++ + if (ctl->updated) + *revents = POLLIN; + else + *revents = 0; + ++ err = 0; ++ ++finish: ++ + pa_threaded_mainloop_unlock(ctl->p->mainloop); + + return err; +@@ -549,11 +606,8 @@ static void pulse_close(snd_ctl_ext_t * ext) + if (ctl->p) + pulse_free(ctl->p); + +- if (ctl->source) +- free(ctl->source); +- if (ctl->sink) +- free(ctl->sink); +- ++ free(ctl->source); ++ free(ctl->sink); + free(ctl); + } + +diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c +index db8d1e1..02a837e 100644 +--- a/pulse/pcm_pulse.c ++++ b/pulse/pcm_pulse.c +@@ -49,6 +49,32 @@ typedef struct snd_pcm_pulse { + pa_buffer_attr buffer_attr; + } snd_pcm_pulse_t; + ++static int check_stream(snd_pcm_pulse_t *pcm) ++{ ++ int err; ++ pa_stream_state_t state; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return -EBADFD; ++ ++ err = pulse_check_connection(pcm->p); ++ if (err < 0) ++ return err; ++ ++ if (!pcm->stream) ++ return -EBADFD; ++ ++ state = pa_stream_get_state(pcm->stream); ++ if (!PA_STREAM_IS_GOOD(state)) ++ return -EIO; ++ ++ err = 0; ++ ++ return err; ++} ++ + static int update_ptr(snd_pcm_pulse_t *pcm) + { + size_t size; +@@ -106,18 +132,69 @@ static int update_active(snd_pcm_pulse_t *pcm) { + + assert(pcm); + +- ret = check_active(pcm); ++ if (!pcm->p) ++ return -EBADFD; ++ ++ ret = check_stream(pcm); + if (ret < 0) +- return ret; ++ goto finish; ++ ++ ret = check_active(pcm); ++ ++finish: + +- if (ret > 0) ++ if (ret != 0) /* On error signal the caller, too */ + pulse_poll_activate(pcm->p); + else + pulse_poll_deactivate(pcm->p); + ++ return ret; ++} ++ ++static int wait_stream_state(snd_pcm_pulse_t *pcm, pa_stream_state_t target) ++{ ++ pa_stream_state_t state; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return -EBADFD; ++ ++ for (;;) { ++ int err; ++ ++ err = pulse_check_connection(pcm->p); ++ if (err < 0) ++ return err; ++ ++ if (!pcm->stream) ++ return -EBADFD; ++ ++ state = pa_stream_get_state(pcm->stream); ++ if (state == target) ++ break; ++ ++ if (!PA_STREAM_IS_GOOD(state)) ++ return -EIO; ++ ++ pa_threaded_mainloop_wait(pcm->p->mainloop); ++ } ++ + return 0; + } + ++static void stream_success_cb(pa_stream * p, int success, void *userdata) ++{ ++ snd_pcm_pulse_t *pcm = userdata; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return; ++ ++ pa_threaded_mainloop_signal(pcm->p->mainloop, 0); ++} ++ + static int pulse_start(snd_pcm_ioplug_t * io) + { + snd_pcm_pulse_t *pcm = io->private_data; +@@ -125,26 +202,23 @@ static int pulse_start(snd_pcm_ioplug_t * io) + int err = 0, err_o = 0, err_u = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +- if (pcm->stream == NULL) +- goto finish; +- +- o = pa_stream_cork(pcm->stream, 0, pulse_stream_success_cb, +- pcm->p); ++ o = pa_stream_cork(pcm->stream, 0, stream_success_cb, pcm); + if (!o) { + err = -EIO; + goto finish; + } + +- u = pa_stream_trigger(pcm->stream, pulse_stream_success_cb, +- pcm->p); ++ u = pa_stream_trigger(pcm->stream, stream_success_cb, pcm); + + pcm->underrun = 0; + err_o = pulse_wait_operation(pcm->p, o); +@@ -160,7 +234,6 @@ static int pulse_start(snd_pcm_ioplug_t * io) + goto finish; + } + +- + finish: + pa_threaded_mainloop_unlock(pcm->p->mainloop); + +@@ -174,26 +247,23 @@ static int pulse_stop(snd_pcm_ioplug_t * io) + int err = 0, err_o = 0, err_u = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +- if (pcm->stream == NULL) +- goto finish; +- +- o = pa_stream_cork(pcm->stream, 1, pulse_stream_success_cb, +- pcm->p); ++ o = pa_stream_cork(pcm->stream, 1, stream_success_cb, pcm); + if (!o) { + err = -EIO; + goto finish; + } + +- u = pa_stream_flush(pcm->stream, pulse_stream_success_cb, +- pcm->p); ++ u = pa_stream_flush(pcm->stream, stream_success_cb, pcm); + if (!u) { + pa_operation_unref(o); + err = -EIO; +@@ -224,15 +294,17 @@ static int pulse_drain(snd_pcm_ioplug_t * io) + int err = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +- o = pa_stream_drain(pcm->stream, pulse_stream_success_cb, pcm->p); ++ o = pa_stream_drain(pcm->stream, stream_success_cb, pcm); + if (!o) { + err = -EIO; + goto finish; +@@ -259,7 +331,9 @@ static snd_pcm_sframes_t pulse_pointer(snd_pcm_ioplug_t * io) + snd_pcm_sframes_t ret = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + if (io->state == SND_PCM_STATE_XRUN) + return -EPIPE; +@@ -269,9 +343,7 @@ static snd_pcm_sframes_t pulse_pointer(snd_pcm_ioplug_t * io) + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- assert(pcm->stream); +- +- ret = pulse_check_connection(pcm->p); ++ ret = check_stream(pcm); + if (ret < 0) + goto finish; + +@@ -305,14 +377,14 @@ static int pulse_delay(snd_pcm_ioplug_t * io, snd_pcm_sframes_t * delayp) + pa_usec_t lat = 0; + + assert(pcm); +- assert(pcm->p); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + +- assert(pcm->stream); ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + + for (;;) { +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +@@ -354,13 +426,13 @@ static snd_pcm_sframes_t pulse_write(snd_pcm_ioplug_t * io, + snd_pcm_sframes_t ret = 0; + + assert(pcm); +- assert(pcm->p); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + +- assert(pcm->stream); ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + +- ret = pulse_check_connection(pcm->p); ++ ret = check_stream(pcm); + if (ret < 0) + goto finish; + +@@ -409,13 +481,13 @@ static snd_pcm_sframes_t pulse_read(snd_pcm_ioplug_t * io, + snd_pcm_sframes_t ret = 0; + + assert(pcm); +- assert(pcm->p); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + +- assert(pcm->stream); ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + +- ret = pulse_check_connection(pcm->p); ++ ret = check_stream(pcm); + if (ret < 0) + goto finish; + +@@ -475,12 +547,31 @@ finish: + return ret; + } + ++static void stream_state_cb(pa_stream * p, void *userdata) ++{ ++ snd_pcm_pulse_t *pcm = userdata; ++ pa_stream_state_t state; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return; ++ ++ state = pa_stream_get_state(p); ++ if (!PA_STREAM_IS_GOOD(state)) ++ pulse_poll_activate(pcm->p); ++ ++ pa_threaded_mainloop_signal(pcm->p->mainloop, 0); ++} ++ + static void stream_request_cb(pa_stream * p, size_t length, void *userdata) + { + snd_pcm_pulse_t *pcm = userdata; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p) ++ return; + + update_active(pcm); + } +@@ -490,7 +581,9 @@ static void stream_underrun_cb(pa_stream * p, void *userdata) + snd_pcm_pulse_t *pcm = userdata; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p) ++ return; + + pcm->underrun = 1; + } +@@ -499,7 +592,9 @@ static void stream_latency_cb(pa_stream *p, void *userdata) { + snd_pcm_pulse_t *pcm = userdata; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p) ++ return; + + pa_threaded_mainloop_signal(pcm->p->mainloop, 0); + } +@@ -512,12 +607,17 @@ static int pulse_pcm_poll_revents(snd_pcm_ioplug_t * io, + snd_pcm_pulse_t *pcm = io->private_data; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = check_active(pcm); ++ err = check_stream(pcm); ++ if (err < 0) ++ goto finish; + ++ err = check_active(pcm); + if (err < 0) + goto finish; + +@@ -541,14 +641,15 @@ static int pulse_prepare(snd_pcm_ioplug_t * io) + unsigned c, d; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + + if (pcm->stream) { + pa_stream_disconnect(pcm->stream); +- pulse_wait_stream_state(pcm->p, pcm->stream, +- PA_STREAM_TERMINATED); ++ wait_stream_state(pcm, PA_STREAM_TERMINATED); + pa_stream_unref(pcm->stream); + pcm->stream = NULL; + } +@@ -581,9 +682,7 @@ static int pulse_prepare(snd_pcm_ioplug_t * io) + goto finish; + } + +- pa_stream_set_state_callback(pcm->stream, pulse_stream_state_cb, +- pcm->p); +- ++ pa_stream_set_state_callback(pcm->stream, stream_state_cb, pcm); + pa_stream_set_latency_update_callback(pcm->stream, stream_latency_cb, pcm); + + if (io->stream == SND_PCM_STREAM_PLAYBACK) { +@@ -620,8 +719,7 @@ static int pulse_prepare(snd_pcm_ioplug_t * io) + goto finish; + } + +- err = +- pulse_wait_stream_state(pcm->p, pcm->stream, PA_STREAM_READY); ++ err = wait_stream_state(pcm, PA_STREAM_READY); + if (err < 0) { + SNDERR("PulseAudio: Unable to create stream: %s\n", pa_strerror(pa_context_errno(pcm->p->context))); + pa_stream_unref(pcm->stream); +@@ -645,7 +743,9 @@ static int pulse_hw_params(snd_pcm_ioplug_t * io, + int err = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +@@ -719,26 +819,56 @@ static int pulse_close(snd_pcm_ioplug_t * io) + + assert(pcm); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (pcm->p && pcm->p->mainloop) { + +- if (pcm->stream) { +- pa_stream_disconnect(pcm->stream); +- pa_stream_unref(pcm->stream); +- } ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + +- pa_threaded_mainloop_unlock(pcm->p->mainloop); ++ if (pcm->stream) { ++ pa_stream_disconnect(pcm->stream); ++ pa_stream_unref(pcm->stream); ++ } ++ ++ pa_threaded_mainloop_unlock(pcm->p->mainloop); ++ } + + if (pcm->p) + pulse_free(pcm->p); + +- if (pcm->device) +- free(pcm->device); +- ++ free(pcm->device); + free(pcm); + + return 0; + } + ++static int pulse_pause(snd_pcm_ioplug_t * io, int enable) ++{ ++ snd_pcm_pulse_t *pcm = io->private_data; ++ int err = 0; ++ pa_operation *o; ++ ++ assert (pcm); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; ++ ++ pa_threaded_mainloop_lock(pcm->p->mainloop); ++ ++ err = check_stream(pcm); ++ if (err < 0) ++ goto finish; ++ ++ o = pa_stream_cork(pcm->stream, enable, NULL, NULL); ++ if (o) ++ pa_operation_unref(o); ++ else ++ err = -EIO; ++ ++finish: ++ pa_threaded_mainloop_unlock(pcm->p->mainloop); ++ ++ return err; ++} ++ + static const snd_pcm_ioplug_callback_t pulse_playback_callback = { + .start = pulse_start, + .stop = pulse_stop, +@@ -750,6 +880,7 @@ static const snd_pcm_ioplug_callback_t pulse_playback_callback = { + .prepare = pulse_prepare, + .hw_params = pulse_hw_params, + .close = pulse_close, ++ .pause = pulse_pause + }; + + +diff --git a/pulse/pulse.c b/pulse/pulse.c +index 3940238..f26363a 100644 +--- a/pulse/pulse.c ++++ b/pulse/pulse.c +@@ -32,37 +32,18 @@ int pulse_check_connection(snd_pulse_t * p) + pa_context_state_t state; + + assert(p); +- assert(p->context); +- assert(p->mainloop); ++ ++ if (!p->context || !p->mainloop) ++ return -EBADFD; + + state = pa_context_get_state(p->context); + +- if (state != PA_CONTEXT_READY) ++ if (!PA_CONTEXT_IS_GOOD(state)) + return -EIO; + + return 0; + } + +-void pulse_stream_state_cb(pa_stream * s, void *userdata) +-{ +- snd_pulse_t *p = userdata; +- +- assert(s); +- assert(p); +- +- pa_threaded_mainloop_signal(p->mainloop, 0); +-} +- +-void pulse_stream_success_cb(pa_stream * s, int success, void *userdata) +-{ +- snd_pulse_t *p = userdata; +- +- assert(s); +- assert(p); +- +- pa_threaded_mainloop_signal(p->mainloop, 0); +-} +- + void pulse_context_success_cb(pa_context * c, int success, void *userdata) + { + snd_pulse_t *p = userdata; +@@ -77,8 +58,6 @@ int pulse_wait_operation(snd_pulse_t * p, pa_operation * o) + { + assert(p); + assert(o); +- assert(p->state == PULSE_STATE_READY); +- assert(p->mainloop); + + for (;;) { + int err; +@@ -96,44 +75,19 @@ int pulse_wait_operation(snd_pulse_t * p, pa_operation * o) + return 0; + } + +-int pulse_wait_stream_state(snd_pulse_t * p, pa_stream * stream, +- pa_stream_state_t target) +-{ +- pa_stream_state_t state; +- +- assert(p); +- assert(stream); +- assert(p->state == PULSE_STATE_READY); +- assert(p->mainloop); +- +- for (;;) { +- int err; +- +- err = pulse_check_connection(p); +- if (err < 0) +- return err; +- +- state = pa_stream_get_state(stream); +- +- if (state == target) +- break; +- +- if (state == PA_STREAM_FAILED || +- state == PA_STREAM_TERMINATED) +- return -EIO; +- +- pa_threaded_mainloop_wait(p->mainloop); +- } +- +- return 0; +-} +- + static void context_state_cb(pa_context * c, void *userdata) + { ++ pa_context_state_t state; + snd_pulse_t *p = userdata; + assert(c); + +- switch (pa_context_get_state(c)) { ++ state = pa_context_get_state(c); ++ ++ /* When we get disconnected, tell the process */ ++ if (!PA_CONTEXT_IS_GOOD(state)) ++ pulse_poll_activate(p); ++ ++ switch (state) { + case PA_CONTEXT_READY: + case PA_CONTEXT_TERMINATED: + case PA_CONTEXT_FAILED: +@@ -171,8 +125,6 @@ snd_pulse_t *pulse_new(void) + if (!p) + return NULL; + +- p->state = PULSE_STATE_INIT; +- + if (pipe(fd)) { + free(p); + return NULL; +@@ -197,7 +149,9 @@ snd_pulse_t *pulse_new(void) + + p->context = + pa_context_new(pa_threaded_mainloop_get_api(p->mainloop), buf); +- assert(p->context); ++ ++ if (!p->context) ++ goto fail; + + pa_context_set_state_callback(p->context, context_state_cb, p); + +@@ -207,36 +161,29 @@ snd_pulse_t *pulse_new(void) + return p; + + fail: ++ pulse_free(p); ++ ++ return NULL; ++} ++ ++void pulse_free(snd_pulse_t * p) ++{ + if (p->mainloop) + pa_threaded_mainloop_stop(p->mainloop); + +- if (p->context) ++ if (p->context) { ++ pa_context_disconnect(p->context); + pa_context_unref(p->context); ++ } + + if (p->mainloop) + pa_threaded_mainloop_free(p->mainloop); + +- if (p->main_fd >= 0) +- close(p->main_fd); +- + if (p->thread_fd >= 0) + close(p->thread_fd); + +- free(p); +- +- return NULL; +-} +- +-void pulse_free(snd_pulse_t * p) +-{ +- pa_threaded_mainloop_stop(p->mainloop); +- +- pa_context_disconnect(p->context); +- pa_context_unref(p->context); +- pa_threaded_mainloop_free(p->mainloop); +- +- close(p->thread_fd); +- close(p->main_fd); ++ if (p->main_fd >= 0) ++ close(p->main_fd); + + free(p); + } +@@ -244,11 +191,16 @@ void pulse_free(snd_pulse_t * p) + int pulse_connect(snd_pulse_t * p, const char *server) + { + int err; ++ pa_context_state_t state; + + assert(p); +- assert(p->context); +- assert(p->mainloop); +- assert(p->state == PULSE_STATE_INIT); ++ ++ if (!p->context || !p->mainloop) ++ return -EBADFD; ++ ++ state = pa_context_get_state(p->context); ++ if (state != PA_CONTEXT_UNCONNECTED) ++ return -EBADFD; + + pa_threaded_mainloop_lock(p->mainloop); + +@@ -256,14 +208,19 @@ int pulse_connect(snd_pulse_t * p, const char *server) + if (err < 0) + goto error; + +- pa_threaded_mainloop_wait(p->mainloop); ++ for (;;) { ++ pa_context_state_t state = pa_context_get_state(p->context); + +- if (pa_context_get_state(p->context) != PA_CONTEXT_READY) +- goto error; ++ if (!PA_CONTEXT_IS_GOOD(state)) ++ goto error; + +- pa_threaded_mainloop_unlock(p->mainloop); ++ if (state == PA_CONTEXT_READY) ++ break; + +- p->state = PULSE_STATE_READY; ++ pa_threaded_mainloop_wait(p->mainloop); ++ } ++ ++ pa_threaded_mainloop_unlock(p->mainloop); + + return 0; + +diff --git a/pulse/pulse.h b/pulse/pulse.h +index 7bf1a5b..e98124f 100644 +--- a/pulse/pulse.h ++++ b/pulse/pulse.h +@@ -31,23 +31,13 @@ typedef struct snd_pulse { + pa_context *context; + + int thread_fd, main_fd; +- +- enum { +- PULSE_STATE_INIT, +- PULSE_STATE_READY, +- } state; +- + } snd_pulse_t; + + int pulse_check_connection(snd_pulse_t * p); + +-void pulse_stream_state_cb(pa_stream * s, void *userdata); +-void pulse_stream_success_cb(pa_stream * s, int success, void *userdata); + void pulse_context_success_cb(pa_context * c, int success, void *userdata); + + int pulse_wait_operation(snd_pulse_t * p, pa_operation * o); +-int pulse_wait_stream_state(snd_pulse_t * p, pa_stream * stream, +- pa_stream_state_t target); + + snd_pulse_t *pulse_new(void); + void pulse_free(snd_pulse_t * p); --- alsa-plugins-1.0.20.orig/debian/patches/0003_pulse-updates.patch +++ alsa-plugins-1.0.20/debian/patches/0003_pulse-updates.patch @@ -0,0 +1,975 @@ +diff --git a/pulse/conf_pulse.c b/pulse/conf_pulse.c +index 3f9e071..35dd383 100644 +--- a/pulse/conf_pulse.c ++++ b/pulse/conf_pulse.c +@@ -61,15 +61,7 @@ conf_pulse_hook_load_if_running(snd_config_t * root, snd_config_t * config, + goto out; + + do { +- err = pa_mainloop_prepare(loop, -1); +- if (err < 0) +- goto out; +- +- err = pa_mainloop_poll(loop); +- if (err < 0) +- goto out; +- +- err = pa_mainloop_dispatch(loop); ++ err = pa_mainloop_iterate(loop, 1, NULL); + if (err < 0) + goto out; + +diff --git a/pulse/ctl_pulse.c b/pulse/ctl_pulse.c +index c6cf9e2..85863ed 100644 +--- a/pulse/ctl_pulse.c ++++ b/pulse/ctl_pulse.c +@@ -125,8 +125,9 @@ static void event_cb(pa_context * c, pa_subscription_event_type_t t, + pa_operation *o; + + assert(ctl); +- assert(ctl->p); +- assert(ctl->p->context); ++ ++ if (!ctl->p || !ctl->p->mainloop || !ctl->p->context) ++ return; + + o = pa_context_get_sink_info_by_name(ctl->p->context, ctl->sink, + sink_info_cb, ctl); +@@ -148,8 +149,13 @@ static int pulse_update_volume(snd_ctl_pulse_t * ctl) + pa_operation *o; + + assert(ctl); +- assert(ctl->p); +- assert(ctl->p->context); ++ ++ if (!ctl->p) ++ return -EBADFD; ++ ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ return err; + + o = pa_context_get_sink_info_by_name(ctl->p->context, ctl->sink, + sink_info_cb, ctl); +@@ -180,17 +186,27 @@ static int pulse_update_volume(snd_ctl_pulse_t * ctl) + static int pulse_elem_count(snd_ctl_ext_t * ext) + { + snd_ctl_pulse_t *ctl = ext->private_data; +- int count = 0; ++ int count = 0, err; + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; ++ + pa_threaded_mainloop_lock(ctl->p->mainloop); + ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) { ++ count = err; ++ goto finish; ++ } ++ + if (ctl->source) + count += 2; + if (ctl->sink) + count += 2; + ++finish: + pa_threaded_mainloop_unlock(ctl->p->mainloop); + + return count; +@@ -200,13 +216,21 @@ static int pulse_elem_list(snd_ctl_ext_t * ext, unsigned int offset, + snd_ctl_elem_id_t * id) + { + snd_ctl_pulse_t *ctl = ext->private_data; ++ int err; + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; ++ + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); + + pa_threaded_mainloop_lock(ctl->p->mainloop); + ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ goto finish; ++ + if (ctl->source) { + if (offset == 0) + snd_ctl_elem_id_set_name(id, SOURCE_VOL_NAME); +@@ -215,14 +239,19 @@ static int pulse_elem_list(snd_ctl_ext_t * ext, unsigned int offset, + } else + offset += 2; + ++ err = 0; ++ ++finish: + pa_threaded_mainloop_unlock(ctl->p->mainloop); + +- if (offset == 2) +- snd_ctl_elem_id_set_name(id, SINK_VOL_NAME); +- else if (offset == 3) +- snd_ctl_elem_id_set_name(id, SINK_MUTE_NAME); ++ if (err >= 0) { ++ if (offset == 2) ++ snd_ctl_elem_id_set_name(id, SINK_VOL_NAME); ++ else if (offset == 3) ++ snd_ctl_elem_id_set_name(id, SINK_MUTE_NAME); ++ } + +- return 0; ++ return err; + } + + static snd_ctl_ext_key_t pulse_find_elem(snd_ctl_ext_t * ext, +@@ -260,7 +289,9 @@ static int pulse_get_attribute(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key, + return -EINVAL; + + assert(ctl); +- assert(ctl->p); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + +@@ -311,7 +342,9 @@ static int pulse_read_integer(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key, + pa_cvolume *vol = NULL; + + assert(ctl); +- assert(ctl->p); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + +@@ -361,7 +394,9 @@ static int pulse_write_integer(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key, + pa_cvolume *vol = NULL; + + assert(ctl); +- assert(ctl->p && ctl->p->context); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + +@@ -465,6 +500,9 @@ static void pulse_subscribe_events(snd_ctl_ext_t * ext, int subscribe) + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return; ++ + pa_threaded_mainloop_lock(ctl->p->mainloop); + + ctl->subscribed = !!(subscribe & SND_CTL_EVENT_MASK_VALUE); +@@ -477,14 +515,23 @@ static int pulse_read_event(snd_ctl_ext_t * ext, snd_ctl_elem_id_t * id, + { + snd_ctl_pulse_t *ctl = ext->private_data; + int offset; +- int err = -EAGAIN; ++ int err; + + assert(ctl); + ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; ++ + pa_threaded_mainloop_lock(ctl->p->mainloop); + +- if (!ctl->updated || !ctl->subscribed) ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ goto finish; ++ ++ if (!ctl->updated || !ctl->subscribed) { ++ err = -EAGAIN; + goto finish; ++ } + + if (ctl->source) + offset = 2; +@@ -523,18 +570,28 @@ static int pulse_ctl_poll_revents(snd_ctl_ext_t * ext, struct pollfd *pfd, + unsigned short *revents) + { + snd_ctl_pulse_t *ctl = ext->private_data; +- int err = 0; ++ int err; + + assert(ctl); +- assert(ctl->p); ++ ++ if (!ctl->p || !ctl->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(ctl->p->mainloop); + ++ err = pulse_check_connection(ctl->p); ++ if (err < 0) ++ goto finish; ++ + if (ctl->updated) + *revents = POLLIN; + else + *revents = 0; + ++ err = 0; ++ ++finish: ++ + pa_threaded_mainloop_unlock(ctl->p->mainloop); + + return err; +@@ -549,11 +606,8 @@ static void pulse_close(snd_ctl_ext_t * ext) + if (ctl->p) + pulse_free(ctl->p); + +- if (ctl->source) +- free(ctl->source); +- if (ctl->sink) +- free(ctl->sink); +- ++ free(ctl->source); ++ free(ctl->sink); + free(ctl); + } + +diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c +index db8d1e1..02a837e 100644 +--- a/pulse/pcm_pulse.c ++++ b/pulse/pcm_pulse.c +@@ -49,6 +49,32 @@ typedef struct snd_pcm_pulse { + pa_buffer_attr buffer_attr; + } snd_pcm_pulse_t; + ++static int check_stream(snd_pcm_pulse_t *pcm) ++{ ++ int err; ++ pa_stream_state_t state; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return -EBADFD; ++ ++ err = pulse_check_connection(pcm->p); ++ if (err < 0) ++ return err; ++ ++ if (!pcm->stream) ++ return -EBADFD; ++ ++ state = pa_stream_get_state(pcm->stream); ++ if (!PA_STREAM_IS_GOOD(state)) ++ return -EIO; ++ ++ err = 0; ++ ++ return err; ++} ++ + static int update_ptr(snd_pcm_pulse_t *pcm) + { + size_t size; +@@ -106,18 +132,69 @@ static int update_active(snd_pcm_pulse_t *pcm) { + + assert(pcm); + +- ret = check_active(pcm); ++ if (!pcm->p) ++ return -EBADFD; ++ ++ ret = check_stream(pcm); + if (ret < 0) +- return ret; ++ goto finish; ++ ++ ret = check_active(pcm); ++ ++finish: + +- if (ret > 0) ++ if (ret != 0) /* On error signal the caller, too */ + pulse_poll_activate(pcm->p); + else + pulse_poll_deactivate(pcm->p); + ++ return ret; ++} ++ ++static int wait_stream_state(snd_pcm_pulse_t *pcm, pa_stream_state_t target) ++{ ++ pa_stream_state_t state; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return -EBADFD; ++ ++ for (;;) { ++ int err; ++ ++ err = pulse_check_connection(pcm->p); ++ if (err < 0) ++ return err; ++ ++ if (!pcm->stream) ++ return -EBADFD; ++ ++ state = pa_stream_get_state(pcm->stream); ++ if (state == target) ++ break; ++ ++ if (!PA_STREAM_IS_GOOD(state)) ++ return -EIO; ++ ++ pa_threaded_mainloop_wait(pcm->p->mainloop); ++ } ++ + return 0; + } + ++static void stream_success_cb(pa_stream * p, int success, void *userdata) ++{ ++ snd_pcm_pulse_t *pcm = userdata; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return; ++ ++ pa_threaded_mainloop_signal(pcm->p->mainloop, 0); ++} ++ + static int pulse_start(snd_pcm_ioplug_t * io) + { + snd_pcm_pulse_t *pcm = io->private_data; +@@ -125,26 +202,23 @@ static int pulse_start(snd_pcm_ioplug_t * io) + int err = 0, err_o = 0, err_u = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +- if (pcm->stream == NULL) +- goto finish; +- +- o = pa_stream_cork(pcm->stream, 0, pulse_stream_success_cb, +- pcm->p); ++ o = pa_stream_cork(pcm->stream, 0, stream_success_cb, pcm); + if (!o) { + err = -EIO; + goto finish; + } + +- u = pa_stream_trigger(pcm->stream, pulse_stream_success_cb, +- pcm->p); ++ u = pa_stream_trigger(pcm->stream, stream_success_cb, pcm); + + pcm->underrun = 0; + err_o = pulse_wait_operation(pcm->p, o); +@@ -160,7 +234,6 @@ static int pulse_start(snd_pcm_ioplug_t * io) + goto finish; + } + +- + finish: + pa_threaded_mainloop_unlock(pcm->p->mainloop); + +@@ -174,26 +247,23 @@ static int pulse_stop(snd_pcm_ioplug_t * io) + int err = 0, err_o = 0, err_u = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +- if (pcm->stream == NULL) +- goto finish; +- +- o = pa_stream_cork(pcm->stream, 1, pulse_stream_success_cb, +- pcm->p); ++ o = pa_stream_cork(pcm->stream, 1, stream_success_cb, pcm); + if (!o) { + err = -EIO; + goto finish; + } + +- u = pa_stream_flush(pcm->stream, pulse_stream_success_cb, +- pcm->p); ++ u = pa_stream_flush(pcm->stream, stream_success_cb, pcm); + if (!u) { + pa_operation_unref(o); + err = -EIO; +@@ -224,15 +294,17 @@ static int pulse_drain(snd_pcm_ioplug_t * io) + int err = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +- o = pa_stream_drain(pcm->stream, pulse_stream_success_cb, pcm->p); ++ o = pa_stream_drain(pcm->stream, stream_success_cb, pcm); + if (!o) { + err = -EIO; + goto finish; +@@ -259,7 +331,9 @@ static snd_pcm_sframes_t pulse_pointer(snd_pcm_ioplug_t * io) + snd_pcm_sframes_t ret = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + if (io->state == SND_PCM_STATE_XRUN) + return -EPIPE; +@@ -269,9 +343,7 @@ static snd_pcm_sframes_t pulse_pointer(snd_pcm_ioplug_t * io) + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- assert(pcm->stream); +- +- ret = pulse_check_connection(pcm->p); ++ ret = check_stream(pcm); + if (ret < 0) + goto finish; + +@@ -305,14 +377,14 @@ static int pulse_delay(snd_pcm_ioplug_t * io, snd_pcm_sframes_t * delayp) + pa_usec_t lat = 0; + + assert(pcm); +- assert(pcm->p); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + +- assert(pcm->stream); ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + + for (;;) { +- err = pulse_check_connection(pcm->p); ++ err = check_stream(pcm); + if (err < 0) + goto finish; + +@@ -354,13 +426,13 @@ static snd_pcm_sframes_t pulse_write(snd_pcm_ioplug_t * io, + snd_pcm_sframes_t ret = 0; + + assert(pcm); +- assert(pcm->p); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + +- assert(pcm->stream); ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + +- ret = pulse_check_connection(pcm->p); ++ ret = check_stream(pcm); + if (ret < 0) + goto finish; + +@@ -409,13 +481,13 @@ static snd_pcm_sframes_t pulse_read(snd_pcm_ioplug_t * io, + snd_pcm_sframes_t ret = 0; + + assert(pcm); +- assert(pcm->p); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + +- assert(pcm->stream); ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + +- ret = pulse_check_connection(pcm->p); ++ ret = check_stream(pcm); + if (ret < 0) + goto finish; + +@@ -475,12 +547,31 @@ finish: + return ret; + } + ++static void stream_state_cb(pa_stream * p, void *userdata) ++{ ++ snd_pcm_pulse_t *pcm = userdata; ++ pa_stream_state_t state; ++ ++ assert(pcm); ++ ++ if (!pcm->p) ++ return; ++ ++ state = pa_stream_get_state(p); ++ if (!PA_STREAM_IS_GOOD(state)) ++ pulse_poll_activate(pcm->p); ++ ++ pa_threaded_mainloop_signal(pcm->p->mainloop, 0); ++} ++ + static void stream_request_cb(pa_stream * p, size_t length, void *userdata) + { + snd_pcm_pulse_t *pcm = userdata; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p) ++ return; + + update_active(pcm); + } +@@ -490,7 +581,9 @@ static void stream_underrun_cb(pa_stream * p, void *userdata) + snd_pcm_pulse_t *pcm = userdata; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p) ++ return; + + pcm->underrun = 1; + } +@@ -499,7 +592,9 @@ static void stream_latency_cb(pa_stream *p, void *userdata) { + snd_pcm_pulse_t *pcm = userdata; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p) ++ return; + + pa_threaded_mainloop_signal(pcm->p->mainloop, 0); + } +@@ -512,12 +607,17 @@ static int pulse_pcm_poll_revents(snd_pcm_ioplug_t * io, + snd_pcm_pulse_t *pcm = io->private_data; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +- err = check_active(pcm); ++ err = check_stream(pcm); ++ if (err < 0) ++ goto finish; + ++ err = check_active(pcm); + if (err < 0) + goto finish; + +@@ -541,14 +641,15 @@ static int pulse_prepare(snd_pcm_ioplug_t * io) + unsigned c, d; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + + if (pcm->stream) { + pa_stream_disconnect(pcm->stream); +- pulse_wait_stream_state(pcm->p, pcm->stream, +- PA_STREAM_TERMINATED); ++ wait_stream_state(pcm, PA_STREAM_TERMINATED); + pa_stream_unref(pcm->stream); + pcm->stream = NULL; + } +@@ -581,9 +682,7 @@ static int pulse_prepare(snd_pcm_ioplug_t * io) + goto finish; + } + +- pa_stream_set_state_callback(pcm->stream, pulse_stream_state_cb, +- pcm->p); +- ++ pa_stream_set_state_callback(pcm->stream, stream_state_cb, pcm); + pa_stream_set_latency_update_callback(pcm->stream, stream_latency_cb, pcm); + + if (io->stream == SND_PCM_STREAM_PLAYBACK) { +@@ -620,8 +719,7 @@ static int pulse_prepare(snd_pcm_ioplug_t * io) + goto finish; + } + +- err = +- pulse_wait_stream_state(pcm->p, pcm->stream, PA_STREAM_READY); ++ err = wait_stream_state(pcm, PA_STREAM_READY); + if (err < 0) { + SNDERR("PulseAudio: Unable to create stream: %s\n", pa_strerror(pa_context_errno(pcm->p->context))); + pa_stream_unref(pcm->stream); +@@ -645,7 +743,9 @@ static int pulse_hw_params(snd_pcm_ioplug_t * io, + int err = 0; + + assert(pcm); +- assert(pcm->p); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; + + pa_threaded_mainloop_lock(pcm->p->mainloop); + +@@ -719,26 +819,56 @@ static int pulse_close(snd_pcm_ioplug_t * io) + + assert(pcm); + +- pa_threaded_mainloop_lock(pcm->p->mainloop); ++ if (pcm->p && pcm->p->mainloop) { + +- if (pcm->stream) { +- pa_stream_disconnect(pcm->stream); +- pa_stream_unref(pcm->stream); +- } ++ pa_threaded_mainloop_lock(pcm->p->mainloop); + +- pa_threaded_mainloop_unlock(pcm->p->mainloop); ++ if (pcm->stream) { ++ pa_stream_disconnect(pcm->stream); ++ pa_stream_unref(pcm->stream); ++ } ++ ++ pa_threaded_mainloop_unlock(pcm->p->mainloop); ++ } + + if (pcm->p) + pulse_free(pcm->p); + +- if (pcm->device) +- free(pcm->device); +- ++ free(pcm->device); + free(pcm); + + return 0; + } + ++static int pulse_pause(snd_pcm_ioplug_t * io, int enable) ++{ ++ snd_pcm_pulse_t *pcm = io->private_data; ++ int err = 0; ++ pa_operation *o; ++ ++ assert (pcm); ++ ++ if (!pcm->p || !pcm->p->mainloop) ++ return -EBADFD; ++ ++ pa_threaded_mainloop_lock(pcm->p->mainloop); ++ ++ err = check_stream(pcm); ++ if (err < 0) ++ goto finish; ++ ++ o = pa_stream_cork(pcm->stream, enable, NULL, NULL); ++ if (o) ++ pa_operation_unref(o); ++ else ++ err = -EIO; ++ ++finish: ++ pa_threaded_mainloop_unlock(pcm->p->mainloop); ++ ++ return err; ++} ++ + static const snd_pcm_ioplug_callback_t pulse_playback_callback = { + .start = pulse_start, + .stop = pulse_stop, +@@ -750,6 +880,7 @@ static const snd_pcm_ioplug_callback_t pulse_playback_callback = { + .prepare = pulse_prepare, + .hw_params = pulse_hw_params, + .close = pulse_close, ++ .pause = pulse_pause + }; + + +diff --git a/pulse/pulse.c b/pulse/pulse.c +index 3940238..f26363a 100644 +--- a/pulse/pulse.c ++++ b/pulse/pulse.c +@@ -32,37 +32,18 @@ int pulse_check_connection(snd_pulse_t * p) + pa_context_state_t state; + + assert(p); +- assert(p->context); +- assert(p->mainloop); ++ ++ if (!p->context || !p->mainloop) ++ return -EBADFD; + + state = pa_context_get_state(p->context); + +- if (state != PA_CONTEXT_READY) ++ if (!PA_CONTEXT_IS_GOOD(state)) + return -EIO; + + return 0; + } + +-void pulse_stream_state_cb(pa_stream * s, void *userdata) +-{ +- snd_pulse_t *p = userdata; +- +- assert(s); +- assert(p); +- +- pa_threaded_mainloop_signal(p->mainloop, 0); +-} +- +-void pulse_stream_success_cb(pa_stream * s, int success, void *userdata) +-{ +- snd_pulse_t *p = userdata; +- +- assert(s); +- assert(p); +- +- pa_threaded_mainloop_signal(p->mainloop, 0); +-} +- + void pulse_context_success_cb(pa_context * c, int success, void *userdata) + { + snd_pulse_t *p = userdata; +@@ -77,8 +58,6 @@ int pulse_wait_operation(snd_pulse_t * p, pa_operation * o) + { + assert(p); + assert(o); +- assert(p->state == PULSE_STATE_READY); +- assert(p->mainloop); + + for (;;) { + int err; +@@ -96,44 +75,19 @@ int pulse_wait_operation(snd_pulse_t * p, pa_operation * o) + return 0; + } + +-int pulse_wait_stream_state(snd_pulse_t * p, pa_stream * stream, +- pa_stream_state_t target) +-{ +- pa_stream_state_t state; +- +- assert(p); +- assert(stream); +- assert(p->state == PULSE_STATE_READY); +- assert(p->mainloop); +- +- for (;;) { +- int err; +- +- err = pulse_check_connection(p); +- if (err < 0) +- return err; +- +- state = pa_stream_get_state(stream); +- +- if (state == target) +- break; +- +- if (state == PA_STREAM_FAILED || +- state == PA_STREAM_TERMINATED) +- return -EIO; +- +- pa_threaded_mainloop_wait(p->mainloop); +- } +- +- return 0; +-} +- + static void context_state_cb(pa_context * c, void *userdata) + { ++ pa_context_state_t state; + snd_pulse_t *p = userdata; + assert(c); + +- switch (pa_context_get_state(c)) { ++ state = pa_context_get_state(c); ++ ++ /* When we get disconnected, tell the process */ ++ if (!PA_CONTEXT_IS_GOOD(state)) ++ pulse_poll_activate(p); ++ ++ switch (state) { + case PA_CONTEXT_READY: + case PA_CONTEXT_TERMINATED: + case PA_CONTEXT_FAILED: +@@ -171,8 +125,6 @@ snd_pulse_t *pulse_new(void) + if (!p) + return NULL; + +- p->state = PULSE_STATE_INIT; +- + if (pipe(fd)) { + free(p); + return NULL; +@@ -197,7 +149,9 @@ snd_pulse_t *pulse_new(void) + + p->context = + pa_context_new(pa_threaded_mainloop_get_api(p->mainloop), buf); +- assert(p->context); ++ ++ if (!p->context) ++ goto fail; + + pa_context_set_state_callback(p->context, context_state_cb, p); + +@@ -207,36 +161,29 @@ snd_pulse_t *pulse_new(void) + return p; + + fail: ++ pulse_free(p); ++ ++ return NULL; ++} ++ ++void pulse_free(snd_pulse_t * p) ++{ + if (p->mainloop) + pa_threaded_mainloop_stop(p->mainloop); + +- if (p->context) ++ if (p->context) { ++ pa_context_disconnect(p->context); + pa_context_unref(p->context); ++ } + + if (p->mainloop) + pa_threaded_mainloop_free(p->mainloop); + +- if (p->main_fd >= 0) +- close(p->main_fd); +- + if (p->thread_fd >= 0) + close(p->thread_fd); + +- free(p); +- +- return NULL; +-} +- +-void pulse_free(snd_pulse_t * p) +-{ +- pa_threaded_mainloop_stop(p->mainloop); +- +- pa_context_disconnect(p->context); +- pa_context_unref(p->context); +- pa_threaded_mainloop_free(p->mainloop); +- +- close(p->thread_fd); +- close(p->main_fd); ++ if (p->main_fd >= 0) ++ close(p->main_fd); + + free(p); + } +@@ -244,11 +191,16 @@ void pulse_free(snd_pulse_t * p) + int pulse_connect(snd_pulse_t * p, const char *server) + { + int err; ++ pa_context_state_t state; + + assert(p); +- assert(p->context); +- assert(p->mainloop); +- assert(p->state == PULSE_STATE_INIT); ++ ++ if (!p->context || !p->mainloop) ++ return -EBADFD; ++ ++ state = pa_context_get_state(p->context); ++ if (state != PA_CONTEXT_UNCONNECTED) ++ return -EBADFD; + + pa_threaded_mainloop_lock(p->mainloop); + +@@ -256,14 +208,19 @@ int pulse_connect(snd_pulse_t * p, const char *server) + if (err < 0) + goto error; + +- pa_threaded_mainloop_wait(p->mainloop); ++ for (;;) { ++ pa_context_state_t state = pa_context_get_state(p->context); + +- if (pa_context_get_state(p->context) != PA_CONTEXT_READY) +- goto error; ++ if (!PA_CONTEXT_IS_GOOD(state)) ++ goto error; + +- pa_threaded_mainloop_unlock(p->mainloop); ++ if (state == PA_CONTEXT_READY) ++ break; + +- p->state = PULSE_STATE_READY; ++ pa_threaded_mainloop_wait(p->mainloop); ++ } ++ ++ pa_threaded_mainloop_unlock(p->mainloop); + + return 0; + +diff --git a/pulse/pulse.h b/pulse/pulse.h +index 7bf1a5b..e98124f 100644 +--- a/pulse/pulse.h ++++ b/pulse/pulse.h +@@ -31,23 +31,13 @@ typedef struct snd_pulse { + pa_context *context; + + int thread_fd, main_fd; +- +- enum { +- PULSE_STATE_INIT, +- PULSE_STATE_READY, +- } state; +- + } snd_pulse_t; + + int pulse_check_connection(snd_pulse_t * p); + +-void pulse_stream_state_cb(pa_stream * s, void *userdata); +-void pulse_stream_success_cb(pa_stream * s, int success, void *userdata); + void pulse_context_success_cb(pa_context * c, int success, void *userdata); + + int pulse_wait_operation(snd_pulse_t * p, pa_operation * o); +-int pulse_wait_stream_state(snd_pulse_t * p, pa_stream * stream, +- pa_stream_state_t target); + + snd_pulse_t *pulse_new(void); + void pulse_free(snd_pulse_t * p); --- alsa-plugins-1.0.20.orig/debian/patches/0001_validate_optimise_lookup.patch +++ alsa-plugins-1.0.20/debian/patches/0001_validate_optimise_lookup.patch @@ -0,0 +1,27 @@ +Index: alsa-plugins-1.0.18/oss/ctl_oss.c +=================================================================== +--- alsa-plugins-1.0.18.orig/oss/ctl_oss.c 2009-02-17 16:23:45.000000000 -0500 ++++ alsa-plugins-1.0.18/oss/ctl_oss.c 2009-02-17 16:24:07.000000000 -0500 +@@ -151,7 +151,21 @@ + { + snd_ctl_oss_t *oss = ext->private_data; + const char *name; +- unsigned int i, key; ++ unsigned int i, key, numid; ++ ++ numid = snd_ctl_elem_id_get_numid(id); ++ if (numid > 0) { ++ numid--; ++ if (numid < oss->num_vol_ctls) ++ return oss->vol_ctl[numid]; ++ numid -= oss->num_vol_ctls; ++ if (oss->exclusive_input) { ++ if (!numid) ++ return OSS_KEY_CAPTURE_MUX; ++ } else if (numid < oss->num_rec_items) ++ return oss->rec_item[numid] | ++ OSS_KEY_CAPTURE_FLAG; ++ } + + name = snd_ctl_elem_id_get_name(id); + if (! strcmp(name, "Capture Source")) { --- alsa-plugins-1.0.20.orig/debian/examples/asound.conf_jack +++ alsa-plugins-1.0.20/debian/examples/asound.conf_jack @@ -0,0 +1,9 @@ +pcm.myjack { + type jack + playback_ports { + 0 alsa_pcm:playback_1 + 1 alsa_pcm:playback_1 + } +} + +# Usage: aplay -Dplug:myjack foo.wav --- alsa-plugins-1.0.20.orig/debian/examples/asound.conf_oss +++ alsa-plugins-1.0.20/debian/examples/asound.conf_oss @@ -0,0 +1,6 @@ +pcm.myoss { + type oss + device /dev/dsp +} + +# Usage: aplay -Dplug:myoss foo.wav --- alsa-plugins-1.0.20.orig/debian/examples/a52.conf_pulse +++ alsa-plugins-1.0.20/debian/examples/a52.conf_pulse @@ -0,0 +1,20 @@ +# Description: This will make it possible to use a52 with PulseAudio out of +# the box. It may be useful for other use cases. Just include +# this in your ~/.asoundrc . + +pcm.a52 { + @args [ CARD ] + @args.CARD { + type string + default 0 + } + type plug + slave { + pcm { + type a52 + card $CARD + } + } +} + +# Usage: aplay -D a52:0 /foo.wav