This commit is contained in:
fewtarius 2022-11-20 14:41:15 -05:00
commit c83e5f7a6f
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
15 changed files with 317 additions and 8 deletions

92
licenses/FDK-AAC.txt Normal file
View file

@ -0,0 +1,92 @@
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
scheme for digital audio. This FDK AAC Codec software is intended to be used on
a wide variety of Android devices.
AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
general perceptual audio codecs. AAC-ELD is considered the best-performing
full-bandwidth communications codec by independent studies and is widely
deployed. AAC has been standardized by ISO and IEC as part of the MPEG
specifications.
Patent licenses for necessary patent claims for the FDK AAC Codec (including
those of Fraunhofer) may be obtained through Via Licensing
(www.vialicensing.com) or through the respective patent owners individually for
the purpose of encoding or decoding bit streams in products that are compliant
with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
Android devices already license these patent claims through Via Licensing or
directly from the patent owners, and therefore FDK AAC Codec software may
already be covered under those patent licenses when it is used for those
licensed purposes only.
Commercially-licensed AAC software libraries, including floating-point versions
with enhanced sound quality, are also available from Fraunhofer. Users are
encouraged to check the Fraunhofer website for additional applications
information and documentation.
2. COPYRIGHT LICENSE
Redistribution and use in source and binary forms, with or without modification,
are permitted without payment of copyright license fees provided that you
satisfy the following conditions:
You must retain the complete text of this software license in redistributions of
the FDK AAC Codec or your modifications thereto in source code form.
You must retain the complete text of this software license in the documentation
and/or other materials provided with redistributions of the FDK AAC Codec or
your modifications thereto in binary form. You must make available free of
charge copies of the complete source code of the FDK AAC Codec and your
modifications thereto to recipients of copies in binary form.
The name of Fraunhofer may not be used to endorse or promote products derived
from this library without prior written permission.
You may not charge copyright license fees for anyone to use, copy or distribute
the FDK AAC Codec software or your modifications thereto.
Your modified versions of the FDK AAC Codec must carry prominent notices stating
that you changed the software and the date of any change. For modified versions
of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
AAC Codec Library for Android."
3. NO PATENT LICENSE
NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
Fraunhofer provides no warranty of patent non-infringement with respect to this
software.
You may use this FDK AAC Codec software or modifications thereto only for
purposes that are authorized by appropriate patent licenses.
4. DISCLAIMER
This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
including but not limited to the implied warranties of merchantability and
fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS 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), arising in any way out of the use of
this software, even if advised of the possibility of such damage.
5. CONTACT INFORMATION
Fraunhofer Institute for Integrated Circuits IIS
Attention: Audio and Multimedia Departments - FDK AAC LL
Am Wolfsmantel 33
91058 Erlangen, Germany
www.iis.fraunhofer.de/amm
amm-info@iis.fraunhofer.de

View file

@ -0,0 +1 @@
BLUEALSA_ARGS="-p a2dp-source -p a2dp-sink -c aptx -c aac -c ldac --ldac-quality=standard --ldac-abr"

View file

@ -0,0 +1,42 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022-present Marek Moeckel (wansti@discarded-ideas.org)
PKG_NAME="bluez-alsa"
PKG_VERSION="4.0.0"
PKG_SHA256="ce5e060e61669d61d44f5f9bad34a7b88378376e9d49d31482406a68127a6b29"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/Arkq/bluez-alsa"
PKG_URL="https://github.com/Arkq/bluez-alsa/archive/refs/tags/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain alsa-lib bluez sbc dbus libopenaptx fdk-aac libldac"
PKG_LONGDESC="Bluetooth audio ALSA backend"
PKG_TOOLCHAIN="autotools"
if build_with_debug; then
PKG_BLUEALSA_DEBUG=--with-debug
fi
PKG_CONFIGURE_OPTS_TARGET="${PKG_BLUEALSA_DEBUG} \
--enable-aptx \
--with-libopenaptx \
--enable-aac \
--enable-ldac \
--enable-upower \
--enable-a2dpconf \
--enable-cli \
--enable-systemd"
post_makeinstall_target() {
mkdir -p ${INSTALL}/usr/share/services
cp -P ${PKG_DIR}/default.d/*.conf ${INSTALL}/usr/share/services/
cp -P ${PKG_DIR}/system.d/*.service ${INSTALL}/usr/lib/systemd/system/
# workaround until I figure out how to query this directory
mkdir -p ${INSTALL}/usr/lib/alsa-lib
cp -P ${PKG_BUILD}/.*/src/asound/.libs/*.so ${INSTALL}/usr/lib/alsa-lib/
sed -i ${INSTALL}/etc/dbus-1/system.d/bluealsa.conf -e "s|audio|root|g"
rm -rf ${INSTALL}/home
}
post_install() {
enable_service bluealsa.service
enable_service bluealsa-defaults.service
}

View file

@ -0,0 +1,11 @@
[Unit]
Description=Bluealsa defaults
After=local-fs.target
ConditionPathExists=!/storage/.cache/services/bluealsa.conf
ConditionPathExists=!/storage/.cache/services/bluealsa.disabled
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'cp /usr/share/services/bluealsa.conf /storage/.cache/services/'
RemainAfterExit=yes

View file

@ -0,0 +1,53 @@
[Unit]
Description=BlueALSA service
Documentation=man:bluealsa(8)
Requisite=dbus.service
After=bluetooth.service bluealsa-defaults.service
Requires=bluealsa-defaults.service
ConditionPathExists=/storage/.cache/services/bluealsa.conf
# In order to customize BlueALSA D-Bus service one should create an override
# for this systemd unit file. Please note, that in the override file one will
# have to explicitly clear the ExecStart before setting it again. See the
# bluez-alsa wiki for more options.
#
# $ sudo systemctl edit bluealsa
# [Service]
# ExecStart=
# ExecStart=/usr/bin/bluealsa -p a2dp-source -p a2dp-sink -c aptx -c aac -c ldac
[Service]
Type=dbus
BusName=org.bluealsa
EnvironmentFile=/storage/.cache/services/bluealsa.conf
ExecStart=/usr/bin/bluealsa $BLUEALSA_ARGS
Restart=on-failure
# Sandboxing
CapabilityBoundingSet=
IPAddressDeny=any
LockPersonality=true
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
PrivateUsers=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict
RestrictAddressFamilies=AF_UNIX AF_BLUETOOTH
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
SystemCallErrorNumber=EPERM
SystemCallFilter=@system-service
SystemCallFilter=~@resources @privileged
UMask=0077
[Install]
WantedBy=bluetooth.target

View file

@ -0,0 +1,20 @@
# SPDX-License-Identifier: FDK-AAC
# Copyright (C) 2022-present Marek Moeckel (wansti@discarded-ideas.org)
PKG_NAME="fdk-aac"
PKG_VERSION="2.0.2"
PKG_SHA256="7812b4f0cf66acda0d0fe4302545339517e702af7674dd04e5fe22a5ade16a90"
PKG_LICENSE="Software License for The Fraunhofer FDK AAC Codec Library for Android"
PKG_SITE="https://github.com/mstorsjo/fdk-aac"
PKG_URL="https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="AAC bluetooth audio codec"
PKG_TOOLCHAIN="autotools"
#PKG_CONFIGURE_OPTS_TARGET=""
post_makeinstall_target() {
cp -P -r ${INSTALL}/usr/lib/* ${SYSROOT_PREFIX}/usr/lib/
cp -P -r ${INSTALL}/usr/include/* ${SYSROOT_PREFIX}/usr/include/
rm -rf ${INSTALL}/usr/lib/pkgconfig
}

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2022-present Marek Moeckel (wansti@discarded-ideas.org)
PKG_NAME="libldac"
PKG_VERSION="fbffba45d15d959da6ee04eafe14c0d4721f6030"
PKG_LICENSE="Apache2"
PKG_SITE="https://github.com/EHfive/ldacBT"
PKG_URL="${PKG_SITE}.git"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="LDAC bluetooth audio codec"
PKG_TOOLCHAIN="cmake-make"
GET_HANDLER_SUPPORT="git"
post_makeinstall_target() {
cp -P -r ${INSTALL}/usr/lib/* ${SYSROOT_PREFIX}/usr/lib/
cp -P -r ${INSTALL}/usr/include/* ${SYSROOT_PREFIX}/usr/include/
rm -rf ${INSTALL}/usr/lib/pkgconfig
}

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2022-present Marek Moeckel (wansti@discarded-ideas.org)
PKG_NAME="libopenaptx"
PKG_VERSION="0.2.1"
PKG_SHA256="f13eac1ebfe31a563943cd47819eece1109960e10a1e85c111975bcfd37d5361"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/pali/libopenaptx"
PKG_URL="https://github.com/pali/libopenaptx/releases/download/${PKG_VERSION}/libopenaptx-${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="AptX bluetooth audio codec"
PKG_TOOLCHAIN="make"
post_makeinstall_target() {
cp -P -r ${INSTALL}/usr/local/lib/* ${SYSROOT_PREFIX}/usr/lib/
cp -P -r ${INSTALL}/usr/local/include/* ${SYSROOT_PREFIX}/usr/include/
rm -rf ${INSTALL}/usr/local/lib/pkgconfig
}

View file

@ -140,6 +140,8 @@ EOF
then
cp ${PKG_DIR}/sources/asound/${DEVICE}/* ${INSTALL}/usr/config/
fi
cp ${PKG_DIR}/sources/asound/asound.conf.bluealsa ${INSTALL}/usr/config/
sed -i "s#@DEVICENAME@#${DEVICE}#g" ${INSTALL}/usr/config/system/configs/system.cfg

View file

@ -0,0 +1,12 @@
pcm.!default {
type asym
capture.pcm cards.pcm.default
playback.pcm bluealsa
hint.description "Bluetooth Audio Device"
}
# Leave mixer at default card for now
ctl.!default {
type hw
card 0
}

View file

@ -4,6 +4,17 @@
. /etc/profile
### REMINDER: This needs to be refactored or it will break audio on other devices.
# Revert to default when bluetooth was still selected at last shutdown.
# This is a workaround - headsets that auto-connect at boot tend to be
# unreliable, so for now it's better to force a manual reconnect.
#LAST_AUDIO_DEVICE=$(set-audio get)
#if [[ "${LAST_AUDIO_DEVICE}" =~ ^Device.* ]]
#then
# set-audio set "DEFAULT (SYSTEM PROVIDED)"
# set-audio esset "DEFAULT (SYSTEM PROVIDED)"
#fi
if [ ! -e "/storage/.config/asound.conf" ]
then
set-audio set "DEFAULT (SYSTEM PROVIDED)"

View file

@ -63,7 +63,7 @@ def connect_device(path, address, properties, forceConnect, typeInput, typeAudio
logging.info("Skipping device {} (no type)".format(getDevName(rproperties)));
return
if not ( (typeInput and properties["Icon"].startswith("input")) or (typeAudio and properties["Icon"].startswith("audio-card")) ):
if not ( (typeInput and properties["Icon"].startswith("input")) or (typeAudio and properties["Icon"].startswith("audio")) ):
logging.info("Skipping device {} because of type {}".format(getDevName(rproperties), properties["Icon"]));
return

32
packages/jelos/sources/scripts/set-audio Executable file → Normal file
View file

@ -8,7 +8,13 @@ ES_SETTINGS="/storage/.config/emulationstation/es_settings.cfg"
function list_audio_controls() {
IFS=""
CONTROLS=$(amixer controls | sed -e 's#^.*name=##g' -e "s#'##g")
ACTIVE_DEVICE=$(get_audio_device)
if [[ "${ACTIVE_DEVICE}" =~ ^Device.* ]]
then
CONTROLS=$(amixer -D bluealsa controls | sed -e 's#^.*name=##g' -e "s#'##g")
else
CONTROLS=$(amixer controls | sed -e 's#^.*name=##g' -e "s#'##g")
fi
echo "DEFAULT (SYSTEM PROVIDED)"
echo "CUSTOM (UNMANAGED)"
for CONTROL in "${CONTROLS[@]}"
@ -27,6 +33,16 @@ function list_audio_devices() {
echo "DEFAULT HDMI"
echo "CUSTOM (UNMANAGED)"
echo "--------"
BTACTIVE=$(systemctl is-active bluetooth)
if [ "${BTACTIVE}" == "active" ]
then
BTDEVICES=$(bluetoothctl paired-devices)
while read -r BTDEV
do
echo "${BTDEV}"
done <<< "${BTDEVICES}"
echo "--------"
fi
for SDEVICE in $(find /proc/asound/card*/pcm*/info)
do
TYPE=$(awk '/^stream:/ {print $2}' ${SDEVICE})
@ -47,7 +63,7 @@ function set_audio_device() {
then
if [ "$(get_setting system.rg353v)" = "1" ]
then
cp /usr/config/asound.conf.RG353V /storage/.config
cp /usr/config/asound.conf.RG353V /storage/.config/asound.conf
exit 0
else
if [ -e "/usr/config/asound.conf" ]
@ -66,6 +82,18 @@ function set_audio_device() {
elif [ "${SELECTION}" == "CUSTOM (UNMANAGED)" ]
then
exit 0
elif [[ "${SELECTION}" =~ ^Device.* ]]
then
MAC=$(echo "${SELECTION}" | awk '/^Device/ {print $2}')
# Reconnect device in case it auto-connected.
# This doesn't seem necessary anymore, re-activate in case of issues.
# bluetoothctl disconnect ${MAC}
if bluetoothctl connect ${MAC}
then
cp /usr/config/asound.conf.bluealsa /storage/.config/asound.conf
set_es_path "DEFAULT (SYSTEM PROVIDED)"
fi
exit 0
else
if [ "${SELECTION}" == "--------" ]
then

View file

@ -23,7 +23,7 @@ BLUEZ_CONFIG+=" --enable-monitor --enable-test"
PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \
--disable-silent-rules \
--disable-library \
--enable-library \
--enable-udev \
--disable-cups \
--disable-obex \
@ -69,9 +69,10 @@ post_makeinstall_target() {
# bluez looks in /etc/firmware/
ln -sf /usr/lib/firmware ${INSTALL}/etc/firmware
# pulseaudio checks for bluez via pkgconfig but lib is not actually needed
sed -i 's/-lbluetooth//g' ${PKG_BUILD}/lib/bluez.pc
# libbluetooth required for bluez-alsa
# sed -i 's/-lbluetooth//g' ${PKG_BUILD}/lib/bluez.pc
cp -P ${PKG_BUILD}/lib/bluez.pc ${SYSROOT_PREFIX}/usr/lib/pkgconfig
cp -P -r ${PKG_BUILD}/lib/bluetooth ${SYSROOT_PREFIX}/usr/include/
}
post_install() {

View file

@ -6,6 +6,6 @@ PKG_VERSION=""
PKG_LICENSE="GPL"
PKG_SITE="http://www.alsa-project.org/"
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain alsa-lib alsa-utils"
PKG_DEPENDS_TARGET="toolchain alsa-lib alsa-utils bluez-alsa"
PKG_SECTION="virtual"
PKG_LONGDESC="Matapackage to install all alsa components."
PKG_LONGDESC="Metapackage to install all alsa components."