From 4cc168321b61a2a0e398abeabe21cbafc1cc80a2 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Tue, 11 Oct 2011 15:46:00 +0200 Subject: [PATCH] pulseaudio: rework and setup package 'pulseaudio' Signed-off-by: Stephan Raue --- packages/audio/pulseaudio/build | 21 +-- packages/audio/pulseaudio/config/asound.conf | 13 ++ packages/audio/pulseaudio/config/default.pa | 153 ++++++++++++++++++ .../pulseaudio/config/pcm/samplerate.conf | 11 ++ .../audio/pulseaudio/config/pcm/speex.conf | 11 ++ .../audio/pulseaudio/config/pcm/upmix.conf | 10 ++ .../audio/pulseaudio/config/pcm/vdownmix.conf | 18 +++ .../pulseaudio/config/pulse-default.conf | 35 ++++ packages/audio/pulseaudio/config/system.pa | 62 +++++++ .../audio/pulseaudio/init.d/35_PulseAudio | 32 ++++ packages/audio/pulseaudio/install | 22 ++- packages/audio/pulseaudio/meta | 4 +- 12 files changed, 374 insertions(+), 18 deletions(-) create mode 100644 packages/audio/pulseaudio/config/asound.conf create mode 100644 packages/audio/pulseaudio/config/default.pa create mode 100644 packages/audio/pulseaudio/config/pcm/samplerate.conf create mode 100644 packages/audio/pulseaudio/config/pcm/speex.conf create mode 100644 packages/audio/pulseaudio/config/pcm/upmix.conf create mode 100644 packages/audio/pulseaudio/config/pcm/vdownmix.conf create mode 100644 packages/audio/pulseaudio/config/pulse-default.conf create mode 100644 packages/audio/pulseaudio/config/system.pa create mode 100644 packages/audio/pulseaudio/init.d/35_PulseAudio diff --git a/packages/audio/pulseaudio/build b/packages/audio/pulseaudio/build index e24c25f40f..f26b88e560 100755 --- a/packages/audio/pulseaudio/build +++ b/packages/audio/pulseaudio/build @@ -25,9 +25,6 @@ # pulseaudio fails to build with LTO support strip_lto -# dont build parallel -# MAKEFLAGS=-j1 - if [ "$AVAHI_DAEMON" = yes ]; then PULSEAUDIO_AVAHI="--enable-avahi" else @@ -47,8 +44,8 @@ cd $PKG_BUILD --disable-nls \ --enable-largefile \ --disable-rpath \ - --disable-x11 \ - --disable-samplerate \ + --enable-x11 \ + --enable-samplerate \ --disable-oss-output \ --disable-oss-wrapper \ --disable-coreaudio-output \ @@ -73,13 +70,17 @@ cd $PKG_BUILD --disable-orc \ --disable-manpages \ --disable-per-user-esound-socket \ - --disable-legacy-runtime-dir \ - --disable-legacy-database-entry-format \ - --with-system-user=pulse \ - --with-system-group=pulse \ - --with-access-group=pulse-access \ + --enable-legacy-runtime-dir \ + --enable-legacy-database-entry-format \ + --with-system-user=root \ + --with-system-group=root \ + --with-access-group=root \ --with-module-dir="/usr/lib/pulse" \ +# --with-system-user=pulse \ +# --with-system-group=pulse \ +# --with-access-group=pulse-access \ + # --with-system-user=root \ # --with-system-group=root \ # --with-access-group=root \ diff --git a/packages/audio/pulseaudio/config/asound.conf b/packages/audio/pulseaudio/config/asound.conf new file mode 100644 index 0000000000..9b1d6ea534 --- /dev/null +++ b/packages/audio/pulseaudio/config/asound.conf @@ -0,0 +1,13 @@ +# +# Place your global alsa-lib configuration here... +# + +@hooks [ + { + func load + files [ + "/etc/alsa/pulse-default.conf" + ] + errors false + } +] diff --git a/packages/audio/pulseaudio/config/default.pa b/packages/audio/pulseaudio/config/default.pa new file mode 100644 index 0000000000..431d5e420b --- /dev/null +++ b/packages/audio/pulseaudio/config/default.pa @@ -0,0 +1,153 @@ +#!/usr/bin/pulseaudio -nF +# +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +# This startup script is used only if PulseAudio is started per-user +# (i.e. not in system mode) + +.nofail + +### Load something into the sample cache +#load-sample-lazy x11-bell /usr/share/sounds/gtk-events/activate.wav +#load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav +#load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav +#load-sample-lazy pulse-access /usr/share/sounds/generic.wav + +.fail + +### Automatically restore the volume of streams and devices +load-module module-device-restore +load-module module-stream-restore +load-module module-card-restore + +### Automatically augment property information from .desktop files +### stored in /usr/share/application +load-module module-augment-properties + +### Load audio drivers statically +### (it's probably better to not load these drivers manually, but instead +### use module-udev-detect -- see below -- for doing this automatically) +load-module module-alsa-sink device=hw:1,7 +#load-module module-alsa-sink +#load-module module-alsa-source device=hw:1,0 +#load-module module-null-sink +#load-module module-pipe-sink + +### Automatically load driver modules depending on the hardware available +.ifexists module-udev-detect.so +load-module module-udev-detect +.else +### Use the static hardware detection module (for systems that lack udev/hal support) +load-module module-detect +.endif + +### Automatically connect sink and source if JACK server is present +.ifexists module-jackdbus-detect.so +load-module module-jackdbus-detect +.endif + + +### Load several protocols +.ifexists module-esound-protocol-unix.so +load-module module-esound-protocol-unix +.endif +load-module module-native-protocol-unix + +### Network access (may be configured with paprefs, so leave this commented +### here if you plan to use paprefs) +#load-module module-esound-protocol-tcp +#load-module module-native-protocol-tcp +#load-module module-zeroconf-publish + +### Load the RTP receiver module (also configured via paprefs, see above) +#load-module module-rtp-recv + +### Load the RTP sender module (also configured via paprefs, see above) +#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'" +#load-module module-rtp-send source=rtp.monitor + +### Load additional modules from GConf settings. This can be configured with the paprefs tool. +### Please keep in mind that the modules configured by paprefs might conflict with manually +### loaded modules. +.ifexists module-gconf.so +.nofail +load-module module-gconf +.fail +.endif + +### Automatically restore the default sink/source when changed by the user +### during runtime +### NOTE: This should be loaded as early as possible so that subsequent modules +### that look up the default sink/source get the right value +load-module module-default-device-restore + +### Automatically move streams to the default sink if the sink they are +### connected to dies, similar for sources +load-module module-rescue-streams + +### Make sure we always have a sink around, even if it is a null sink. +load-module module-always-sink + +### Honour intended role device property +load-module module-intended-roles + +### Automatically suspend sinks/sources that become idle for too long +load-module module-suspend-on-idle + +### If autoexit on idle is enabled we want to make sure we only quit +### when no local session needs us anymore. +.ifexists module-console-kit.so +load-module module-console-kit +.endif + +### Enable positioned event sounds +load-module module-position-event-sounds + +### Cork music streams when a phone stream is active +load-module module-cork-music-on-phone + +### Modules to allow autoloading of filters (such as echo cancellation) +### on demand. module-filter-heuristics tries to determine what filters +### make sense, and module-filter-apply does the heavy-lifting of +### loading modules and rerouting streams. +load-module module-filter-heuristics +load-module module-filter-apply + +### Load DBus protocol +.ifexists module-dbus-protocol.so +load-module module-dbus-protocol +.endif + +# X11 modules should not be started from default.pa so that one daemon +# can be shared by multiple sessions. + +### Load X11 bell module +#load-module module-x11-bell sample=bell-windowing-system + +### Register ourselves in the X11 session manager +load-module module-x11-xsmp + +### Publish connection data in the X11 root window +.ifexists module-x11-publish.so +.nofail +load-module module-x11-publish +.fail +.endif + +### Make some devices default +#set-default-sink output +#set-default-source input diff --git a/packages/audio/pulseaudio/config/pcm/samplerate.conf b/packages/audio/pulseaudio/config/pcm/samplerate.conf new file mode 100644 index 0000000000..8bf7b9a21f --- /dev/null +++ b/packages/audio/pulseaudio/config/pcm/samplerate.conf @@ -0,0 +1,11 @@ +# samplerate plugin configuration +# $Id: samplerate.conf,v 1.2 2008/03/09 15:50:49 lkundrak Exp $ + +pcm.my_rate { + type rate + slave.pcm "hw" + converter "samplerate" + hint { + description "External rate converter" + } +} diff --git a/packages/audio/pulseaudio/config/pcm/speex.conf b/packages/audio/pulseaudio/config/pcm/speex.conf new file mode 100644 index 0000000000..c4f23e3b4f --- /dev/null +++ b/packages/audio/pulseaudio/config/pcm/speex.conf @@ -0,0 +1,11 @@ +# samplerate plugin configuration +# $Id$ + +pcm.my_rate { + type rate + slave.pcm "hw" + converter "speexrate" + hint { + description "Rate Converter Plugin Using Speex Resampler" + } +} diff --git a/packages/audio/pulseaudio/config/pcm/upmix.conf b/packages/audio/pulseaudio/config/pcm/upmix.conf new file mode 100644 index 0000000000..e15055e1ea --- /dev/null +++ b/packages/audio/pulseaudio/config/pcm/upmix.conf @@ -0,0 +1,10 @@ +# upmix plugin configuration +# $Id: upmix.conf,v 1.2 2008/03/09 15:50:49 lkundrak Exp $ + +pcm.upmix51 { + type upmix + slave.pcm "surround51" + hint { + description "Upmixer channel expander" + } +} diff --git a/packages/audio/pulseaudio/config/pcm/vdownmix.conf b/packages/audio/pulseaudio/config/pcm/vdownmix.conf new file mode 100644 index 0000000000..95786b8a66 --- /dev/null +++ b/packages/audio/pulseaudio/config/pcm/vdownmix.conf @@ -0,0 +1,18 @@ +# vdownmix plugin configuration +# $Id$ + +pcm.!surround51 { + type vdownmix + slave.pcm "default" + hint { + description "Downmixer to stereo from surround51" + } +} + +pcm.!surround40 { + type vdownmix + slave.pcm "default" + hint { + description "Downmixer to stereo from surround40" + } +} diff --git a/packages/audio/pulseaudio/config/pulse-default.conf b/packages/audio/pulseaudio/config/pulse-default.conf new file mode 100644 index 0000000000..a84bede025 --- /dev/null +++ b/packages/audio/pulseaudio/config/pulse-default.conf @@ -0,0 +1,35 @@ +# PulseAudio plugin configuration +# $Id$ + +# Let's create a virtual device "pulse" for mixer and PCM + +pcm.pulse { + type pulse + hint { + description "PulseAudio Sound Server" + } +} + +ctl.pulse { + type pulse + hint { + description "PulseAudio Sound Server" + } +} + +# Let's make it the default! + +pcm.!default { + type pulse + hint { + description "Default" + } +} + +ctl.!default { + type pulse + hint { + description "Default" + } +} + diff --git a/packages/audio/pulseaudio/config/system.pa b/packages/audio/pulseaudio/config/system.pa new file mode 100644 index 0000000000..e389e0582f --- /dev/null +++ b/packages/audio/pulseaudio/config/system.pa @@ -0,0 +1,62 @@ +#!/usr/bin/pulseaudio -nF +# +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +# This startup script is used only if PulseAudio is started in system +# mode. + +### Automatically load driver modules depending on the hardware available +.ifexists module-udev-detect.so +load-module module-udev-detect +.else +### Use the static hardware detection module (for systems that lack udev/hal support) +load-module module-detect +.endif + +### Load several protocols +.ifexists module-esound-protocol-unix.so +load-module module-esound-protocol-unix +.endif +load-module module-native-protocol-unix + +### Automatically restore the volume of streams and devices +load-module module-stream-restore +load-module module-device-restore + +### Automatically restore the default sink/source when changed by the user +### during runtime +### NOTE: This should be loaded as early as possible so that subsequent modules +### that look up the default sink/source get the right value +load-module module-default-device-restore + +.ifexists module-dbus-protocol.so +### If you want to allow TCP connections, set access to "remote" or "local,remote". +load-module module-dbus-protocol access=local +.endif + +### Automatically move streams to the default sink if the sink they are +### connected to dies, similar for sources +load-module module-rescue-streams + +### Make sure we always have a sink around, even if it is a null sink. +load-module module-always-sink + +### Automatically suspend sinks/sources that become idle for too long +load-module module-suspend-on-idle + +### Enable positioned event sounds +load-module module-position-event-sounds diff --git a/packages/audio/pulseaudio/init.d/35_PulseAudio b/packages/audio/pulseaudio/init.d/35_PulseAudio new file mode 100644 index 0000000000..0b4f058936 --- /dev/null +++ b/packages/audio/pulseaudio/init.d/35_PulseAudio @@ -0,0 +1,32 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +# start PulseAudio daemon +# +# runlevels: openelec, textmode + +progress "starting PulseAudio daemon" + pulseaudio --system \ + --daemonize \ + --log-target=file:/var/log/pulseaudio.log \ + --log-level=debug >/dev/null 2>&1 + +# --disallow-exit \ +# --disallow-module-loading \ diff --git a/packages/audio/pulseaudio/install b/packages/audio/pulseaudio/install index a50853cd39..ecd8c6e0f4 100755 --- a/packages/audio/pulseaudio/install +++ b/packages/audio/pulseaudio/install @@ -2,19 +2,28 @@ . config/options $1 -add_user pulse x 499 498 "PulseAudio System Daemon" "/var/run/pulse" "/bin/sh" -add_group pulse 498 -add_group pulse-access 497 +# add_user pulse x 499 498 "PulseAudio System Daemon" "/var/run/pulse" "/bin/sh" +# add_group pulse 498 +# add_group pulse-access 497 mkdir -p $INSTALL/etc/dbus-1/system.d cp $PKG_BUILD/src/daemon/pulseaudio-system.conf $INSTALL/etc/dbus-1/system.d -# sed -e 's%user="pulse"%user="root"%g' -i $INSTALL/etc/dbus-1/system.d/pulseaudio-system.conf + sed -e 's%user="pulse"%user="root"%g' -i $INSTALL/etc/dbus-1/system.d/pulseaudio-system.conf + +mkdir -p $INSTALL/etc + cp $PKG_DIR/config/asound.conf $INSTALL/etc + +mkdir -p $INSTALL/etc/alsa + cp $PKG_DIR/config/pulse-default.conf $INSTALL/etc/alsa + +mkdir -p $INSTALL/etc/alsa/pcm + cp -R $PKG_DIR/config/pcm/*.conf $INSTALL/etc/alsa/pcm mkdir -p $INSTALL/etc/pulse cp $PKG_BUILD/src/client.conf $INSTALL/etc/pulse cp $PKG_BUILD/src/daemon.conf $INSTALL/etc/pulse - cp $PKG_BUILD/src/default.pa $INSTALL/etc/pulse -# cp $PKG_DIR/config/default.pa $INSTALL/etc/pulse +# cp $PKG_BUILD/src/default.pa $INSTALL/etc/pulse + cp $PKG_DIR/config/default.pa $INSTALL/etc/pulse cp $PKG_BUILD/src/system.pa $INSTALL/etc/pulse mkdir -p $INSTALL/lib/udev/rules.d @@ -29,6 +38,7 @@ mkdir -p $INSTALL/usr/bin ln -sf pactl $INSTALL/usr/bin/parec ln -sf pactl $INSTALL/usr/bin/parecord cp $PKG_BUILD/src/.libs/pasuspender $INSTALL/usr/bin + cp $PKG_BUILD/src/.libs/pax11publish $INSTALL/usr/bin cp $PKG_BUILD/src/.libs/pulseaudio $INSTALL/usr/bin # cp $PKG_BUILD/src/start-pulseaudio-x11 $INSTALL/usr/bin diff --git a/packages/audio/pulseaudio/meta b/packages/audio/pulseaudio/meta index 7973ff9b26..7f9c630ae8 100644 --- a/packages/audio/pulseaudio/meta +++ b/packages/audio/pulseaudio/meta @@ -25,8 +25,8 @@ PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://pulseaudio.org/" PKG_URL="http://freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS="libtool json-c alsa-lib libsndfile speex dbus udev openssl" -PKG_BUILD_DEPENDS="toolchain libtool json-c alsa-lib libsndfile speex dbus udev openssl" +PKG_DEPENDS="libtool json-c alsa-lib libsndfile libsamplerate speex dbus udev openssl" +PKG_BUILD_DEPENDS="toolchain libtool json-c alsa-lib libsndfile libsamplerate speex dbus udev openssl" PKG_PRIORITY="optional" PKG_SECTION="audio" PKG_SHORTDESC="pulseaudio: Yet another sound server for Unix"