Kodi Community Forum

Full Version: Pulseaudio support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm currently running Arch Linux on my Raspberry Pi. I set up pulseaudio with a tunnel-sink to stream audio over the network. However, the build I was using did not seem to care about ALSA or pulseaudio at all and played audio directly over the analog output. After some digging around I found out that my build was compiled with the --disable-pulse flag set (I've attached the PKGBUILD below). So I recompiled with --enable-pulse but still no luck. In contrast to PC builds of XBMC there does not seem to be a way to choose the audio device in system -> audio settings. This option is lacking in my build.

How can I force XBMC to use pulseaudio? Am I missing any further ./configure flags I need to tweak?

Cheers
Peter



Code:
# Contributor tomasgroth at yahoo.dk
# Contributor WarheadsSE <[email protected]>
pkgname=xbmc-rbp-git
pkgver=20121125
pkgrel=1
buildarch=16

pkgdesc="A software media player and entertainment hub for digital media for the Raspberry Pi"
arch=('armv6h')
url="http://xbmc.org"
license=('GPL' 'custom')
depends=('hicolor-icon-theme' 'fribidi' 'lzo2' 'smbclient' 'libtiff' 'libva' 'libpng' 'libcdio' 'yajl' 'libmysqlclient' 'libjpeg-turbo' 'libsamplerate' 'libssh' 'libmicrohttpd' 'sdl_image' 'python2' 'libass' 'libmpeg2' 'libmad' 'libmodplug' 'jasper' 'rtmpdump' 'unzip' 'xorg-xdpyinfo' 'libbluray' 'libnfs' 'afpfs-ng' 'libshairport' 'avahi' 'bluez' 'tinyxml' 'raspberrypi-firmware' 'libcec-rpi' 'libplist' 'swig' 'taglib' 'ffmpeg')

makedepends=('boost' 'cmake' 'gperf' 'nasm' 'zip' 'udisks' 'upower' 'bluez' 'git' 'autoconf' 'openjdk6')
optdepends=(
  'lirc: remote controller support'
  'udisks: automount external drives'
  'upower: used to trigger suspend functionality'
  'unrar: access compressed files without unpacking them'
)
source=(xbmc-ae04d99-321-texturepacker-hostflags-and-rework.patch)

md5sums=('fc6a925a09ba1b13d84daf1121b42ab9')

_gitroot="git://github.com/xbmc"
_gitname="xbmc"

_prefix=/usr

build() {
  cd "${srcdir}"

  msg2 "Connecting to GIT server..."
  if [[ -d "${_gitname}" ]]; then
    cd "${_gitname}" && git pull origin
    msg2 "The local files are updated."
  else
    git clone --depth 1 "${_gitroot}/${_gitname}"
  fi
  msg2 "GIT checkout done or server timeout."

  cd "${srcdir}/${_gitname}"

  # fix lsb_release dependency
  sed -i -e 's:/usr/bin/lsb_release -d:cat /etc/arch-release:' xbmc/utils/SystemInfo.cpp

  # Patch to fix TexturePacker build.
  patch -i ${srcdir}/xbmc-ae04d99-321-texturepacker-hostflags-and-rework.patch -p1

  # Bootstrapping XBMC
  ./bootstrap

  # Configuring XBMC
  export PYTHON_VERSION=2  # external python v2
  # we need to compile for armv6 instead of armv5 to avoid problems compiling assembler code
  export CFLAGS="-O3 -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -mabi=aapcs-linux -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -I/opt/vc/include/ -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads"
  export CXXFLAGS="-O3 -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -mabi=aapcs-linux -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -I/opt/vc/include/ -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads"
  export LDFLAGS="$LDFLAGS -L/opt/vc/lib"
#  export MAKEFLAGS="-j1"
  ./configure --prefix=$_prefix --exec-prefix=$_prefix  \
  --enable-gles --disable-sdl --disable-x11 --disable-xrandr --disable-openmax \
  --disable-optical-drive --disable-dvdcss --disable-joystick --disable-debug \
  --disable-crystalhd --disable-vtbdecoder --disable-vaapi --disable-vdpau \
  --disable-pulse --disable-projectm --with-platform=raspberry-pi --enable-optimizations \
  --enable-libcec --enable-player=omxplayer --enable-external-ffmpeg

  make
}
package() {
  cd "${srcdir}/${_gitname}"
  # Running make install
  make DESTDIR="${pkgdir}" install

  # run feh with python2
  sed -i -e 's/python/python2/g' ${pkgdir}${_prefix}/bin/xbmc

  # Remove checks that doesn't apply to the raspberry pi
  head -n 171 "${pkgdir}${_prefix}/share/xbmc/FEH.py" > "${pkgdir}${_prefix}/share/xbmc/FEH.py.new"
  mv "${pkgdir}${_prefix}/share/xbmc/FEH.py.new"  "${pkgdir}${_prefix}/share/xbmc/FEH.py"

  # lsb_release fix
  sed -i -e 's/which lsb_release > \/dev\/null/\[ -f \/etc\/arch-release ]/g' "${pkgdir}${_prefix}/bin/xbmc"
  sed -i -e "s/lsb_release -a 2> \/dev\/null | sed -e 's\/\^\/    \/'/cat \/etc\/arch-release/g" "${pkgdir}${_prefix}/bin/xbmc"

  # Tools
  install -D -m 0755 "${srcdir}/${_gitname}/tools/TexturePacker/TexturePacker" "${pkgdir}${_prefix}/share/xbmc/"

  # Licenses
  install -d -m 0755 "${pkgdir}${_prefix}/share/licenses/${pkgname}"
  for licensef in LICENSE.GPL copying.txt; do
    mv "${pkgdir}${_prefix}/share/doc/xbmc/${licensef}" "${pkgdir}${_prefix}/share/licenses/${pkgname}"
  done

  # Create lib links
  mkdir -p "${pkgdir}"/etc/ld.so.conf.d/

  # ensure we can load libs
  echo "/opt/vc/lib/" > "${pkgdir}"/etc/ld.so.conf.d/xbmc-rbp-git.conf
}
XBMC on the RaspberryPI doesn't support pulseaudio or alsa.
Go to this post to learn more about using pulse within XBMC on the PI
http://forum.stmlabs.com/showthread.php?tid=1052
(2012-11-29, 18:54)bac522 Wrote: [ -> ]Go to this post to learn more about using pulse within XBMC on the PI
http://forum.stmlabs.com/showthread.php?tid=1052

If nobody told you, i'm the RaspberryPI XBMC developper. So i know pretty sure what our official source can do and not. What you show is an external patch which doesn't belong to xbmc master.
(2012-11-29, 16:11)gimli Wrote: [ -> ]XBMC on the RaspberryPI doesn't support pulseaudio or alsa.

Am I assuming correctly that the rbp build uses a different/modified AudioEngine and directly accesses the sound module? (As it doesn't care whether snd_bcm2835 is loaded or not)
Is this due to hardware limitations?

(2012-11-29, 19:37)master-sonic Wrote: [ -> ]
(2012-11-29, 16:11)gimli Wrote: [ -> ]XBMC on the RaspberryPI doesn't support pulseaudio or alsa.

Am I assuming correctly that the rbp build uses a different/modified AudioEngine and directly accesses the sound module? (As it doesn't care whether snd_bcm2835 is loaded or not)
Is this due to hardware limitations?

You asume wrong. XBMC on the PI doesn't use AE at all.
Patches for the player to use AudioEngine would be nice though, it really ought to use it if possible.
(2012-11-29, 22:27)topfs2 Wrote: [ -> ]Patches for the player to use AudioEngine would be nice though, it really ought to use it if possible.

Not on the PI. Pure overkill.
Headless playback on the pi through XBMC will definitely need AE (analogue sound is still troublesome at the moment)

I am no expert in AE but would it be possible to have an OMX AE sink or engine so OMXPlayer can hook it up? That will also make it possible to reuse the paplayer code.

@topfs2

On the subject of AE/pulseaudio I noticed couple of bugs:
1) menu sound volume not adjustable
2) only default sink device being used and xbmc gui audio device settings are totally ignored.

I have made some fix. Is there any place to discuss further?
(2012-11-29, 22:50)gimli Wrote: [ -> ]
(2012-11-29, 22:27)topfs2 Wrote: [ -> ]Patches for the player to use AudioEngine would be nice though, it really ought to use it if possible.

Not on the PI. Pure overkill.

Well obviously AE needs to use less resources before venturing that way Smile. But using one audio output for video player and another for GUI and music playback is just plain silly if they _can_ be merged.
Total CPU usage for pi is about 50% when playing back FLAC music using AE/Pulseaudio + paplayer. Video playback is similar and that's more than acceptable.
(2012-11-30, 09:36)topfs2 Wrote: [ -> ]Well obviously AE needs to use less resources before venturing that way Smile. But using one audio output for video player and another for GUI and music playback is just plain silly if they _can_ be merged.

I agree, but omx player doesn't support gapless playback of audio files yet. Will it ever have it? I am using the June 23 version of OpenElec, which does support gapless audi. It seems like it uses different players for audio and video, but I am not sure.