2012-04-27 Brian Cameron <[email protected]>
authoryippi
Fri, 27 Apr 2012 13:46:26 +0000
changeset 22403 2cf841d20669
parent 22401 8ef9e63c3ada
child 22404 61545984e9f1
2012-04-27 Brian Cameron <[email protected]> * specs/SUNWpulseaudio.spec, base-specs/pulseaudio.spec: No longer need to build with private libtool. * ext-sources/libtool-2.2.6b.tar.gz: Remove. * patches/pulseaudio-03-libtool.diff: Remove, renumber rest. * base-specs/libgc.spec, patches/libgc-03-sparc-atomic.diff: Add patch needed to compile on Sparc. * copyright/SUNWpython-simplejson.copyright: Update.
ChangeLog
base-specs/libgc.spec
base-specs/pulseaudio.spec
copyright/SUNWpython-simplejson.copyright
ext-sources/libtool-2.2.6b.tar.gz
patches/libgc-03-sparc-atomic.diff
patches/pulseaudio-03-fixlink.diff
patches/pulseaudio-03-libtool.diff
patches/pulseaudio-04-fixlink.diff
patches/pulseaudio-04-gconf.diff
patches/pulseaudio-05-amd64.diff
patches/pulseaudio-05-shm.diff
patches/pulseaudio-06-configure.diff
patches/pulseaudio-06-gconf.diff
patches/pulseaudio-07-sada.diff
patches/pulseaudio-07-shm.diff
patches/pulseaudio-08-configure.diff
patches/pulseaudio-08-oss4.diff
patches/pulseaudio-09-amd64.diff
patches/pulseaudio-09-sada.diff
patches/pulseaudio-10-oss4.diff
specs/SUNWpulseaudio.spec
--- a/ChangeLog	Tue Apr 24 06:46:40 2012 +0000
+++ b/ChangeLog	Fri Apr 27 13:46:26 2012 +0000
@@ -1,3 +1,13 @@
+2012-04-27  Brian Cameron  <[email protected]>
+
+	* specs/SUNWpulseaudio.spec, base-specs/pulseaudio.spec: No longer need
+	  to build with private libtool.
+	* ext-sources/libtool-2.2.6b.tar.gz: Remove.
+	* patches/pulseaudio-03-libtool.diff: Remove, renumber rest.
+	* base-specs/libgc.spec, patches/libgc-03-sparc-atomic.diff:  Add
+	  patch needed to compile on Sparc.
+	* copyright/SUNWpython-simplejson.copyright: Update.
+
 2012-04-18  Ghee Teo  <[email protected]>
 
 	Put back those changes  related to CR#7144691
--- a/base-specs/libgc.spec	Tue Apr 24 06:46:40 2012 +0000
+++ b/base-specs/libgc.spec	Fri Apr 27 13:46:26 2012 +0000
@@ -26,6 +26,8 @@
 Patch1:                 libgc-01-man.diff
 #date:2009-02-16 owner:jouby type:branding
 Patch2:                 libgc-02-rename-libbgc.diff
+#date:2012-04-18 owner:yippi type:bug
+Patch3:                 libgc-03-sparc-atomic.diff
 BuildRoot:		%{_tmppath}/%{name}-%{version}-build
 Docdir:			%{_defaultdocdir}/doc
 Autoreqprov:		on
@@ -49,6 +51,7 @@
 %setup -q -n %{real_name}-%{version}alpha6
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %ifos linux
@@ -115,7 +118,7 @@
 %{_libdir}/pkgconfig/bdw-gc.pc
 
 %changelog
-* Fri Sep 09 2011 - [email protected]
+* Thu Feb 09 2012 - [email protected]
 - Bump to 7.2 alpha6 and build libatomic-ops.
 * Fri Apr 30 2010 - [email protected]
 - Change the ownership to jouby
--- a/base-specs/pulseaudio.spec	Tue Apr 24 06:46:40 2012 +0000
+++ b/base-specs/pulseaudio.spec	Fri Apr 27 13:46:26 2012 +0000
@@ -17,85 +17,56 @@
 Version:                 1.1
 License:                 LGPLv2.1, MIT, Sun Public Domain
 Source:                  %{src_url}/%{src_name}-%{version}.tar.gz
-Source1:                 libtool-2.2.6b.tar.gz
 # date:2011-09-27 owner:yippi type:bug bugid:41537
 Patch1:                  pulseaudio-01-esdcompat.diff
 # This patch is very rough, but gets the code to compile.
 # date:2011-09-27 owner:yippi type:bug bugid:41538
 Patch2:                  pulseaudio-02-solaris.diff
-# date:2011-09-27 owner:yippi type:feature
-Patch3:                  pulseaudio-03-libtool.diff
 # date:2011-10-05 owner:yippi type:feature bugid:41539
-Patch4:                  pulseaudio-04-fixlink.diff
-# date:2011-10-06 owner:yippi type:feature
-Patch5:                  pulseaudio-05-amd64.diff
+Patch3:                  pulseaudio-03-fixlink.diff
 # /usr/include/sys/stream.h also defines module_info.
 # date:2011-10-14 owner:yippi type:bug bugid:41823
-Patch6:                  pulseaudio-06-gconf.diff
+Patch4:                  pulseaudio-04-gconf.diff
 # date:2011-10-14 owner:yippi type:bug
-Patch7:                  pulseaudio-07-shm.diff
+Patch5:                  pulseaudio-05-shm.diff
 # date:2011-10-31 owner:yippi type:branding
 # This patch configures PulseAudio for Solaris, by enabling the OSSv4 module
 # for example, instead of using the SunAudio (solaris) module.
-Patch8:                  pulseaudio-08-configure.diff
+Patch6:                  pulseaudio-06-configure.diff
 # date:2011-11-30 owner:yippi type:bug
-Patch9:                  pulseaudio-09-sada.diff
+Patch7:                  pulseaudio-07-sada.diff
 # date:2011-12-13 owner:yippi type:bug
-Patch10:                 pulseaudio-10-oss4.diff
+Patch8:                  pulseaudio-08-oss4.diff
+# date:2011-10-06 owner:yippi type:feature
+Patch9:                  pulseaudio-09-amd64.diff
 BuildRoot:               %{_tmppath}/%{name}-%{version}-build
 
 %prep
 %setup -q -n pulseaudio-%version
 %patch1 -p1
 %patch2 -p1
-perl -pi -e 's,/bin/sh,/bin/ksh,' src/daemon/esdcompat.in
-
-# Build libtool, with patch.
-gzcat %SOURCE1 | tar xf -
-%patch3 -p0
-
+%patch3 -p1
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
-%patch10 -p1
+
+perl -pi -e 's,/bin/sh,/bin/ksh,' src/daemon/esdcompat.in
 
 %build
-# There seems to be an issue with the version of libtool that GStreamer is
-# now using.  The libtool script uses the echo and RM variables but does not
-# define them, so setting them here addresses this.
-export echo="/usr/bin/echo"
-export RM="/usr/bin/rm -f"
-
 CPUS=`/usr/sbin/psrinfo | grep on-line | wc -l | tr -d ' '`
 if test "x$CPUS" = "x" -o $CPUS = 0; then
      CPUS=1
 fi
 
-# Build newer libtool that PulseAudio needs.  This should be removed when
-# libtool is updated.
-#
-export CFLAGS="%{optflags}"
-export LDFLAGS="%{_ldflags}"
-cd libtool-2.2.6b
-./configure \
-    --prefix=%{_prefix} \
-    --infodir=%{_infodir}
-
-make -j$CPUS
-
-rm libltdl/.libs/*.a
-rm libltdl/.libs/*.la
-cd ..
-
-# Now build PulseAudio
+# Build PulseAudio
 # Need to specify /usr/include/gc as an include directory since the atomic_ops
 # headers are delivered there on Solaris.
 #
-export CPPFLAGS="$SOLARIS_PULSE_CPPFLAGS"
-export CFLAGS="$SOLARIS_PULSE_CFLAGS -I/usr/include/gc"
+export CPPFLAGS="-xc99"
+export CFLAGS="%optflags -xc99 -I/usr/include/gc"
 export LDFLAGS="$SOLARIS_PULSE_LDFLAGS"
 
 autoreconf --force --install
@@ -119,12 +90,6 @@
 make -j$CPUS
 
 %install
-# There seems to be an issue with the version of libtool that GStreamer is
-# now using.  The libtool script uses the echo and RM variables but does not
-# define them, so setting them here addresses this.
-export echo="/usr/bin/echo"
-export RM="/usr/bin/rm -f"
-
 make install DESTDIR=$RPM_BUILD_ROOT
 
 find $RPM_BUILD_ROOT%{_libdir}/ -name "*.a" -exec rm {} \; -print -o -name  "*.la" -exec rm {} \; -print
--- a/copyright/SUNWpython-simplejson.copyright	Tue Apr 24 06:46:40 2012 +0000
+++ b/copyright/SUNWpython-simplejson.copyright	Fri Apr 27 13:46:26 2012 +0000
@@ -1,11 +1,13 @@
-Licensing and copyright information for %{name}:
+Name:    %{simplejson.name}
+Version: %{simplejson.version}
+
+Oracle Internal Tracking Number: 5929
+
+Copyright (c) 2006 Bob Ippolito 
 
- License: MIT License
- 
- You can find more information in the following directory:
- %{_pkg_docdir}
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 
 
-  LICENSE.txt.bz2: MIT license
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 
 
- The sources of simplejson-%{simplejson.version} were downloaded
- from %{simplejson.SOURCE0.url}
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+
Binary file ext-sources/libtool-2.2.6b.tar.gz has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/libgc-03-sparc-atomic.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,11 @@
+--- gc-7.2alpha6/Makefile.am-orig	2012-04-19 06:48:35.878236659 -0500
++++ gc-7.2alpha6/Makefile.am	2012-04-19 06:48:51.710010636 -0500
+@@ -84,7 +84,7 @@ nodist_libbgc_la_SOURCES = libatomic_ops
+ endif
+ 
+ if NEED_ATOMIC_OPS_ASM
+-nodist_libbgc_la_SOURCES = libatomic_ops/src/atomic_ops_sysdeps.S
++nodist_libbgc_la_SOURCES = libatomic_ops/src/atomic_ops.c libatomic_ops/src/atomic_ops_sysdeps.S
+ endif
+ 
+ # Include THREADDLLIBS here to ensure that the correct versions of
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-03-fixlink.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,42 @@
+--- pulseaudio-1.0/src/pulsecore/core-scache.h-orig	2011-10-19 09:56:30.443291065 -0500
++++ pulseaudio-1.0/src/pulsecore/core-scache.h	2011-10-19 09:57:15.863329411 -0500
+@@ -27,8 +27,6 @@
+ #include <pulsecore/memchunk.h>
+ #include <pulsecore/sink.h>
+ 
+-#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16)
+-
+ typedef struct pa_scache_entry {
+     uint32_t index;
+     pa_core *core;
+--- pulseaudio-1.0/src/pulsecore/memchunk.h-orig	2011-10-19 09:56:45.049056686 -0500
++++ pulseaudio-1.0/src/pulsecore/memchunk.h	2011-10-19 09:56:59.243495913 -0500
+@@ -53,4 +53,6 @@ pa_memchunk* pa_memchunk_memcpy(pa_memch
+ /* Return TRUE if any field is set != 0 */
+ pa_bool_t pa_memchunk_isset(pa_memchunk *c);
+ 
++#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16)
++
+ #endif
+--- pulseaudio-1.0/src/pulsecore/pstream.c-orig	2011-10-19 09:56:00.968603148 -0500
++++ pulseaudio-1.0/src/pulsecore/pstream.c	2011-10-19 09:57:49.036969685 -0500
+@@ -37,7 +37,7 @@
+ #include <pulsecore/socket.h>
+ #include <pulsecore/queue.h>
+ #include <pulsecore/log.h>
+-#include <pulsecore/core-scache.h>
++#include <pulsecore/memchunk.h>
+ #include <pulsecore/creds.h>
+ #include <pulsecore/refcnt.h>
+ #include <pulsecore/flist.h>
+--- pulseaudio-1.0/src/Makefile.am-orig	2011-10-19 10:26:08.909354110 -0500
++++ pulseaudio-1.0/src/Makefile.am	2011-10-19 10:26:21.545547580 -0500
+@@ -510,7 +510,7 @@ usergroup_test_CFLAGS = $(AM_CFLAGS)
+ usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+ 
+ connect_stress_SOURCES = tests/connect-stress.c
+-connect_stress_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@[email protected]
++connect_stress_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@[email protected] libpulsecore-@[email protected]
+ connect_stress_CFLAGS = $(AM_CFLAGS)
+ connect_stress_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+ 
--- a/patches/pulseaudio-03-libtool.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- libtool-2.2.6b/libltdl/ltdl.h-orig	2011-09-27 17:30:52.685894801 -0500
-+++ libtool-2.2.6b/libltdl/ltdl.h	2011-09-27 17:45:22.205222161 -0500
-@@ -101,7 +101,7 @@ LT_SCOPE int	lt_dlpreload_default (const
- LT_SCOPE int	lt_dlpreload_open    (const char *originator,
- 				      lt_dlpreload_callback_func *func);
- 
--#define lt_preloaded_symbols	lt__PROGRAM__LTX_preloaded_symbols
-+#define lt_preloaded_symbols	lt_libltdl_LTX_preloaded_symbols
- #define LTDL_SET_PRELOADED_SYMBOLS() 			LT_STMT_START{	\
- 	extern const lt_dlsymlist lt_preloaded_symbols[];		\
- 	lt_dlpreload_default(lt_preloaded_symbols);			\
--- a/patches/pulseaudio-04-fixlink.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
---- pulseaudio-1.0/src/pulsecore/core-scache.h-orig	2011-10-19 09:56:30.443291065 -0500
-+++ pulseaudio-1.0/src/pulsecore/core-scache.h	2011-10-19 09:57:15.863329411 -0500
-@@ -27,8 +27,6 @@
- #include <pulsecore/memchunk.h>
- #include <pulsecore/sink.h>
- 
--#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16)
--
- typedef struct pa_scache_entry {
-     uint32_t index;
-     pa_core *core;
---- pulseaudio-1.0/src/pulsecore/memchunk.h-orig	2011-10-19 09:56:45.049056686 -0500
-+++ pulseaudio-1.0/src/pulsecore/memchunk.h	2011-10-19 09:56:59.243495913 -0500
-@@ -53,4 +53,6 @@ pa_memchunk* pa_memchunk_memcpy(pa_memch
- /* Return TRUE if any field is set != 0 */
- pa_bool_t pa_memchunk_isset(pa_memchunk *c);
- 
-+#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16)
-+
- #endif
---- pulseaudio-1.0/src/pulsecore/pstream.c-orig	2011-10-19 09:56:00.968603148 -0500
-+++ pulseaudio-1.0/src/pulsecore/pstream.c	2011-10-19 09:57:49.036969685 -0500
-@@ -37,7 +37,7 @@
- #include <pulsecore/socket.h>
- #include <pulsecore/queue.h>
- #include <pulsecore/log.h>
--#include <pulsecore/core-scache.h>
-+#include <pulsecore/memchunk.h>
- #include <pulsecore/creds.h>
- #include <pulsecore/refcnt.h>
- #include <pulsecore/flist.h>
---- pulseaudio-1.0/src/Makefile.am-orig	2011-10-19 10:26:08.909354110 -0500
-+++ pulseaudio-1.0/src/Makefile.am	2011-10-19 10:26:21.545547580 -0500
-@@ -510,7 +510,7 @@ usergroup_test_CFLAGS = $(AM_CFLAGS)
- usergroup_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
- 
- connect_stress_SOURCES = tests/connect-stress.c
--connect_stress_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@[email protected]
-+connect_stress_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@[email protected] libpulsecore-@[email protected]
- connect_stress_CFLAGS = $(AM_CFLAGS)
- connect_stress_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
- 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-04-gconf.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,73 @@
+--- pulseaudio-1.0/src/modules/gconf/module-gconf.c-orig	2011-10-14 22:41:51.543432298 -0500
++++ pulseaudio-1.0/src/modules/gconf/module-gconf.c	2011-10-14 22:42:44.571594133 -0500
+@@ -56,7 +56,7 @@ struct module_item {
+     uint32_t index;
+ };
+ 
+-struct module_info {
++struct pa_module_info {
+     char *name;
+ 
+     struct module_item items[MAX_MODULES];
+@@ -128,7 +128,7 @@ static char *read_string(struct userdata
+     }
+ }
+ 
+-static void unload_one_module(struct userdata *u, struct module_info*m, unsigned i) {
++static void unload_one_module(struct userdata *u, struct pa_module_info*m, unsigned i) {
+     pa_assert(u);
+     pa_assert(m);
+     pa_assert(i < m->n_items);
+@@ -144,7 +144,7 @@ static void unload_one_module(struct use
+     m->items[i].name = m->items[i].args = NULL;
+ }
+ 
+-static void unload_all_modules(struct userdata *u, struct module_info*m) {
++static void unload_all_modules(struct userdata *u, struct pa_module_info*m) {
+     unsigned i;
+ 
+     pa_assert(u);
+@@ -158,7 +158,7 @@ static void unload_all_modules(struct us
+ 
+ static void load_module(
+         struct userdata *u,
+-        struct module_info *m,
++        struct pa_module_info *m,
+         unsigned i,
+         const char *name,
+         const char *args,
+@@ -195,7 +195,7 @@ static void load_module(
+ }
+ 
+ static void module_info_free(void *p, void *userdata) {
+-    struct module_info *m = p;
++    struct pa_module_info *m = p;
+     struct userdata *u = userdata;
+ 
+     pa_assert(m);
+@@ -225,14 +225,14 @@ static int handle_event(struct userdata 
+ 
+             case '+': {
+                 char *name;
+-                struct module_info *m;
++                struct pa_module_info *m;
+                 unsigned i, j;
+ 
+                 if (!(name = read_string(u)))
+                     goto fail;
+ 
+                 if (!(m = pa_hashmap_get(u->module_infos, name))) {
+-                    m = pa_xnew(struct module_info, 1);
++                    m = pa_xnew(struct pa_module_info, 1);
+                     m->name = name;
+                     m->n_items = 0;
+                     pa_hashmap_put(u->module_infos, m->name, m);
+@@ -279,7 +279,7 @@ static int handle_event(struct userdata 
+ 
+             case '-': {
+                 char *name;
+-                struct module_info *m;
++                struct pa_module_info *m;
+ 
+                 if (!(name = read_string(u)))
+                     goto fail;
--- a/patches/pulseaudio-05-amd64.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
---- pulseaudio-1.0/src/pulsecore/core-util.c-orig	2011-10-06 19:40:11.876688365 -0500
-+++ pulseaudio-1.0/src/pulsecore/core-util.c	2011-10-06 19:42:47.201806884 -0500
-@@ -3195,7 +3195,7 @@ char *pa_read_line_from_file(const char 
- 
- pa_bool_t pa_running_in_vm(void) {
- 
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__)
- 
-     /* Both CPUID and DMI are x86 specific interfaces... */
- 
---- pulseaudio-1.0/src/pulsecore/remap_mmx.c-orig	2011-10-17 22:11:30.204585354 -0500
-+++ pulseaudio-1.0/src/pulsecore/remap_mmx.c	2011-10-17 22:17:22.993499444 -0500
-@@ -100,7 +100,7 @@
-                 "4:                             \n\t"  \
-                 " emms                          \n\t"
- 
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- static void remap_mono_to_stereo_mmx(pa_remap_t *m, void *dst, const void *src, unsigned n) {
-     pa_reg_x86 temp, temp2;
- 
-@@ -144,10 +144,10 @@ static void init_remap_mmx(pa_remap_t *m
-         pa_log_info("Using MMX mono to stereo remapping");
-     }
- }
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- 
- void pa_remap_func_init_mmx(pa_cpu_x86_flag_t flags) {
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- 
-     if (flags & PA_CPU_X86_MMX) {
-         pa_log_info("Initialising MMX optimized remappers.");
-@@ -155,5 +155,5 @@ void pa_remap_func_init_mmx(pa_cpu_x86_f
-         pa_set_init_remap_func((pa_init_remap_func_t) init_remap_mmx);
-     }
- 
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- }
---- pulseaudio-1.0/src/pulsecore/remap_sse.c-orig	2011-10-17 22:17:37.212080000 -0500
-+++ pulseaudio-1.0/src/pulsecore/remap_sse.c	2011-10-17 22:17:52.347912472 -0500
-@@ -99,7 +99,7 @@
-                 " jne 3b                        \n\t"  \
-                 "4:                             \n\t"
- 
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- static void remap_mono_to_stereo_sse2(pa_remap_t *m, void *dst, const void *src, unsigned n) {
-     pa_reg_x86 temp, temp2;
- 
-@@ -143,15 +143,15 @@ static void init_remap_sse2(pa_remap_t *
-         pa_log_info("Using SSE mono to stereo remapping");
-     }
- }
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- 
- void pa_remap_func_init_sse(pa_cpu_x86_flag_t flags) {
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- 
-     if (flags & PA_CPU_X86_SSE2) {
-         pa_log_info("Initialising SSE2 optimized remappers.");
-         pa_set_init_remap_func ((pa_init_remap_func_t) init_remap_sse2);
-     }
- 
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- }
---- pulseaudio-1.0/src/pulsecore/svolume_sse.c-orig	2011-10-17 22:18:54.325624955 -0500
-+++ pulseaudio-1.0/src/pulsecore/svolume_sse.c	2011-10-17 22:19:08.744843997 -0500
-@@ -34,7 +34,7 @@
- 
- #include "sample-util.h"
- 
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- 
- #define VOLUME_32x16(s,v)                  /* .. |   vh  |   vl  | */                   \
-       " pxor %%xmm4, %%xmm4          \n\t" /* .. |    0  |    0  | */                   \
-@@ -332,10 +332,10 @@ static void run_test(void) {
-     pa_assert_se(memcmp(samples_ref, samples, sizeof(samples)) == 0);
- }
- #endif
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- 
- void pa_volume_func_init_sse(pa_cpu_x86_flag_t flags) {
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- 
- #ifdef RUN_TEST
-     run_test();
-@@ -347,5 +347,5 @@ void pa_volume_func_init_sse(pa_cpu_x86_
-         pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_sse2);
-         pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_sse2);
-     }
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- }
---- pulseaudio-1.0/src/pulsecore/svolume_mmx.c-orig	2011-10-17 22:18:23.485381654 -0500
-+++ pulseaudio-1.0/src/pulsecore/svolume_mmx.c	2011-10-17 22:18:39.050384384 -0500
-@@ -34,7 +34,7 @@
- 
- #include "sample-util.h"
- 
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- /* in s: 2 int16_t samples
-  * in v: 2 int32_t volumes, fixed point 16:16
-  * out s: contains scaled and clamped int16_t samples.
-@@ -324,11 +324,11 @@ static void run_test(void) {
- }
- #endif
- 
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- 
- 
- void pa_volume_func_init_mmx(pa_cpu_x86_flag_t flags) {
--#if defined (__i386__) || defined (__amd64__)
-+#if defined (__i386__)
- 
- #ifdef RUN_TEST
-     run_test();
-@@ -340,5 +340,5 @@ void pa_volume_func_init_mmx(pa_cpu_x86_
-         pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx);
-         pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_mmx);
-     }
--#endif /* defined (__i386__) || defined (__amd64__) */
-+#endif /* defined (__i386__) */
- }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-05-shm.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,33 @@
+--- pulseaudio-1.1/src/pulsecore/shm.c-orig	2011-10-24 19:42:44.692685416 -0500
++++ pulseaudio-1.1/src/pulsecore/shm.c	2011-10-24 20:24:30.605598557 -0500
+@@ -68,8 +68,13 @@
+  * /dev/shm. We can use that information to list all blocks and
+  * cleanup unused ones */
+ #define SHM_PATH "/dev/shm/"
++#define SHM_ID_LEN 10
++#elif defined(__sun)
++#define SHM_PATH "/tmp"
++#define SHM_ID_LEN 15
+ #else
+ #undef SHM_PATH
++#define SHM_ID_LEN 0
+ #endif
+ 
+ #define SHM_MARKER ((int) 0xbeefcafe)
+@@ -359,10 +364,14 @@ int pa_shm_cleanup(void) {
+         char fn[128];
+         struct shm_marker *m;
+ 
+-        if (strncmp(de->d_name, "pulse-shm-", 10))
++#ifdef __linux
++        if (strncmp(de->d_name, "pulse-shm-", SHM_ID_LEN))
++#elif defined(__sun)
++        if (strncmp(de->d_name, ".SHMDpulse-shm-", SHM_ID_LEN))
++#endif
+             continue;
+ 
+-        if (pa_atou(de->d_name + 10, &id) < 0)
++        if (pa_atou(de->d_name + SHM_ID_LEN, &id) < 0)
+             continue;
+ 
+         if (pa_shm_attach_ro(&seg, id) < 0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-06-configure.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,11 @@
+--- pulseaudio-1.1/src/daemon/default.pa.in-orig	2011-10-31 13:39:49.772299629 -0500
++++ pulseaudio-1.1/src/daemon/default.pa.in	2011-10-31 13:40:02.270114775 -0500
+@@ -52,7 +52,7 @@ ifelse(@HAVE_ALSA@, 1, [dnl
+ #load-module module-alsa-source device=hw:1,0
+ ])dnl
+ ifelse(@HAVE_OSS_OUTPUT@, 1, [dnl
+-#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
++load-module module-oss device="/dev/dsp" sink_name=output source_name=input
+ #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
+ ])dnl
+ ifelse(@HAVE_WAVEOUT@, 1, [dnl
--- a/patches/pulseaudio-06-gconf.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
---- pulseaudio-1.0/src/modules/gconf/module-gconf.c-orig	2011-10-14 22:41:51.543432298 -0500
-+++ pulseaudio-1.0/src/modules/gconf/module-gconf.c	2011-10-14 22:42:44.571594133 -0500
-@@ -56,7 +56,7 @@ struct module_item {
-     uint32_t index;
- };
- 
--struct module_info {
-+struct pa_module_info {
-     char *name;
- 
-     struct module_item items[MAX_MODULES];
-@@ -128,7 +128,7 @@ static char *read_string(struct userdata
-     }
- }
- 
--static void unload_one_module(struct userdata *u, struct module_info*m, unsigned i) {
-+static void unload_one_module(struct userdata *u, struct pa_module_info*m, unsigned i) {
-     pa_assert(u);
-     pa_assert(m);
-     pa_assert(i < m->n_items);
-@@ -144,7 +144,7 @@ static void unload_one_module(struct use
-     m->items[i].name = m->items[i].args = NULL;
- }
- 
--static void unload_all_modules(struct userdata *u, struct module_info*m) {
-+static void unload_all_modules(struct userdata *u, struct pa_module_info*m) {
-     unsigned i;
- 
-     pa_assert(u);
-@@ -158,7 +158,7 @@ static void unload_all_modules(struct us
- 
- static void load_module(
-         struct userdata *u,
--        struct module_info *m,
-+        struct pa_module_info *m,
-         unsigned i,
-         const char *name,
-         const char *args,
-@@ -195,7 +195,7 @@ static void load_module(
- }
- 
- static void module_info_free(void *p, void *userdata) {
--    struct module_info *m = p;
-+    struct pa_module_info *m = p;
-     struct userdata *u = userdata;
- 
-     pa_assert(m);
-@@ -225,14 +225,14 @@ static int handle_event(struct userdata 
- 
-             case '+': {
-                 char *name;
--                struct module_info *m;
-+                struct pa_module_info *m;
-                 unsigned i, j;
- 
-                 if (!(name = read_string(u)))
-                     goto fail;
- 
-                 if (!(m = pa_hashmap_get(u->module_infos, name))) {
--                    m = pa_xnew(struct module_info, 1);
-+                    m = pa_xnew(struct pa_module_info, 1);
-                     m->name = name;
-                     m->n_items = 0;
-                     pa_hashmap_put(u->module_infos, m->name, m);
-@@ -279,7 +279,7 @@ static int handle_event(struct userdata 
- 
-             case '-': {
-                 char *name;
--                struct module_info *m;
-+                struct pa_module_info *m;
- 
-                 if (!(name = read_string(u)))
-                     goto fail;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-07-sada.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,61 @@
+--- pulseaudio-1.1/src/modules/module-solaris.c-orig	2011-11-29 16:41:26.244605338 -0600
++++ pulseaudio-1.1/src/modules/module-solaris.c	2011-11-29 16:41:29.894285167 -0600
+@@ -485,14 +485,26 @@ static int source_process_msg(pa_msgobje
+ static void sink_set_volume(pa_sink *s) {
+     struct userdata *u;
+     audio_info_t info;
++    pa_volume_t v;
+ 
+     pa_assert_se(u = s->userdata);
+ 
++    if (u->fd < 0) {
++       u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK, 0);
++    }
++
+     if (u->fd >= 0) {
+         AUDIO_INITINFO(&info);
+ 
+-        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+-        assert(info.play.gain <= AUDIO_MAX_GAIN);
++        v = pa_cvolume_max(&s->real_volume);
++        if (v > PA_VOLUME_NORM) {
++                v = PA_VOLUME_NORM;
++        }
++
++        info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
++
++        pa_log_debug("PA_VOLUME_NORM is %ld", PA_VOLUME_NORM);
++        pa_log_debug("Setting volume %ld %ld", v, info.play.gain);
+ 
+         if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
+             if (errno == EINVAL)
+@@ -513,6 +525,7 @@ static void sink_get_volume(pa_sink *s) 
+         if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0)
+             pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
+         else
++            pa_log_debug("Getting volume %ld %ld", info.play.gain, (info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN));
+             pa_cvolume_set(&s->real_volume, s->sample_spec.channels, info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
+     }
+ }
+@@ -520,14 +533,19 @@ static void sink_get_volume(pa_sink *s) 
+ static void source_set_volume(pa_source *s) {
+     struct userdata *u;
+     audio_info_t info;
++    pa_volume_t v;
+ 
+     pa_assert_se(u = s->userdata);
+ 
+     if (u->fd >= 0) {
+         AUDIO_INITINFO(&info);
+ 
+-        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+-        assert(info.play.gain <= AUDIO_MAX_GAIN);
++        v = pa_cvolume_max(&s->real_volume);
++        if (v > PA_VOLUME_NORM) {
++                v = PA_VOLUME_NORM;
++        }
++
++        info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+ 
+         if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
+             if (errno == EINVAL)
--- a/patches/pulseaudio-07-shm.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
---- pulseaudio-1.1/src/pulsecore/shm.c-orig	2011-10-24 19:42:44.692685416 -0500
-+++ pulseaudio-1.1/src/pulsecore/shm.c	2011-10-24 20:24:30.605598557 -0500
-@@ -68,8 +68,13 @@
-  * /dev/shm. We can use that information to list all blocks and
-  * cleanup unused ones */
- #define SHM_PATH "/dev/shm/"
-+#define SHM_ID_LEN 10
-+#elif defined(__sun)
-+#define SHM_PATH "/tmp"
-+#define SHM_ID_LEN 15
- #else
- #undef SHM_PATH
-+#define SHM_ID_LEN 0
- #endif
- 
- #define SHM_MARKER ((int) 0xbeefcafe)
-@@ -359,10 +364,14 @@ int pa_shm_cleanup(void) {
-         char fn[128];
-         struct shm_marker *m;
- 
--        if (strncmp(de->d_name, "pulse-shm-", 10))
-+#ifdef __linux
-+        if (strncmp(de->d_name, "pulse-shm-", SHM_ID_LEN))
-+#elif defined(__sun)
-+        if (strncmp(de->d_name, ".SHMDpulse-shm-", SHM_ID_LEN))
-+#endif
-             continue;
- 
--        if (pa_atou(de->d_name + 10, &id) < 0)
-+        if (pa_atou(de->d_name + SHM_ID_LEN, &id) < 0)
-             continue;
- 
-         if (pa_shm_attach_ro(&seg, id) < 0)
--- a/patches/pulseaudio-08-configure.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- pulseaudio-1.1/src/daemon/default.pa.in-orig	2011-10-31 13:39:49.772299629 -0500
-+++ pulseaudio-1.1/src/daemon/default.pa.in	2011-10-31 13:40:02.270114775 -0500
-@@ -52,7 +52,7 @@ ifelse(@HAVE_ALSA@, 1, [dnl
- #load-module module-alsa-source device=hw:1,0
- ])dnl
- ifelse(@HAVE_OSS_OUTPUT@, 1, [dnl
--#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
-+load-module module-oss device="/dev/dsp" sink_name=output source_name=input
- #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
- ])dnl
- ifelse(@HAVE_WAVEOUT@, 1, [dnl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-08-oss4.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,706 @@
+--- pulseaudio-1.1/src/modules/oss/module-oss.c-orig	2011-12-05 22:39:23.080253278 -0600
++++ pulseaudio-1.1/src/modules/oss/module-oss.c	2011-12-13 03:06:48.632544258 -0600
+@@ -34,6 +34,8 @@
+  *
+  */
+ 
++#define HAVE_OSSV4
++
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
+@@ -125,7 +127,18 @@ struct userdata {
+     int mode;
+ 
+     int mixer_fd;
++
++#ifdef HAVE_OSSV4
++    int mixer_dev;
++    int mixer_sink_control;
++    int mixer_source_control;
++    int mixer_cmax;
++    int mixer_dsp_fd;
++    oss_mixext sink_mixext;
++    oss_mixext source_mixext;
++#else
+     int mixer_devmask;
++#endif
+ 
+     int nfrags, frag_size, orig_frag_size;
+ 
+@@ -800,6 +813,160 @@ static int source_process_msg(pa_msgobje
+     return ret;
+ }
+ 
++#ifdef HAVE_OSSV4
++
++static const char *
++mixer_ext_type_get_name (int type)
++{
++    switch (type) {
++        case MIXT_DEVROOT:
++            return "Device root entry";
++        case MIXT_GROUP:
++            return "Controller group";
++        case MIXT_ONOFF:
++            return "On/Off switch";
++        case MIXT_ENUM:
++            return "Enumeration control";
++        case MIXT_MONOSLIDER:
++            return "Mono slider (0-255)";
++        case MIXT_STEREOSLIDER:
++            return "Stereo slider (0-255)";
++        case MIXT_MESSAGE:
++            return "Textual message";
++        case MIXT_MONOVU:
++            return "Mono VU meter value";
++        case MIXT_STEREOVU:
++            return "Stereo VU meter value";
++        case MIXT_MONOPEAK:
++            return "Mono VU meter peak value";
++        case MIXT_STEREOPEAK:
++            return "Stereo VU meter peak value";
++        case MIXT_RADIOGROUP:
++            return "Radio button group";
++        case MIXT_MARKER:
++            /* Separator between normal and extension entries */
++            return "Separator";
++        case MIXT_VALUE:
++            return "Decimal value entry";
++        case MIXT_HEXVALUE:
++            return "Hex value entry";
++        case MIXT_SLIDER:
++            return "Mono slider (31-bit value range)";
++        case MIXT_3D:
++            return "3D";
++        case MIXT_MONOSLIDER16:
++            return "Mono slider (0-32767)";
++        case MIXT_STEREOSLIDER16:
++            return "Stereo slider (0-32767)";
++        case MIXT_MUTE:
++            return "Mute switch";
++        default:
++            break;
++    }
++
++    return "Unknown";
++}
++
++void
++mixer_showflags (int flags)
++{
++    struct
++    {
++        int flag;
++        char nick[16];
++    } all_flags[] = {
++        /* first the important ones */
++        {
++        MIXF_MAINVOL, "MAINVOL"}, {
++        MIXF_PCMVOL, "PCMVOL"}, {
++        MIXF_RECVOL, "RECVOL"}, {
++        MIXF_MONVOL, "MONVOL"}, {
++        MIXF_DESCR, "DESCR"},
++
++        /* now the rest in the right order */
++        {
++        MIXF_READABLE, "READABLE"}, {
++        MIXF_WRITEABLE, "WRITABLE"}, {
++        MIXF_POLL, "POLL"}, {
++        MIXF_HZ, "HZ"}, {
++        MIXF_STRING, "STRING"}, {
++        MIXF_DYNAMIC, "DYNAMIC"}, {
++        MIXF_OKFAIL, "OKFAIL"}, {
++        MIXF_FLAT, "FLAT"}, {
++        MIXF_LEGACY, "LEGACY"}, {
++        MIXF_CENTIBEL, "CENTIBEL"}, {
++        MIXF_DECIBEL, "DECIBEL"}, {
++        MIXF_WIDE, "WIDE"}
++    };
++    int num_flags = (sizeof (all_flags) / sizeof ((all_flags)[0]));
++    int i;
++
++    if (flags == 0) {
++        pa_log_debug ("  flags  : None");
++        return;
++    }
++
++    for (i=0; i < num_flags; i++) {
++        if ((flags & all_flags[i].flag)) {
++            pa_log_debug ("  flag   : %s", all_flags[i].nick);
++            flags &= ~all_flags[i].flag;      /* unset */
++        }
++    }
++
++    /* Unknown flags? */
++    if (flags != 0) {
++        pa_log_debug ("  flag   : ????");
++    }
++
++    return;
++}
++
++static void sink_get_volume(pa_sink *s) {
++    struct userdata *u;
++
++    pa_assert_se(u = s->userdata);
++
++    if (pa_oss_get_volume(u->mixer_dsp_fd, &(u->sink_mixext), &s->sample_spec, &s->real_volume) >= 0)
++        return;
++
++    pa_log_info("Device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
++}
++
++static void sink_set_volume(pa_sink *s) {
++    struct userdata *u;
++
++    pa_assert_se(u = s->userdata);
++
++    if (pa_oss_set_volume(u->mixer_dsp_fd, &(u->sink_mixext), &s->sample_spec, &s->real_volume) >= 0)
++        return;
++
++    pa_log_info("Device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
++}
++
++static void source_get_volume(pa_source *s) {
++    struct userdata *u;
++
++    pa_assert_se(u = s->userdata);
++
++    if (pa_oss_get_volume(u->mixer_dsp_fd, &(u->source_mixext), &s->sample_spec, &s->real_volume) >= 0)
++        return;
++
++    pa_log_info("Device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
++}
++
++static void source_set_volume(pa_source *s) {
++    struct userdata *u;
++
++    pa_assert_se(u = s->userdata);
++
++    if (pa_oss_set_volume(u->mixer_dsp_fd, &(u->source_mixext), &s->sample_spec, &s->real_volume) >= 0)
++        return;
++
++    pa_log_info("Device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
++}
++
++#else
++
+ static void sink_get_volume(pa_sink *s) {
+     struct userdata *u;
+ 
+@@ -871,6 +1038,7 @@ static void source_set_volume(pa_source 
+ 
+     pa_log_info("Device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
+ }
++#endif
+ 
+ static void thread_func(void *userdata) {
+     struct userdata *u = userdata;
+@@ -1154,6 +1322,11 @@ finish:
+ 
+ int pa__init(pa_module*m) {
+ 
++#ifdef HAVE_OSSV4
++    struct oss_sysinfo si = { {0,}, };
++    struct oss_mixerinfo mi = { 0, };
++#endif
++
+     struct audio_buf_info info;
+     struct userdata *u = NULL;
+     const char *dev;
+@@ -1251,7 +1424,9 @@ int pa__init(pa_module*m) {
+     m->userdata = u;
+     u->fd = fd;
+     u->mixer_fd = -1;
++#ifndef HAVE_OSSV4
+     u->mixer_devmask = 0;
++#endif
+     u->use_getospace = u->use_getispace = TRUE;
+     u->use_getodelay = TRUE;
+     u->mode = mode;
+@@ -1416,6 +1591,194 @@ int pa__init(pa_module*m) {
+     if ((u->mixer_fd = pa_oss_open_mixer_for_device(u->device_name)) >= 0) {
+         pa_bool_t do_close = TRUE;
+ 
++#ifdef HAVE_OSSV4
++#define IGNORE_DEV 1
++        int i;
++
++        u->mixer_dsp_fd = -1;
++
++        if (ioctl (u->mixer_fd, SNDCTL_SYSINFO, &si) < 0) {
++            pa_log_debug ("SNDCTL_SYSINFO failed");
++            goto fail;
++        }
++        for (i = 0; i < si.nummixers; i++) {
++            mi.dev = i;
++            if (ioctl (u->mixer_fd, SNDCTL_MIXERINFO, &mi) < 0) {
++                pa_log_debug("SNDCTL_MIXERINFO failed");
++                goto fail;
++            }
++            if (mi.enabled != 0) {
++                /*
++                 * There could be multiple mixers. First we only care about
++                 * ones which are enabled.  In any case we should not touch
++                 * disabled mixers!  But beyond that it may not be clear which
++                 * one to use!  There is a way to relate the card number to the
++                 * device node name. But there does not seem to be a real good
++                 * way to chose which one to use.  So maybe an env. var. could
++                 * be used to select a dsp device node name and then pick the
++                 * correct mixer number.  (See load_devices() in audioctl).
++                 * This code now will always pick the first enabled mixer
++                 * found.  Which may be wrong for multiple mixers and/or sound
++                 * cards.  It may be possible/desirable to control all mixers
++                 * found at the same time???
++                 */
++                break;
++            }
++        }
++
++        if (i < si.nummixers) {
++            struct stat sbuf;
++
++            if ((stat(mi.devnode, &sbuf) != 0) ||
++                ((sbuf.st_mode & S_IFCHR) == 0)) {
++                pa_log("Failed to get mixer dsp device.");
++                i = si.nummixers;
++            }
++        }
++
++        if (i < si.nummixers &&
++           (u->mixer_dsp_fd = pa_oss_open_mixer(mi.devnode)) >= 0) {
++
++            /* Will cause for loop to exit if not filled in by OSS */
++            u->mixer_cmax = -1;
++            if (ioctl(u->mixer_dsp_fd, SNDCTL_MIX_NREXT, &u->mixer_cmax) < 0) {
++                pa_log("Failed to get max control.");
++                goto fail;
++            }
++
++            pa_log_debug ("Opened mixer device %d with %d controls\n",
++                          mi.dev, mi.nrext);
++
++            u->mixer_sink_control   = -1;
++            u->mixer_source_control = -1;
++
++            for (i=0; i < u->mixer_cmax; i++) {
++                memset (&(u->sink_mixext), 0, sizeof (oss_mixext));
++
++#ifdef IGNORE_DEV
++                /* This will cause dev to be ignored */
++                u->sink_mixext.dev = -1;
++#else
++                u->sink_mixext.dev = mi.dev;
++#endif
++
++                /*
++                 * The real way to pick a control on a mixer is with this
++                 * number.  Note that control numbers are unique across all
++                 * mixers. So dev can just be ignored.  When dev is included
++                 * it will only be used to check for correct dev from
++                 * userland.  But it will not be used to select a mixer.
++                 */
++                u->sink_mixext.ctrl = i;
++
++                pa_log_debug ("Control %d", u->sink_mixext.ctrl);
++
++                if (ioctl (u->mixer_dsp_fd, SNDCTL_MIX_EXTINFO,
++                         &(u->sink_mixext)) < 0) {
++                    pa_log_debug ("SNDCTL_MIX_EXTINFO failed");
++                    continue;
++                }
++
++                pa_log_debug ("  name   : %s", u->sink_mixext.extname);
++                pa_log_debug ("  type   : %s (%d)",
++                              mixer_ext_type_get_name (u->sink_mixext.type),
++                              u->sink_mixext.type);
++                pa_log_debug ("  maxval : %d", u->sink_mixext.maxvalue);
++                pa_log_debug ("  parent : %d", u->sink_mixext.parent);
++                mixer_showflags (u->sink_mixext.flags);
++
++                if ((u->sink_mixext.flags & MIXF_PCMVOL)) {
++                    pa_log_debug ("First PCM control: %d", i);
++                    u->mixer_sink_control = i;
++                    break;
++                }
++
++                /*
++                 * Note that MIXF_MAINVOL may not be an exclusive single
++                 * control.  For example on AudioHD there will be one for each
++                 * output jack (Green, Black, Orange...).  So to really do a
++                 * master volume you would need to do all MIXF_MAINVOL at the
++                 * same time...
++                 */
++                if (((u->sink_mixext.flags & MIXF_MAINVOL)) &&
++                      u->mixer_sink_control == -1) {
++                    pa_log_debug ("First main volume control: %d", i);
++                    u->mixer_sink_control = i;
++                }
++            }
++
++            if (u->mixer_sink_control != -1) {
++                pa_log_debug ("Setting OSS sink callbacks.");
++                pa_sink_set_get_volume_callback(u->sink, sink_get_volume);
++                pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
++                u->sink->n_volume_steps = 101;
++                do_close = FALSE;
++            } else {
++                pa_log_debug ("Not setting OSS sink callbacks.");
++            }
++
++            for (i=0; i < mi.nrext; i++) {
++                memset (&(u->source_mixext), 0, sizeof (oss_mixext));
++#ifdef IGNORE_DEV
++                /* This will cause dev to be ignored */
++                u->source_mixext.dev = -1;
++#else
++                u->source_mixext.dev = mi.dev;
++#endif
++                /*
++                 * The real way to pick a control on a mixer is with this
++                 * number.  Note that control numbers are unique across all
++                 * mixers.  So dev can just be ignored.  When dev is included
++                 * it will only be used to check for correct dev from userland.
++                 * But it will not be used to select a mixer.
++                 */
++                u->source_mixext.ctrl = i;
++
++                pa_log_debug ("Control %d", u->source_mixext.ctrl);
++
++                if (ioctl (u->mixer_dsp_fd, SNDCTL_MIX_EXTINFO,
++                         &(u->source_mixext)) == -1) {
++                    pa_log_debug ("SNDCTL_MIX_EXTINFO failed");
++                    continue;
++                }
++
++                pa_log_debug ("  name   : %s", u->source_mixext.extname);
++                pa_log_debug ("  type   : %s (%d)",
++                              mixer_ext_type_get_name (u->source_mixext.type),
++                              u->source_mixext.type);
++                pa_log_debug ("  maxval : %d", u->source_mixext.maxvalue);
++                pa_log_debug ("  parent : %d", u->source_mixext.parent);
++                mixer_showflags (u->source_mixext.flags);
++
++                /*
++                 * There may be more then one MIXF_RECVOL on a mixer.  In fact
++                 * for audioHD the can be three (line-in, mix-in, and cd-in).
++                 * For a master gain it may be good to adjust all...
++                 */
++                if ((u->source_mixext.flags & MIXF_RECVOL)) {
++                    pa_log_debug ("First REC control: %d", i);
++                    u->mixer_source_control = i;
++                    break;
++                }
++            }
++
++            if (u->mixer_source_control != -1) {
++                pa_log_debug ("Setting OSS source callbacks.");
++                pa_source_set_get_volume_callback(u->source, source_get_volume);
++                pa_source_set_set_volume_callback(u->source, source_set_volume);
++                u->source->n_volume_steps = 101;
++                do_close = FALSE;
++            } else {
++                pa_log_debug ("Not setting OSS source callbacks.");
++            }
++
++            if (do_close == TRUE) {
++                pa_close(u->mixer_dsp_fd);
++                u->mixer_dsp_fd = -1;
++            }
++        }
++
++#else
+         if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &u->mixer_devmask) < 0)
+             pa_log_warn("SOUND_MIXER_READ_DEVMASK failed: %s", pa_cstrerror(errno));
+         else {
+@@ -1435,11 +1800,14 @@ int pa__init(pa_module*m) {
+                 do_close = FALSE;
+             }
+         }
++#endif
+ 
+         if (do_close) {
+             pa_close(u->mixer_fd);
+             u->mixer_fd = -1;
++#ifndef HAVE_OSSV4
+             u->mixer_devmask = 0;
++#endif
+         }
+     }
+ 
+@@ -1558,6 +1926,10 @@ void pa__done(pa_module*m) {
+     if (u->fd >= 0)
+         pa_close(u->fd);
+ 
++#ifdef HAVE_OSSV4
++    if (u->mixer_dsp_fd >= 0)
++        pa_close(u->mixer_dsp_fd);
++#endif
+     if (u->mixer_fd >= 0)
+         pa_close(u->mixer_fd);
+ 
+--- pulseaudio-1.1/src/modules/oss/oss-util.c-orig	2011-12-08 16:37:16.783601951 -0600
++++ pulseaudio-1.1/src/modules/oss/oss-util.c	2011-12-13 03:50:37.757290581 -0600
+@@ -257,6 +257,190 @@ int pa_oss_set_fragments(int fd, int nfr
+     return 0;
+ }
+ 
++#ifdef HAVE_OSSV4
++static int
++oss4_mixer_slider_pack_volume (oss_mixext *mixext, int channels, const pa_cvolume *volume)
++{
++  int val  = 0;
++  int lvol = 0;
++  int rvol = 0;
++  int lval = 0;
++  int rval = 0;
++
++  switch (mixext->type) {
++    case MIXT_MONOSLIDER:
++    case MIXT_MONOSLIDER16:
++    case MIXT_SLIDER:
++      lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
++      val = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
++      break;
++
++    case MIXT_STEREOSLIDER:
++      lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
++      lval = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
++      if (channels >= 2) {
++          rvol = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
++          rval = (rvol*mixext->maxvalue)/PA_VOLUME_NORM;
++      }
++     
++      val = ((rval & 0xff) << 8) | (lval & 0xff);
++      break;
++
++    case MIXT_STEREOSLIDER16:
++      lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
++      lval = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
++      if (channels >= 2) {
++          rvol = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
++          rval = (rvol*mixext->maxvalue)/PA_VOLUME_NORM;
++      }
++
++      val = ((rval & 0xffff) << 16) | (lval & 0xffff);
++
++      break;
++
++    default:
++      return 0;
++  }
++
++  return val;
++}
++
++static void
++oss4_mixer_slider_unpack_volume (oss_mixext *mixext, int v, pa_cvolume * volume)
++{
++  uint32_t val, vol;
++
++  val = (uint32_t) v;
++  switch (mixext->type) {
++    case MIXT_SLIDER:
++      vol = val;
++      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      if (volume->channels >= 2) {
++          volume->values[1] = volume->values[0];
++      }
++      break;
++    case MIXT_MONOSLIDER:
++      /* oss repeats the value in the upper bits, as if it was stereo */
++      vol = val & 0x00ff;
++      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      if (volume->channels >= 2) {
++          volume->values[1] = volume->values[0];
++      }
++      break;
++    case MIXT_MONOSLIDER16:
++      /* oss repeats the value in the upper bits, as if it was stereo */
++      vol = val & 0x0000ffff;
++      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      if (volume->channels >= 2) {
++          volume->values[1] = volume->values[0];
++      }
++      break;
++    case MIXT_STEREOSLIDER:
++      vol = (val & 0x00ff);
++      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      if (volume->channels >= 2) {
++          vol = (val & 0xff00) >> 8;
++          volume->values[1] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      }
++      break;
++    case MIXT_STEREOSLIDER16:
++      vol = (val & 0x0000ffff);
++      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      if (volume->channels >= 2) {
++          vol = (val & 0xffff0000) >> 16;
++          volume->values[1] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
++      }
++      break;
++    default:
++      return;
++  }
++}
++
++static int
++oss4_mixer_get_control_val (int fd, oss_mixext *mixext, int *val)
++{
++  oss_mixer_value ossval = { 0, };
++
++  /* ossval.dev = mixext->dev; */
++  ossval.dev = -1;		/* if -1 on entry then is ignored */
++  /*
++   * The real way to pick a control on a mixer is with this number.
++   * Note that control numbers are uniq across all mixers. So dev
++   * can just be ignored. When dev is included it will only be used
++   * to check for correct dev from userland. But it will not be used
++   * to select a mixer.
++   */
++  ossval.ctrl = mixext->ctrl;
++  ossval.timestamp = mixext->timestamp;
++
++  if (ioctl (fd, SNDCTL_MIX_READ, &ossval) == -1) {
++    pa_log_debug ("SNDCTL_MIX_READ failed");
++    *val = 0;
++    return -1;
++  }
++
++  *val = ossval.value;
++  pa_log_debug ("got value 0x%08x from %s", *val, mixext->extname);
++  return 0;
++}
++
++static int
++oss4_mixer_set_control_val (int fd, oss_mixext *mixext, int val)
++{
++  oss_mixer_value ossval = { 0, };
++
++  /* ossval.dev = mixext->dev; */
++  ossval.dev = -1;		/* if -1 on entry then is ignored */
++  /*
++   * The real way to pick a control on a mixer is with this number.
++   * Note that control numbers are uniq across all mixers. So dev
++   * can just be ignored. When dev is included it will only be used
++   * to check for correct dev from userland. But it will not be used
++   * to select a mixer.
++   */
++  ossval.ctrl = mixext->ctrl;
++  ossval.timestamp = mixext->timestamp;
++  ossval.value = val;
++
++  if (ioctl (fd, SNDCTL_MIX_WRITE, &ossval) == -1) {
++    pa_log_debug ("SNDCTL_MIX_WRITE failed");
++    return -1;
++  }
++
++  pa_log_debug ("set value 0x%08x on %s", val, mixext->extname);
++  return 0;
++}
++
++int pa_oss_get_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, pa_cvolume *volume) {
++  int v = 0;
++
++  if (oss4_mixer_get_control_val (fd, mixext, &v) != 0) {
++    pa_log_debug ("Getting volume failed");
++    return -1;
++  }
++
++  pa_cvolume_reset(volume, ss->channels);
++
++  oss4_mixer_slider_unpack_volume (mixext, v, volume);
++
++  return 0;
++}
++
++int pa_oss_set_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, const pa_cvolume *volume) {
++  int val = 0;
++
++  val = oss4_mixer_slider_pack_volume (mixext, ss->channels, volume);
++
++  if (oss4_mixer_set_control_val (fd, mixext, val) != 0) {
++    pa_log_debug ("Setting volume failed");
++    return -1;
++  }
++
++  return 0;
++}
++
++#else
++
+ int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume) {
+     char cv[PA_CVOLUME_SNPRINT_MAX];
+     unsigned vol;
+@@ -299,6 +483,7 @@ int pa_oss_set_volume(int fd, unsigned l
+     pa_log_debug("Wrote mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume));
+     return 0;
+ }
++#endif
+ 
+ static int get_device_number(const char *dev) {
+     const char *p, *e;
+@@ -397,9 +582,11 @@ int pa_oss_get_hw_description(const char
+     return r;
+ }
+ 
+-static int open_mixer(const char *mixer) {
++int pa_oss_open_mixer(const char *mixer) {
+     int fd;
+ 
++    pa_log_debug ("Opening device %s", mixer);
++
+     if ((fd = pa_open_cloexec(mixer, O_RDWR|O_NDELAY, 0)) >= 0)
+         return fd;
+ 
+@@ -411,19 +598,22 @@ int pa_oss_open_mixer_for_device(const c
+     char *fn;
+     int fd;
+ 
+-    if ((n = get_device_number(device)) < 0)
++    if ((n = get_device_number(device)) < 0) {
++        pa_log_debug ("Cannot find device");
+         return -1;
++    }
+ 
+     if (n == 0)
+-        if ((fd = open_mixer("/dev/mixer")) >= 0)
++        if ((fd = pa_oss_open_mixer("/dev/mixer")) >= 0)
+             return fd;
+ 
+     fn = pa_sprintf_malloc("/dev/mixer%i", n);
+-    fd = open_mixer(fn);
++    fd = pa_oss_open_mixer(fn);
+     pa_xfree(fn);
+ 
+     if (fd < 0)
+         pa_log_warn("Failed to open mixer '%s': %s", device, pa_cstrerror(errno));
++    else
+ 
+     return fd;
+ }
+--- pulseaudio-1.1/src/modules/oss/oss-util.h-orig	2011-12-05 22:39:30.119276863 -0600
++++ pulseaudio-1.1/src/modules/oss/oss-util.h	2011-12-13 01:22:45.351928881 -0600
+@@ -31,11 +31,21 @@ int pa_oss_auto_format(int fd, pa_sample
+ 
+ int pa_oss_set_fragments(int fd, int frags, int frag_size);
+ 
++#define HAVE_OSSV4
++
++#ifdef HAVE_OSSV4
++int pa_oss_set_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, const pa_cvolume *volume);
++int pa_oss_get_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, pa_cvolume *volume);
++
++#else
++
+ int pa_oss_set_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, const pa_cvolume *volume);
+ int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume);
++#endif
+ 
+ int pa_oss_get_hw_description(const char *dev, char *name, size_t l);
+ 
+ int pa_oss_open_mixer_for_device(const char *device);
++int pa_oss_open_mixer(const char *device);
+ 
+ #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pulseaudio-09-amd64.diff	Fri Apr 27 13:46:26 2012 +0000
@@ -0,0 +1,135 @@
+--- pulseaudio-1.0/src/pulsecore/core-util.c-orig	2011-10-06 19:40:11.876688365 -0500
++++ pulseaudio-1.0/src/pulsecore/core-util.c	2011-10-06 19:42:47.201806884 -0500
+@@ -3195,7 +3195,7 @@ char *pa_read_line_from_file(const char 
+ 
+ pa_bool_t pa_running_in_vm(void) {
+ 
+-#if defined(__i386__) || defined(__x86_64__)
++#if defined(__i386__)
+ 
+     /* Both CPUID and DMI are x86 specific interfaces... */
+ 
+--- pulseaudio-1.0/src/pulsecore/remap_mmx.c-orig	2011-10-17 22:11:30.204585354 -0500
++++ pulseaudio-1.0/src/pulsecore/remap_mmx.c	2011-10-17 22:17:22.993499444 -0500
+@@ -100,7 +100,7 @@
+                 "4:                             \n\t"  \
+                 " emms                          \n\t"
+ 
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ static void remap_mono_to_stereo_mmx(pa_remap_t *m, void *dst, const void *src, unsigned n) {
+     pa_reg_x86 temp, temp2;
+ 
+@@ -144,10 +144,10 @@ static void init_remap_mmx(pa_remap_t *m
+         pa_log_info("Using MMX mono to stereo remapping");
+     }
+ }
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ 
+ void pa_remap_func_init_mmx(pa_cpu_x86_flag_t flags) {
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ 
+     if (flags & PA_CPU_X86_MMX) {
+         pa_log_info("Initialising MMX optimized remappers.");
+@@ -155,5 +155,5 @@ void pa_remap_func_init_mmx(pa_cpu_x86_f
+         pa_set_init_remap_func((pa_init_remap_func_t) init_remap_mmx);
+     }
+ 
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ }
+--- pulseaudio-1.0/src/pulsecore/remap_sse.c-orig	2011-10-17 22:17:37.212080000 -0500
++++ pulseaudio-1.0/src/pulsecore/remap_sse.c	2011-10-17 22:17:52.347912472 -0500
+@@ -99,7 +99,7 @@
+                 " jne 3b                        \n\t"  \
+                 "4:                             \n\t"
+ 
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ static void remap_mono_to_stereo_sse2(pa_remap_t *m, void *dst, const void *src, unsigned n) {
+     pa_reg_x86 temp, temp2;
+ 
+@@ -143,15 +143,15 @@ static void init_remap_sse2(pa_remap_t *
+         pa_log_info("Using SSE mono to stereo remapping");
+     }
+ }
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ 
+ void pa_remap_func_init_sse(pa_cpu_x86_flag_t flags) {
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ 
+     if (flags & PA_CPU_X86_SSE2) {
+         pa_log_info("Initialising SSE2 optimized remappers.");
+         pa_set_init_remap_func ((pa_init_remap_func_t) init_remap_sse2);
+     }
+ 
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ }
+--- pulseaudio-1.0/src/pulsecore/svolume_sse.c-orig	2011-10-17 22:18:54.325624955 -0500
++++ pulseaudio-1.0/src/pulsecore/svolume_sse.c	2011-10-17 22:19:08.744843997 -0500
+@@ -34,7 +34,7 @@
+ 
+ #include "sample-util.h"
+ 
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ 
+ #define VOLUME_32x16(s,v)                  /* .. |   vh  |   vl  | */                   \
+       " pxor %%xmm4, %%xmm4          \n\t" /* .. |    0  |    0  | */                   \
+@@ -332,10 +332,10 @@ static void run_test(void) {
+     pa_assert_se(memcmp(samples_ref, samples, sizeof(samples)) == 0);
+ }
+ #endif
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ 
+ void pa_volume_func_init_sse(pa_cpu_x86_flag_t flags) {
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ 
+ #ifdef RUN_TEST
+     run_test();
+@@ -347,5 +347,5 @@ void pa_volume_func_init_sse(pa_cpu_x86_
+         pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_sse2);
+         pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_sse2);
+     }
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ }
+--- pulseaudio-1.0/src/pulsecore/svolume_mmx.c-orig	2011-10-17 22:18:23.485381654 -0500
++++ pulseaudio-1.0/src/pulsecore/svolume_mmx.c	2011-10-17 22:18:39.050384384 -0500
+@@ -34,7 +34,7 @@
+ 
+ #include "sample-util.h"
+ 
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ /* in s: 2 int16_t samples
+  * in v: 2 int32_t volumes, fixed point 16:16
+  * out s: contains scaled and clamped int16_t samples.
+@@ -324,11 +324,11 @@ static void run_test(void) {
+ }
+ #endif
+ 
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ 
+ 
+ void pa_volume_func_init_mmx(pa_cpu_x86_flag_t flags) {
+-#if defined (__i386__) || defined (__amd64__)
++#if defined (__i386__)
+ 
+ #ifdef RUN_TEST
+     run_test();
+@@ -340,5 +340,5 @@ void pa_volume_func_init_mmx(pa_cpu_x86_
+         pa_set_volume_func(PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx);
+         pa_set_volume_func(PA_SAMPLE_S16RE, (pa_do_volume_func_t) pa_volume_s16re_mmx);
+     }
+-#endif /* defined (__i386__) || defined (__amd64__) */
++#endif /* defined (__i386__) */
+ }
--- a/patches/pulseaudio-09-sada.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
---- pulseaudio-1.1/src/modules/module-solaris.c-orig	2011-11-29 16:41:26.244605338 -0600
-+++ pulseaudio-1.1/src/modules/module-solaris.c	2011-11-29 16:41:29.894285167 -0600
-@@ -485,14 +485,26 @@ static int source_process_msg(pa_msgobje
- static void sink_set_volume(pa_sink *s) {
-     struct userdata *u;
-     audio_info_t info;
-+    pa_volume_t v;
- 
-     pa_assert_se(u = s->userdata);
- 
-+    if (u->fd < 0) {
-+       u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK, 0);
-+    }
-+
-     if (u->fd >= 0) {
-         AUDIO_INITINFO(&info);
- 
--        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
--        assert(info.play.gain <= AUDIO_MAX_GAIN);
-+        v = pa_cvolume_max(&s->real_volume);
-+        if (v > PA_VOLUME_NORM) {
-+                v = PA_VOLUME_NORM;
-+        }
-+
-+        info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
-+
-+        pa_log_debug("PA_VOLUME_NORM is %ld", PA_VOLUME_NORM);
-+        pa_log_debug("Setting volume %ld %ld", v, info.play.gain);
- 
-         if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
-             if (errno == EINVAL)
-@@ -513,6 +525,7 @@ static void sink_get_volume(pa_sink *s) 
-         if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0)
-             pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
-         else
-+            pa_log_debug("Getting volume %ld %ld", info.play.gain, (info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN));
-             pa_cvolume_set(&s->real_volume, s->sample_spec.channels, info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
-     }
- }
-@@ -520,14 +533,19 @@ static void sink_get_volume(pa_sink *s) 
- static void source_set_volume(pa_source *s) {
-     struct userdata *u;
-     audio_info_t info;
-+    pa_volume_t v;
- 
-     pa_assert_se(u = s->userdata);
- 
-     if (u->fd >= 0) {
-         AUDIO_INITINFO(&info);
- 
--        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
--        assert(info.play.gain <= AUDIO_MAX_GAIN);
-+        v = pa_cvolume_max(&s->real_volume);
-+        if (v > PA_VOLUME_NORM) {
-+                v = PA_VOLUME_NORM;
-+        }
-+
-+        info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
- 
-         if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
-             if (errno == EINVAL)
--- a/patches/pulseaudio-10-oss4.diff	Tue Apr 24 06:46:40 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,706 +0,0 @@
---- pulseaudio-1.1/src/modules/oss/module-oss.c-orig	2011-12-05 22:39:23.080253278 -0600
-+++ pulseaudio-1.1/src/modules/oss/module-oss.c	2011-12-13 03:06:48.632544258 -0600
-@@ -34,6 +34,8 @@
-  *
-  */
- 
-+#define HAVE_OSSV4
-+
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
-@@ -125,7 +127,18 @@ struct userdata {
-     int mode;
- 
-     int mixer_fd;
-+
-+#ifdef HAVE_OSSV4
-+    int mixer_dev;
-+    int mixer_sink_control;
-+    int mixer_source_control;
-+    int mixer_cmax;
-+    int mixer_dsp_fd;
-+    oss_mixext sink_mixext;
-+    oss_mixext source_mixext;
-+#else
-     int mixer_devmask;
-+#endif
- 
-     int nfrags, frag_size, orig_frag_size;
- 
-@@ -800,6 +813,160 @@ static int source_process_msg(pa_msgobje
-     return ret;
- }
- 
-+#ifdef HAVE_OSSV4
-+
-+static const char *
-+mixer_ext_type_get_name (int type)
-+{
-+    switch (type) {
-+        case MIXT_DEVROOT:
-+            return "Device root entry";
-+        case MIXT_GROUP:
-+            return "Controller group";
-+        case MIXT_ONOFF:
-+            return "On/Off switch";
-+        case MIXT_ENUM:
-+            return "Enumeration control";
-+        case MIXT_MONOSLIDER:
-+            return "Mono slider (0-255)";
-+        case MIXT_STEREOSLIDER:
-+            return "Stereo slider (0-255)";
-+        case MIXT_MESSAGE:
-+            return "Textual message";
-+        case MIXT_MONOVU:
-+            return "Mono VU meter value";
-+        case MIXT_STEREOVU:
-+            return "Stereo VU meter value";
-+        case MIXT_MONOPEAK:
-+            return "Mono VU meter peak value";
-+        case MIXT_STEREOPEAK:
-+            return "Stereo VU meter peak value";
-+        case MIXT_RADIOGROUP:
-+            return "Radio button group";
-+        case MIXT_MARKER:
-+            /* Separator between normal and extension entries */
-+            return "Separator";
-+        case MIXT_VALUE:
-+            return "Decimal value entry";
-+        case MIXT_HEXVALUE:
-+            return "Hex value entry";
-+        case MIXT_SLIDER:
-+            return "Mono slider (31-bit value range)";
-+        case MIXT_3D:
-+            return "3D";
-+        case MIXT_MONOSLIDER16:
-+            return "Mono slider (0-32767)";
-+        case MIXT_STEREOSLIDER16:
-+            return "Stereo slider (0-32767)";
-+        case MIXT_MUTE:
-+            return "Mute switch";
-+        default:
-+            break;
-+    }
-+
-+    return "Unknown";
-+}
-+
-+void
-+mixer_showflags (int flags)
-+{
-+    struct
-+    {
-+        int flag;
-+        char nick[16];
-+    } all_flags[] = {
-+        /* first the important ones */
-+        {
-+        MIXF_MAINVOL, "MAINVOL"}, {
-+        MIXF_PCMVOL, "PCMVOL"}, {
-+        MIXF_RECVOL, "RECVOL"}, {
-+        MIXF_MONVOL, "MONVOL"}, {
-+        MIXF_DESCR, "DESCR"},
-+
-+        /* now the rest in the right order */
-+        {
-+        MIXF_READABLE, "READABLE"}, {
-+        MIXF_WRITEABLE, "WRITABLE"}, {
-+        MIXF_POLL, "POLL"}, {
-+        MIXF_HZ, "HZ"}, {
-+        MIXF_STRING, "STRING"}, {
-+        MIXF_DYNAMIC, "DYNAMIC"}, {
-+        MIXF_OKFAIL, "OKFAIL"}, {
-+        MIXF_FLAT, "FLAT"}, {
-+        MIXF_LEGACY, "LEGACY"}, {
-+        MIXF_CENTIBEL, "CENTIBEL"}, {
-+        MIXF_DECIBEL, "DECIBEL"}, {
-+        MIXF_WIDE, "WIDE"}
-+    };
-+    int num_flags = (sizeof (all_flags) / sizeof ((all_flags)[0]));
-+    int i;
-+
-+    if (flags == 0) {
-+        pa_log_debug ("  flags  : None");
-+        return;
-+    }
-+
-+    for (i=0; i < num_flags; i++) {
-+        if ((flags & all_flags[i].flag)) {
-+            pa_log_debug ("  flag   : %s", all_flags[i].nick);
-+            flags &= ~all_flags[i].flag;      /* unset */
-+        }
-+    }
-+
-+    /* Unknown flags? */
-+    if (flags != 0) {
-+        pa_log_debug ("  flag   : ????");
-+    }
-+
-+    return;
-+}
-+
-+static void sink_get_volume(pa_sink *s) {
-+    struct userdata *u;
-+
-+    pa_assert_se(u = s->userdata);
-+
-+    if (pa_oss_get_volume(u->mixer_dsp_fd, &(u->sink_mixext), &s->sample_spec, &s->real_volume) >= 0)
-+        return;
-+
-+    pa_log_info("Device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
-+}
-+
-+static void sink_set_volume(pa_sink *s) {
-+    struct userdata *u;
-+
-+    pa_assert_se(u = s->userdata);
-+
-+    if (pa_oss_set_volume(u->mixer_dsp_fd, &(u->sink_mixext), &s->sample_spec, &s->real_volume) >= 0)
-+        return;
-+
-+    pa_log_info("Device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
-+}
-+
-+static void source_get_volume(pa_source *s) {
-+    struct userdata *u;
-+
-+    pa_assert_se(u = s->userdata);
-+
-+    if (pa_oss_get_volume(u->mixer_dsp_fd, &(u->source_mixext), &s->sample_spec, &s->real_volume) >= 0)
-+        return;
-+
-+    pa_log_info("Device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
-+}
-+
-+static void source_set_volume(pa_source *s) {
-+    struct userdata *u;
-+
-+    pa_assert_se(u = s->userdata);
-+
-+    if (pa_oss_set_volume(u->mixer_dsp_fd, &(u->source_mixext), &s->sample_spec, &s->real_volume) >= 0)
-+        return;
-+
-+    pa_log_info("Device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
-+}
-+
-+#else
-+
- static void sink_get_volume(pa_sink *s) {
-     struct userdata *u;
- 
-@@ -871,6 +1038,7 @@ static void source_set_volume(pa_source 
- 
-     pa_log_info("Device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
- }
-+#endif
- 
- static void thread_func(void *userdata) {
-     struct userdata *u = userdata;
-@@ -1154,6 +1322,11 @@ finish:
- 
- int pa__init(pa_module*m) {
- 
-+#ifdef HAVE_OSSV4
-+    struct oss_sysinfo si = { {0,}, };
-+    struct oss_mixerinfo mi = { 0, };
-+#endif
-+
-     struct audio_buf_info info;
-     struct userdata *u = NULL;
-     const char *dev;
-@@ -1251,7 +1424,9 @@ int pa__init(pa_module*m) {
-     m->userdata = u;
-     u->fd = fd;
-     u->mixer_fd = -1;
-+#ifndef HAVE_OSSV4
-     u->mixer_devmask = 0;
-+#endif
-     u->use_getospace = u->use_getispace = TRUE;
-     u->use_getodelay = TRUE;
-     u->mode = mode;
-@@ -1416,6 +1591,194 @@ int pa__init(pa_module*m) {
-     if ((u->mixer_fd = pa_oss_open_mixer_for_device(u->device_name)) >= 0) {
-         pa_bool_t do_close = TRUE;
- 
-+#ifdef HAVE_OSSV4
-+#define IGNORE_DEV 1
-+        int i;
-+
-+        u->mixer_dsp_fd = -1;
-+
-+        if (ioctl (u->mixer_fd, SNDCTL_SYSINFO, &si) < 0) {
-+            pa_log_debug ("SNDCTL_SYSINFO failed");
-+            goto fail;
-+        }
-+        for (i = 0; i < si.nummixers; i++) {
-+            mi.dev = i;
-+            if (ioctl (u->mixer_fd, SNDCTL_MIXERINFO, &mi) < 0) {
-+                pa_log_debug("SNDCTL_MIXERINFO failed");
-+                goto fail;
-+            }
-+            if (mi.enabled != 0) {
-+                /*
-+                 * There could be multiple mixers. First we only care about
-+                 * ones which are enabled.  In any case we should not touch
-+                 * disabled mixers!  But beyond that it may not be clear which
-+                 * one to use!  There is a way to relate the card number to the
-+                 * device node name. But there does not seem to be a real good
-+                 * way to chose which one to use.  So maybe an env. var. could
-+                 * be used to select a dsp device node name and then pick the
-+                 * correct mixer number.  (See load_devices() in audioctl).
-+                 * This code now will always pick the first enabled mixer
-+                 * found.  Which may be wrong for multiple mixers and/or sound
-+                 * cards.  It may be possible/desirable to control all mixers
-+                 * found at the same time???
-+                 */
-+                break;
-+            }
-+        }
-+
-+        if (i < si.nummixers) {
-+            struct stat sbuf;
-+
-+            if ((stat(mi.devnode, &sbuf) != 0) ||
-+                ((sbuf.st_mode & S_IFCHR) == 0)) {
-+                pa_log("Failed to get mixer dsp device.");
-+                i = si.nummixers;
-+            }
-+        }
-+
-+        if (i < si.nummixers &&
-+           (u->mixer_dsp_fd = pa_oss_open_mixer(mi.devnode)) >= 0) {
-+
-+            /* Will cause for loop to exit if not filled in by OSS */
-+            u->mixer_cmax = -1;
-+            if (ioctl(u->mixer_dsp_fd, SNDCTL_MIX_NREXT, &u->mixer_cmax) < 0) {
-+                pa_log("Failed to get max control.");
-+                goto fail;
-+            }
-+
-+            pa_log_debug ("Opened mixer device %d with %d controls\n",
-+                          mi.dev, mi.nrext);
-+
-+            u->mixer_sink_control   = -1;
-+            u->mixer_source_control = -1;
-+
-+            for (i=0; i < u->mixer_cmax; i++) {
-+                memset (&(u->sink_mixext), 0, sizeof (oss_mixext));
-+
-+#ifdef IGNORE_DEV
-+                /* This will cause dev to be ignored */
-+                u->sink_mixext.dev = -1;
-+#else
-+                u->sink_mixext.dev = mi.dev;
-+#endif
-+
-+                /*
-+                 * The real way to pick a control on a mixer is with this
-+                 * number.  Note that control numbers are unique across all
-+                 * mixers. So dev can just be ignored.  When dev is included
-+                 * it will only be used to check for correct dev from
-+                 * userland.  But it will not be used to select a mixer.
-+                 */
-+                u->sink_mixext.ctrl = i;
-+
-+                pa_log_debug ("Control %d", u->sink_mixext.ctrl);
-+
-+                if (ioctl (u->mixer_dsp_fd, SNDCTL_MIX_EXTINFO,
-+                         &(u->sink_mixext)) < 0) {
-+                    pa_log_debug ("SNDCTL_MIX_EXTINFO failed");
-+                    continue;
-+                }
-+
-+                pa_log_debug ("  name   : %s", u->sink_mixext.extname);
-+                pa_log_debug ("  type   : %s (%d)",
-+                              mixer_ext_type_get_name (u->sink_mixext.type),
-+                              u->sink_mixext.type);
-+                pa_log_debug ("  maxval : %d", u->sink_mixext.maxvalue);
-+                pa_log_debug ("  parent : %d", u->sink_mixext.parent);
-+                mixer_showflags (u->sink_mixext.flags);
-+
-+                if ((u->sink_mixext.flags & MIXF_PCMVOL)) {
-+                    pa_log_debug ("First PCM control: %d", i);
-+                    u->mixer_sink_control = i;
-+                    break;
-+                }
-+
-+                /*
-+                 * Note that MIXF_MAINVOL may not be an exclusive single
-+                 * control.  For example on AudioHD there will be one for each
-+                 * output jack (Green, Black, Orange...).  So to really do a
-+                 * master volume you would need to do all MIXF_MAINVOL at the
-+                 * same time...
-+                 */
-+                if (((u->sink_mixext.flags & MIXF_MAINVOL)) &&
-+                      u->mixer_sink_control == -1) {
-+                    pa_log_debug ("First main volume control: %d", i);
-+                    u->mixer_sink_control = i;
-+                }
-+            }
-+
-+            if (u->mixer_sink_control != -1) {
-+                pa_log_debug ("Setting OSS sink callbacks.");
-+                pa_sink_set_get_volume_callback(u->sink, sink_get_volume);
-+                pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
-+                u->sink->n_volume_steps = 101;
-+                do_close = FALSE;
-+            } else {
-+                pa_log_debug ("Not setting OSS sink callbacks.");
-+            }
-+
-+            for (i=0; i < mi.nrext; i++) {
-+                memset (&(u->source_mixext), 0, sizeof (oss_mixext));
-+#ifdef IGNORE_DEV
-+                /* This will cause dev to be ignored */
-+                u->source_mixext.dev = -1;
-+#else
-+                u->source_mixext.dev = mi.dev;
-+#endif
-+                /*
-+                 * The real way to pick a control on a mixer is with this
-+                 * number.  Note that control numbers are unique across all
-+                 * mixers.  So dev can just be ignored.  When dev is included
-+                 * it will only be used to check for correct dev from userland.
-+                 * But it will not be used to select a mixer.
-+                 */
-+                u->source_mixext.ctrl = i;
-+
-+                pa_log_debug ("Control %d", u->source_mixext.ctrl);
-+
-+                if (ioctl (u->mixer_dsp_fd, SNDCTL_MIX_EXTINFO,
-+                         &(u->source_mixext)) == -1) {
-+                    pa_log_debug ("SNDCTL_MIX_EXTINFO failed");
-+                    continue;
-+                }
-+
-+                pa_log_debug ("  name   : %s", u->source_mixext.extname);
-+                pa_log_debug ("  type   : %s (%d)",
-+                              mixer_ext_type_get_name (u->source_mixext.type),
-+                              u->source_mixext.type);
-+                pa_log_debug ("  maxval : %d", u->source_mixext.maxvalue);
-+                pa_log_debug ("  parent : %d", u->source_mixext.parent);
-+                mixer_showflags (u->source_mixext.flags);
-+
-+                /*
-+                 * There may be more then one MIXF_RECVOL on a mixer.  In fact
-+                 * for audioHD the can be three (line-in, mix-in, and cd-in).
-+                 * For a master gain it may be good to adjust all...
-+                 */
-+                if ((u->source_mixext.flags & MIXF_RECVOL)) {
-+                    pa_log_debug ("First REC control: %d", i);
-+                    u->mixer_source_control = i;
-+                    break;
-+                }
-+            }
-+
-+            if (u->mixer_source_control != -1) {
-+                pa_log_debug ("Setting OSS source callbacks.");
-+                pa_source_set_get_volume_callback(u->source, source_get_volume);
-+                pa_source_set_set_volume_callback(u->source, source_set_volume);
-+                u->source->n_volume_steps = 101;
-+                do_close = FALSE;
-+            } else {
-+                pa_log_debug ("Not setting OSS source callbacks.");
-+            }
-+
-+            if (do_close == TRUE) {
-+                pa_close(u->mixer_dsp_fd);
-+                u->mixer_dsp_fd = -1;
-+            }
-+        }
-+
-+#else
-         if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &u->mixer_devmask) < 0)
-             pa_log_warn("SOUND_MIXER_READ_DEVMASK failed: %s", pa_cstrerror(errno));
-         else {
-@@ -1435,11 +1800,14 @@ int pa__init(pa_module*m) {
-                 do_close = FALSE;
-             }
-         }
-+#endif
- 
-         if (do_close) {
-             pa_close(u->mixer_fd);
-             u->mixer_fd = -1;
-+#ifndef HAVE_OSSV4
-             u->mixer_devmask = 0;
-+#endif
-         }
-     }
- 
-@@ -1558,6 +1926,10 @@ void pa__done(pa_module*m) {
-     if (u->fd >= 0)
-         pa_close(u->fd);
- 
-+#ifdef HAVE_OSSV4
-+    if (u->mixer_dsp_fd >= 0)
-+        pa_close(u->mixer_dsp_fd);
-+#endif
-     if (u->mixer_fd >= 0)
-         pa_close(u->mixer_fd);
- 
---- pulseaudio-1.1/src/modules/oss/oss-util.c-orig	2011-12-08 16:37:16.783601951 -0600
-+++ pulseaudio-1.1/src/modules/oss/oss-util.c	2011-12-13 03:50:37.757290581 -0600
-@@ -257,6 +257,190 @@ int pa_oss_set_fragments(int fd, int nfr
-     return 0;
- }
- 
-+#ifdef HAVE_OSSV4
-+static int
-+oss4_mixer_slider_pack_volume (oss_mixext *mixext, int channels, const pa_cvolume *volume)
-+{
-+  int val  = 0;
-+  int lvol = 0;
-+  int rvol = 0;
-+  int lval = 0;
-+  int rval = 0;
-+
-+  switch (mixext->type) {
-+    case MIXT_MONOSLIDER:
-+    case MIXT_MONOSLIDER16:
-+    case MIXT_SLIDER:
-+      lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
-+      val = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
-+      break;
-+
-+    case MIXT_STEREOSLIDER:
-+      lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
-+      lval = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
-+      if (channels >= 2) {
-+          rvol = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
-+          rval = (rvol*mixext->maxvalue)/PA_VOLUME_NORM;
-+      }
-+     
-+      val = ((rval & 0xff) << 8) | (lval & 0xff);
-+      break;
-+
-+    case MIXT_STEREOSLIDER16:
-+      lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
-+      lval = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
-+      if (channels >= 2) {
-+          rvol = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
-+          rval = (rvol*mixext->maxvalue)/PA_VOLUME_NORM;
-+      }
-+
-+      val = ((rval & 0xffff) << 16) | (lval & 0xffff);
-+
-+      break;
-+
-+    default:
-+      return 0;
-+  }
-+
-+  return val;
-+}
-+
-+static void
-+oss4_mixer_slider_unpack_volume (oss_mixext *mixext, int v, pa_cvolume * volume)
-+{
-+  uint32_t val, vol;
-+
-+  val = (uint32_t) v;
-+  switch (mixext->type) {
-+    case MIXT_SLIDER:
-+      vol = val;
-+      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      if (volume->channels >= 2) {
-+          volume->values[1] = volume->values[0];
-+      }
-+      break;
-+    case MIXT_MONOSLIDER:
-+      /* oss repeats the value in the upper bits, as if it was stereo */
-+      vol = val & 0x00ff;
-+      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      if (volume->channels >= 2) {
-+          volume->values[1] = volume->values[0];
-+      }
-+      break;
-+    case MIXT_MONOSLIDER16:
-+      /* oss repeats the value in the upper bits, as if it was stereo */
-+      vol = val & 0x0000ffff;
-+      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      if (volume->channels >= 2) {
-+          volume->values[1] = volume->values[0];
-+      }
-+      break;
-+    case MIXT_STEREOSLIDER:
-+      vol = (val & 0x00ff);
-+      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      if (volume->channels >= 2) {
-+          vol = (val & 0xff00) >> 8;
-+          volume->values[1] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      }
-+      break;
-+    case MIXT_STEREOSLIDER16:
-+      vol = (val & 0x0000ffff);
-+      volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      if (volume->channels >= 2) {
-+          vol = (val & 0xffff0000) >> 16;
-+          volume->values[1] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
-+      }
-+      break;
-+    default:
-+      return;
-+  }
-+}
-+
-+static int
-+oss4_mixer_get_control_val (int fd, oss_mixext *mixext, int *val)
-+{
-+  oss_mixer_value ossval = { 0, };
-+
-+  /* ossval.dev = mixext->dev; */
-+  ossval.dev = -1;		/* if -1 on entry then is ignored */
-+  /*
-+   * The real way to pick a control on a mixer is with this number.
-+   * Note that control numbers are uniq across all mixers. So dev
-+   * can just be ignored. When dev is included it will only be used
-+   * to check for correct dev from userland. But it will not be used
-+   * to select a mixer.
-+   */
-+  ossval.ctrl = mixext->ctrl;
-+  ossval.timestamp = mixext->timestamp;
-+
-+  if (ioctl (fd, SNDCTL_MIX_READ, &ossval) == -1) {
-+    pa_log_debug ("SNDCTL_MIX_READ failed");
-+    *val = 0;
-+    return -1;
-+  }
-+
-+  *val = ossval.value;
-+  pa_log_debug ("got value 0x%08x from %s", *val, mixext->extname);
-+  return 0;
-+}
-+
-+static int
-+oss4_mixer_set_control_val (int fd, oss_mixext *mixext, int val)
-+{
-+  oss_mixer_value ossval = { 0, };
-+
-+  /* ossval.dev = mixext->dev; */
-+  ossval.dev = -1;		/* if -1 on entry then is ignored */
-+  /*
-+   * The real way to pick a control on a mixer is with this number.
-+   * Note that control numbers are uniq across all mixers. So dev
-+   * can just be ignored. When dev is included it will only be used
-+   * to check for correct dev from userland. But it will not be used
-+   * to select a mixer.
-+   */
-+  ossval.ctrl = mixext->ctrl;
-+  ossval.timestamp = mixext->timestamp;
-+  ossval.value = val;
-+
-+  if (ioctl (fd, SNDCTL_MIX_WRITE, &ossval) == -1) {
-+    pa_log_debug ("SNDCTL_MIX_WRITE failed");
-+    return -1;
-+  }
-+
-+  pa_log_debug ("set value 0x%08x on %s", val, mixext->extname);
-+  return 0;
-+}
-+
-+int pa_oss_get_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, pa_cvolume *volume) {
-+  int v = 0;
-+
-+  if (oss4_mixer_get_control_val (fd, mixext, &v) != 0) {
-+    pa_log_debug ("Getting volume failed");
-+    return -1;
-+  }
-+
-+  pa_cvolume_reset(volume, ss->channels);
-+
-+  oss4_mixer_slider_unpack_volume (mixext, v, volume);
-+
-+  return 0;
-+}
-+
-+int pa_oss_set_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, const pa_cvolume *volume) {
-+  int val = 0;
-+
-+  val = oss4_mixer_slider_pack_volume (mixext, ss->channels, volume);
-+
-+  if (oss4_mixer_set_control_val (fd, mixext, val) != 0) {
-+    pa_log_debug ("Setting volume failed");
-+    return -1;
-+  }
-+
-+  return 0;
-+}
-+
-+#else
-+
- int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume) {
-     char cv[PA_CVOLUME_SNPRINT_MAX];
-     unsigned vol;
-@@ -299,6 +483,7 @@ int pa_oss_set_volume(int fd, unsigned l
-     pa_log_debug("Wrote mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume));
-     return 0;
- }
-+#endif
- 
- static int get_device_number(const char *dev) {
-     const char *p, *e;
-@@ -397,9 +582,11 @@ int pa_oss_get_hw_description(const char
-     return r;
- }
- 
--static int open_mixer(const char *mixer) {
-+int pa_oss_open_mixer(const char *mixer) {
-     int fd;
- 
-+    pa_log_debug ("Opening device %s", mixer);
-+
-     if ((fd = pa_open_cloexec(mixer, O_RDWR|O_NDELAY, 0)) >= 0)
-         return fd;
- 
-@@ -411,19 +598,22 @@ int pa_oss_open_mixer_for_device(const c
-     char *fn;
-     int fd;
- 
--    if ((n = get_device_number(device)) < 0)
-+    if ((n = get_device_number(device)) < 0) {
-+        pa_log_debug ("Cannot find device");
-         return -1;
-+    }
- 
-     if (n == 0)
--        if ((fd = open_mixer("/dev/mixer")) >= 0)
-+        if ((fd = pa_oss_open_mixer("/dev/mixer")) >= 0)
-             return fd;
- 
-     fn = pa_sprintf_malloc("/dev/mixer%i", n);
--    fd = open_mixer(fn);
-+    fd = pa_oss_open_mixer(fn);
-     pa_xfree(fn);
- 
-     if (fd < 0)
-         pa_log_warn("Failed to open mixer '%s': %s", device, pa_cstrerror(errno));
-+    else
- 
-     return fd;
- }
---- pulseaudio-1.1/src/modules/oss/oss-util.h-orig	2011-12-05 22:39:30.119276863 -0600
-+++ pulseaudio-1.1/src/modules/oss/oss-util.h	2011-12-13 01:22:45.351928881 -0600
-@@ -31,11 +31,21 @@ int pa_oss_auto_format(int fd, pa_sample
- 
- int pa_oss_set_fragments(int fd, int frags, int frag_size);
- 
-+#define HAVE_OSSV4
-+
-+#ifdef HAVE_OSSV4
-+int pa_oss_set_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, const pa_cvolume *volume);
-+int pa_oss_get_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, pa_cvolume *volume);
-+
-+#else
-+
- int pa_oss_set_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, const pa_cvolume *volume);
- int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume);
-+#endif
- 
- int pa_oss_get_hw_description(const char *dev, char *name, size_t l);
- 
- int pa_oss_open_mixer_for_device(const char *device);
-+int pa_oss_open_mixer(const char *device);
- 
- #endif
--- a/specs/SUNWpulseaudio.spec	Tue Apr 24 06:46:40 2012 +0000
+++ b/specs/SUNWpulseaudio.spec	Fri Apr 27 13:46:26 2012 +0000
@@ -9,10 +9,6 @@
 #
 # bugdb: www.pulseaudio.org/report/
 #
-# Note that PulseAudio has build and runtime requirements on the newer version
-# 2.2.6b of libtool, so this module builds and uses its own private copy.  This
-# should be removed when libtool is updated in Solaris to a newer version.
-#
 %define owner yippi
 #
 %include Solaris.inc
@@ -95,19 +91,13 @@
 
 export SOLARIS_PULSE_ARGS="--disable-avahi"
 
-# Set LD_LIBRARY_PATH so the new version of libtool gets used.
-export LD_LIBRARY_PATH="%{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs"
-
-export SOLARIS_PULSE_CPPFLAGS="-xc99 -I%{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl"
-export SOLARIS_PULSE_CFLAGS="%optflags64 -xc99 -I%{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl"
-
 # Need to add -Wl,-z,now and -Wl,-z-nodelete and remove -Wl,-zignore for
 # PulseAudio to build.
 #
 %if %debug_build
-export SOLARIS_PULSE_LDFLAGS="-Wl,-z,now -Wl,-z,nodelete -R/usr/lib/pulse-%{version} -L%{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs %{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so -lxnet -lsocket -lgobject-2.0"
+export SOLARIS_PULSE_LDFLAGS="-Wl,-z,now -Wl,-z,nodelete -lxnet -lsocket -lgobject-2.0"
 %else
-export SOLARIS_PULSE_LDFLAGS="-Wl,-zcombreloc -Wl,-Bdirect -Wl,-z,now -Wl,-z,nodelete -R/usr/lib/pulse-%{version} -L%{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs %{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so -lxnet -lsocket -lgobject-2.0"
+export SOLARIS_PULSE_LDFLAGS="-Wl,-zcombreloc -Wl,-Bdirect -Wl,-z,now -Wl,-z,nodelete -lxnet -lsocket -lgobject-2.0"
 %endif
 
 %pulseaudio64.build -d %name-%version/%_arch64
@@ -117,16 +107,10 @@
 #
 export SOLARIS_PULSE_ARGS=""
 
-# Set LD_LIBRARY_PATH so the new version of libtool gets used.
-export LD_LIBRARY_PATH="%{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs"
-
-export SOLARIS_PULSE_CPPFLAGS="-xc99 -I%{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl"
-export SOLARIS_PULSE_CFLAGS="%optflags -xc99 -I%{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl"
-
 %if %debug_build
-export SOLARIS_PULSE_LDFLAGS="-Wl,-z,now -Wl,-z,nodelete -R/usr/lib/pulse-%{version} -L%{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs %{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so -lxnet -lsocket -lgobject-2.0"
+export SOLARIS_PULSE_LDFLAGS="-Wl,-z,now -Wl,-z,nodelete -lxnet -lsocket -lgobject-2.0"
 %else
-export SOLARIS_PULSE_LDFLAGS="-Wl,-zcombreloc -Wl,-Bdirect -Wl,-z,now -Wl,-z,nodelete -R/usr/lib/pulse-%{version} -L%{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs %{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so -lxnet -lsocket -lgobject-2.0"
+export SOLARIS_PULSE_LDFLAGS="-Wl,-zcombreloc -Wl,-Bdirect -Wl,-z,now -Wl,-z,nodelete -lxnet -lsocket -lgobject-2.0"
 %endif
 
 %pulseaudio.build -d %name-%version/%{base_arch}
@@ -136,16 +120,10 @@
 
 %ifarch amd64 sparcv9
 %pulseaudio64.install -d %name-%version/%_arch64
-
-cp %{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so $RPM_BUILD_ROOT%{_libdir}/%_arch64/pulse-%{version}
-cp %{_builddir}/%name-%version/%_arch64/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so.7 $RPM_BUILD_ROOT%{_libdir}/%_arch64/pulse-%{version}
 %endif
 
 %pulseaudio.install -d %name-%version/%{base_arch}
 
-cp %{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so $RPM_BUILD_ROOT%{_libdir}/pulse-%{version}
-cp %{_builddir}/%name-%version/%{base_arch}/pulseaudio-%version/libtool-2.2.6b/libltdl/.libs/libltdl.so.7 $RPM_BUILD_ROOT%{_libdir}/pulse-%{version}
-
 # Remove .la and .a file as we do not ship them.
 find $RPM_BUILD_ROOT -name "*.la" -exec rm {} \;
 find $RPM_BUILD_ROOT -name "*.a" -exec rm {} \;
@@ -234,15 +212,10 @@
 %files l10n
 %defattr (-, root, bin)
 %dir %attr (0755, root, sys) %{_datadir}
-%dir %attr (0755, root, other) %{_datadir}/gnome
 %attr (-, root, other) %{_datadir}/locale
-%{_datadir}/gnome/*help/*/[a-z]*
-%{_datadir}/omf/gdm/*-[a-z]*.omf
 %endif
 
 %changelog
-* Mon Feb 27 2012 - Brian Cameron  <[email protected]>
-- Provide preserve tag for files installed to /etc/pulse.
 * Sun Oct 02 2011 - Brian Cameron  <[email protected]>
 - Bump to 1.0.
 * Tue Sep 28 2011 - Brian Cameron  <[email protected]>