From cead7b7f71c0da2d3615d972b673bf26c547aa10 Mon Sep 17 00:00:00 2001 From: khronosschoty Date: Fri, 27 Apr 2018 20:47:27 +0700 Subject: libraries/bluez-alsa: Added (Bluetooth Audio ALSA Backend). Signed-off-by: Willy Sudiarto Raharjo --- libraries/bluez-alsa/README | 11 ++ libraries/bluez-alsa/bluez-alsa.SlackBuild | 106 +++++++++++++++ libraries/bluez-alsa/bluez-alsa.info | 10 ++ libraries/bluez-alsa/ortp.patch | 199 +++++++++++++++++++++++++++++ libraries/bluez-alsa/slack-desc | 19 +++ 5 files changed, 345 insertions(+) create mode 100644 libraries/bluez-alsa/README create mode 100644 libraries/bluez-alsa/bluez-alsa.SlackBuild create mode 100644 libraries/bluez-alsa/bluez-alsa.info create mode 100644 libraries/bluez-alsa/ortp.patch create mode 100644 libraries/bluez-alsa/slack-desc (limited to 'libraries/bluez-alsa') diff --git a/libraries/bluez-alsa/README b/libraries/bluez-alsa/README new file mode 100644 index 000000000000..1370e14a635e --- /dev/null +++ b/libraries/bluez-alsa/README @@ -0,0 +1,11 @@ +bluez-alsa (Bluetooth Audio ALSA Backend) + +This project is a rebirth of a direct integration between Bluez and ALSA. +Since Bluez >= 5, the build-in integration has been removed in favor of 3rd +party audio applications. From now on, Bluez acts as a middleware between an +audio application, which implements Bluetooth audio profile, and a Bluetooth +audio device. + +Note: you might want to "start" "/usr/bin/bluealsa" via rc.local -- in example +add the following line to rc.local: +/usr/bin/bluealsa & diff --git a/libraries/bluez-alsa/bluez-alsa.SlackBuild b/libraries/bluez-alsa/bluez-alsa.SlackBuild new file mode 100644 index 000000000000..80c5294a78f6 --- /dev/null +++ b/libraries/bluez-alsa/bluez-alsa.SlackBuild @@ -0,0 +1,106 @@ +#!/bin/sh + +# Slackware build script for bluez-alsa + +# Copyright 2018 Vasily Sora USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=bluez-alsa +VERSION=${VERSION:-1.2.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +patch -p2 < $CWD/ortp.patch + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +autoreconf --install +mkdir build && cd build +../configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --disable-payloadcheck \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +cd .. +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + README.md \ + $PKG/usr/share/alsa/alsa.conf.d/20-bluealsa.conf \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/libraries/bluez-alsa/bluez-alsa.info b/libraries/bluez-alsa/bluez-alsa.info new file mode 100644 index 000000000000..134b9c2e0489 --- /dev/null +++ b/libraries/bluez-alsa/bluez-alsa.info @@ -0,0 +1,10 @@ +PRGNAM="bluez-alsa" +VERSION="1.2.0" +HOMEPAGE="https://github.com/Arkq/bluez-alsa" +DOWNLOAD="https://github.com/Arkq/bluez-alsa/archive/v1.2.0/bluez-alsa-1.2.0.tar.gz" +MD5SUM="7a6710f4c6d693417fc09db61b1b2cdb" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="khronosschoty" +EMAIL="khronosschoty@posteo.org" diff --git a/libraries/bluez-alsa/ortp.patch b/libraries/bluez-alsa/ortp.patch new file mode 100644 index 000000000000..7286d261a303 --- /dev/null +++ b/libraries/bluez-alsa/ortp.patch @@ -0,0 +1,199 @@ +*** a/bluez-alsa-1.2.0/README.md 2017-04-13 13:50:39.000000000 -0700 +--- b/bluez-alsa-1.2.0/README.md 2018-04-26 13:33:35.943544513 -0700 +*************** +*** 23,28 **** +--- 23,36 ---- + $ autoreconf --install + $ mkdir build && cd build + $ ../configure --enable-aac --enable-debug ++ ++ or if you intend to stream audio from a Linux distribution using PulseAudio (see [this ++ issue](https://github.com/Arkq/bluez-alsa/issues/13)) ++ ++ $ ../configure --enable-aac --enable-debug --disable-payloadcheck ++ ++ then ++ + $ make && make install + + Dependencies: +*************** +*** 31,44 **** + - [bluez](http://www.bluez.org/) >= 5.0 + - [glib](https://wiki.gnome.org/Projects/GLib) with GIO support + - [sbc](https://git.kernel.org/cgit/bluetooth/sbc.git) +- - [ortp](http://www.linphone.org/technical-corner/ortp.html) (required for compilation only) + - [fdk-aac](https://github.com/mstorsjo/fdk-aac) (when AAC support is enabled with `--enable-aac`) + +! Dependencies for `hcitop` (unless `--disable-hcitop` is specified during configuration): + + - [libbsd](https://libbsd.freedesktop.org/) + - [ncurses](https://www.gnu.org/software/ncurses/) + + + Configuration & Usage + --------------------- +--- 39,54 ---- + - [bluez](http://www.bluez.org/) >= 5.0 + - [glib](https://wiki.gnome.org/Projects/GLib) with GIO support + - [sbc](https://git.kernel.org/cgit/bluetooth/sbc.git) + - [fdk-aac](https://github.com/mstorsjo/fdk-aac) (when AAC support is enabled with `--enable-aac`) + +! Dependencies for `hcitop` (when `--enable-hcitop` is specified during configuration): + + - [libbsd](https://libbsd.freedesktop.org/) + - [ncurses](https://www.gnu.org/software/ncurses/) + ++ If you are using Debian-based distribution, take a look at the [.travis.yml](.travis.yml) file, ++ it might give you a hint about required packages. ++ + + Configuration & Usage + --------------------- +*************** +*** 100,107 **** + alongside, but Bluetooth support has to be disabled in the PulseAudio. Any Bluetooth related + module has to be unloaded - e.g. `bluetooth-discover`, `bluez5-discover`. + +- See also [this](https://github.com/Arkq/bluez-alsa/issues/13) PulseAudio related issue. +- + 2. ALSA thread-safe API (alsa-lib >= 1.1.2). + + Starting from ALSA library 1.1.2, it is possible to enable thread-safe API functions. It is a +--- 110,115 ---- +*** a/bluez-alsa-1.2.0/configure.ac 2017-04-13 13:50:39.000000000 -0700 +--- b/bluez-alsa-1.2.0/configure.ac 2018-04-26 13:30:55.692862106 -0700 +*************** +*** 34,41 **** + + AC_CHECK_LIB([pthread], [pthread_create], + [], [AC_MSG_ERROR([pthread library not found])]) +- AC_CHECK_HEADERS([ortp/rtp.h], +- [], [AC_MSG_ERROR([ortp/rtp.h header not found])]) + AC_SEARCH_LIBS([clock_gettime], [rt], + [], [AC_MSG_ERROR([unable to find clock_gettime() function])]) + AC_SEARCH_LIBS([pow], [m], +--- 34,39 ---- +*************** +*** 57,74 **** + AC_DEFINE([ENABLE_AAC], [1], [Define to 1 if AAC is enabled.]) + ]) + + AC_ARG_ENABLE([aplay], +! [AS_HELP_STRING([--disable-aplay], [disable building of aplay tool])]) + AM_CONDITIONAL([ENABLE_APLAY], [test "x$enable_aplay" != "xno"]) + + AC_ARG_ENABLE([hcitop], +! [AS_HELP_STRING([--disable-hcitop], [disable building of hcitop tool])]) +! AM_CONDITIONAL([ENABLE_HCITOP], [test "x$enable_hcitop" != "xno"]) + AM_COND_IF([ENABLE_HCITOP], [ + PKG_CHECK_MODULES([LIBBSD], [libbsd]) + PKG_CHECK_MODULES([NCURSES], [ncurses]) + ]) + + AC_ARG_WITH([alsaplugindir], + AS_HELP_STRING([--with-alsaplugindir=dir], [path where ALSA plugin files are stored]), + [alsaplugindir="$withval"], [alsaplugindir="$libdir/alsa-lib"]) +--- 55,85 ---- + AC_DEFINE([ENABLE_AAC], [1], [Define to 1 if AAC is enabled.]) + ]) + ++ AC_ARG_ENABLE([payloadcheck], ++ [AS_HELP_STRING([--disable-payloadcheck], [disable RTP payload type check (workaround for a PulseAudio bug)])]) ++ AM_CONDITIONAL([ENABLE_PAYLOADCHECK], [test "x$enable_payloadcheck" != "xno"]) ++ AM_COND_IF([ENABLE_PAYLOADCHECK], [ ++ AC_DEFINE([ENABLE_PAYLOADCHECK], [1], [Define to 1 if PAYLOADCHECK is enabled.]) ++ ]) ++ + AC_ARG_ENABLE([aplay], +! [AS_HELP_STRING([--disable-aplay], [disable building of bluealsa-aplay tool])]) + AM_CONDITIONAL([ENABLE_APLAY], [test "x$enable_aplay" != "xno"]) + + AC_ARG_ENABLE([hcitop], +! [AS_HELP_STRING([--enable-hcitop], [enable building of hcitop tool])]) +! AM_CONDITIONAL([ENABLE_HCITOP], [test "x$enable_hcitop" = "xyes"]) + AM_COND_IF([ENABLE_HCITOP], [ + PKG_CHECK_MODULES([LIBBSD], [libbsd]) + PKG_CHECK_MODULES([NCURSES], [ncurses]) + ]) + ++ # Since it is not possible to specify custom ALSA plugin directory, BlueALSA ++ # PCM plugin has to be installed prior to this test. ++ AC_ARG_ENABLE([pcm-test], ++ [AS_HELP_STRING([--enable-pcm-test], [enable PCM plugin test])]) ++ AM_CONDITIONAL([ENABLE_PCM_TEST], [test "x$enable_pcm_test" = "xyes"]) ++ + AC_ARG_WITH([alsaplugindir], + AS_HELP_STRING([--with-alsaplugindir=dir], [path where ALSA plugin files are stored]), + [alsaplugindir="$withval"], [alsaplugindir="$libdir/alsa-lib"]) +*** a/bluez-alsa-1.2.0/src/a2dp-rtp.h 2017-04-13 13:50:39.000000000 -0700 +--- b/bluez-alsa-1.2.0/src/a2dp-rtp.h 2018-04-26 13:31:29.385585082 -0700 +*************** +*** 1,6 **** + /* + * BlueALSA - a2dp-rtp.h +! * Copyright (c) 2016 Arkadiusz Bokowy + * + * This file is a part of bluez-alsa. + * +--- 1,6 ---- + /* + * BlueALSA - a2dp-rtp.h +! * Copyright (c) 2016-2017 Arkadiusz Bokowy + * + * This file is a part of bluez-alsa. + * +*************** +*** 12,18 **** + #define BLUEALSA_A2DPRTP_H_ + + #include +! #include + + /** + * Media payload header for SBC. */ +--- 12,39 ---- + #define BLUEALSA_A2DPRTP_H_ + + #include +! +! typedef struct rtp_header { +! #if __BYTE_ORDER == __LITTLE_ENDIAN +! uint16_t cc:4; +! uint16_t extbit:1; +! uint16_t padbit:1; +! uint16_t version:2; +! uint16_t paytype:7; +! uint16_t markbit:1; +! #else +! uint16_t version:2; +! uint16_t padbit:1; +! uint16_t extbit:1; +! uint16_t cc:4; +! uint16_t markbit:1; +! uint16_t paytype:7; +! #endif +! uint16_t seq_number; +! uint32_t timestamp; +! uint32_t ssrc; +! uint32_t csrc[16]; +! } __attribute__ ((packed)) rtp_header_t; + + /** + * Media payload header for SBC. */ +*** a/bluez-alsa-1.2.0/test/inc/a2dp.inc 2017-04-13 13:50:39.000000000 -0700 +--- b/bluez-alsa-1.2.0/test/inc/a2dp.inc 2018-04-26 13:34:28.586111682 -0700 +*************** +*** 10,16 **** +--- 10,20 ---- + * + */ + ++ #include + #include ++ #include ++ #include ++ #include + #include + #include "../src/a2dp-codecs.h" + #include "../src/a2dp-rtp.h" diff --git a/libraries/bluez-alsa/slack-desc b/libraries/bluez-alsa/slack-desc new file mode 100644 index 000000000000..5eda3e2d1fc4 --- /dev/null +++ b/libraries/bluez-alsa/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +bluez-alsa: bluez-alsa (Bluetooth Audio ALSA Backend) +bluez-alsa: +bluez-alsa: Bluetooth audio alsa backend, which removesPulseAudio as a +bluez-alsa: dependency in Bluez >=5. BlueALSA registers all known Bluetooth +bluez-alsa: audio profiles in Bluez, so in theory every Bluetooth device (with +bluez-alsa: audio capabilities) can be connected. In order to access the audio +bluez-alsa: stream, one has to connect to the ALSA PCM device called bluealsa. +bluez-alsa: +bluez-alsa: +bluez-alsa: https://github.com/Arkq/bluez-alsa +bluez-alsa: -- cgit v1.2.3