🐶 Sync 2025-11-02 14:26:26
This commit is contained in:
129
airplay2/Makefile
Normal file
129
airplay2/Makefile
Normal file
@@ -0,0 +1,129 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
# updated to work with latest source from abrasive
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=airplay2
|
||||
PKG_VERSION:=4.3.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=shairport-sync-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/mikebrady/shairport-sync/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=a1242d100b61fe1fffbbf706e919ed51d6a341c9fb8293fb42046e32ae2b3338
|
||||
|
||||
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
|
||||
Mike Brady <mikebrady@eircom.net>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYING LICENSES shairport.c
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/shairport-sync-$(PKG_VERSION)
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/airplay2/default
|
||||
SECTION:=sound
|
||||
CATEGORY:=Sound
|
||||
TITLE:=AirPlay compatible audio player
|
||||
DEPENDS:=@AUDIO_SUPPORT +libpthread +alsa-lib +libconfig +libdaemon +libpopt +libplist +libsodium +libgcrypt +libffmpeg-full +libuuid +nqptp +libmosquitto
|
||||
PROVIDES:=airplay2
|
||||
URL:=https://github.com/mikebrady/shairport-sync
|
||||
endef
|
||||
|
||||
define Package/airplay2-openssl
|
||||
$(Package/airplay2/default)
|
||||
TITLE+= (openssl)
|
||||
DEPENDS+= +libopenssl +libavahi-client +libsoxr
|
||||
VARIANT:=openssl
|
||||
endef
|
||||
|
||||
define Package/airplay2-mbedtls
|
||||
$(Package/airplay2/default)
|
||||
TITLE+= (mbed TLS)
|
||||
DEPENDS+= +libmbedtls +libavahi-client +libsoxr
|
||||
VARIANT:=mbedtls
|
||||
DEFAULT_VARIANT:=1
|
||||
endef
|
||||
|
||||
define Package/airplay2-mini
|
||||
$(Package/airplay2/default)
|
||||
TITLE+= (minimal)
|
||||
DEPENDS+= +libmbedtls
|
||||
VARIANT:=mini
|
||||
endef
|
||||
|
||||
define Package/airplay2/default/description
|
||||
Shairport Sync plays audio from iTunes and AirPlay sources, including
|
||||
iOS devices, Quicktime Player and third party sources such as forkedDaapd.
|
||||
Audio played by a Shairport Sync-powered device stays synchronised with the source
|
||||
and hence with similar devices playing the same source.
|
||||
|
||||
Shairport Sync does not support AirPlay video or photo streaming.
|
||||
Ensure Kernel Modules > Sound Support > kmod-sound-core is selected.
|
||||
Also select kmod-usb-audio if you want to use USB-connected sound cards.
|
||||
endef
|
||||
Package/airplay2-openssl/description = $(Package/airplay2/default/description)
|
||||
Package/airplay2-mbedtls/description = $(Package/airplay2/default/description)
|
||||
|
||||
define Package/airplay2-mini/description
|
||||
$(Package/airplay2/default/description)
|
||||
|
||||
Minimal version uses mbed TLS and does not include libsoxr and avahi support.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -std=gnu17
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--with-alsa \
|
||||
--with-libdaemon \
|
||||
--with-airplay-2 \
|
||||
--with-pipe \
|
||||
--with-mqtt-client \
|
||||
--with-metadata
|
||||
|
||||
ifeq ($(BUILD_VARIANT),openssl)
|
||||
CONFIGURE_ARGS+= --with-ssl=openssl
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),mbedtls)
|
||||
CONFIGURE_ARGS+= --with-ssl=mbedtls
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),mini)
|
||||
CONFIGURE_ARGS+= --with-ssl=mbedtls --with-tinysvcmdns
|
||||
else
|
||||
CONFIGURE_ARGS+= --with-avahi --with-soxr
|
||||
endif
|
||||
|
||||
TARGET_LDFLAGS += -Wl,--as-needed
|
||||
|
||||
define Package/airplay2/default/conffiles
|
||||
/etc/config/airplay2
|
||||
endef
|
||||
|
||||
Package/airplay2-openssl/conffiles = $(Package/airplay2/default/conffiles)
|
||||
Package/airplay2-mbedtls/conffiles = $(Package/airplay2/default/conffiles)
|
||||
Package/airplay2-mini/conffiles = $(Package/airplay2/default/conffiles)
|
||||
|
||||
define Package/airplay2/default/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/shairport-sync $(1)/usr/bin/airplay2
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/airplay2.init $(1)/etc/init.d/airplay2
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/airplay2.config $(1)/etc/config/airplay2
|
||||
endef
|
||||
|
||||
Package/airplay2-openssl/install = $(Package/airplay2/default/install)
|
||||
Package/airplay2-mbedtls/install = $(Package/airplay2/default/install)
|
||||
Package/airplay2-mini/install = $(Package/airplay2/default/install)
|
||||
|
||||
$(eval $(call BuildPackage,airplay2-openssl))
|
||||
$(eval $(call BuildPackage,airplay2-mbedtls))
|
||||
$(eval $(call BuildPackage,airplay2-mini))
|
||||
73
airplay2/files/airplay2.config
Normal file
73
airplay2/files/airplay2.config
Normal file
@@ -0,0 +1,73 @@
|
||||
config airplay2
|
||||
option enabled '0'
|
||||
option respawn '1'
|
||||
# General
|
||||
option name 'AirPlay2-%v-%h'
|
||||
option password ''
|
||||
option interpolation 'basic' # basic/soxr
|
||||
option output_backend '' # alsa/pipe/stdout/ao/dummy/pulse/sndio
|
||||
option mdns_backend '' # avahi/external-avahi/dns-sd/external-dns-sd/tinysvcmdns
|
||||
option port '5050' # 5000
|
||||
option udp_port_base '6001' # 6001
|
||||
option udp_port_range '100' # 100
|
||||
option statistics '' # no/yes - DEPRECATED: This option will be removed in a future release. Use 'diagnostics_statistics' instead
|
||||
option drift '' # 88
|
||||
option resync_threshold '' # 2205
|
||||
option log_verbosity '' # 0/1/2/3 - DEPRECATED: This option will be removed in a future release. Use 'diagnostics_log_verbosity' instead
|
||||
option ignore_volume_control '' # no/yes
|
||||
option volume_range_db '' # 30 to 150
|
||||
option regtype '' # _raop._tcp
|
||||
option playback_mode '' # stereo/mono
|
||||
# Metadata
|
||||
option metadata_enabled '' # no/yes
|
||||
option metadata_cover_art '' # no/yes
|
||||
option metadata_pipe_name '' # /tmp/shairport-sync-metadata
|
||||
option metadata_pipe_timeout '' # 5000
|
||||
option metadata_socket_address '' # 226.0.0.1
|
||||
option metadata_socket_port '' # 5555
|
||||
option metadata_socket_msglength # 65000
|
||||
# Session Control
|
||||
option sesctl_run_before_play_begins '' # /etc/shairport-sync-start.sh
|
||||
option sesctl_run_after_play_ends '' # /etc/shairport-sync-stop.sh
|
||||
option sesctl_run_before_entering_active_state '' # /path/to/script.sh
|
||||
option sesctl_run_after_exiting_active_state '' # /path/to/script.sh
|
||||
option sesctl_run_if_an_unfixable_error_is_detected '' # /path/to/script.sh
|
||||
option sesctl_run_when_volume_is_set '' # /path/to/script.sh
|
||||
option sesctl_wait_for_completion '' # no/yes
|
||||
option sesctl_session_interruption 'no' # no/yes
|
||||
option sesctl_session_timeout '120' # 120
|
||||
# ALSA
|
||||
option alsa_output_device '' # default
|
||||
option alsa_mixer_control_name 'PCM' # PCM
|
||||
option alsa_mixer_device '' # default
|
||||
option alsa_latency_offset '' # 0
|
||||
option alsa_output_rate 'auto'
|
||||
option alsa_buffer_length '6615' # 6615
|
||||
option alsa_disable_synchronization '' # no/yes
|
||||
option alsa_period_size '' # number
|
||||
option alsa_buffer_size '' # number
|
||||
# Pipe
|
||||
option pipe_name '' # /tmp/shairport-sync-audio
|
||||
option pipe_latency_offset '' # 0
|
||||
option pipe_buffer_length '' # 44100
|
||||
# Stdout
|
||||
option stdout_latency_offset '' # 0
|
||||
option stdout_buffer_length '' # 44100
|
||||
# MQTT: https://github.com/mikebrady/shairport-sync/blob/master/MQTT.md
|
||||
option mqtt_enabled 'no'
|
||||
option mqtt_hostname '127.0.0.1'
|
||||
option mqtt_port '1883'
|
||||
option mqtt_username '' # empty = no authentication
|
||||
option mqtt_password '' # empty = no authentication
|
||||
option mqtt_topic 'shairport'
|
||||
option mqtt_publish_raw 'no'
|
||||
option mqtt_publish_parsed 'no'
|
||||
option mqtt_publish_cover 'no'
|
||||
option mqtt_enable_remote 'no'
|
||||
# AO
|
||||
option ao_latency_offset '' # 0
|
||||
option ao_buffer_length '' # 44100
|
||||
# Diagnostics
|
||||
option diagnostics_statistics '' # no/yes
|
||||
option diagnostics_log_output_to '' # syslog/stderr/stdout
|
||||
option diagnostics_log_verbosity '' # 0/1/2/3
|
||||
182
airplay2/files/airplay2.init
Executable file
182
airplay2/files/airplay2.init
Executable file
@@ -0,0 +1,182 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
append_num() {
|
||||
local cfg="$1"
|
||||
local var="$2"
|
||||
local opt="$3"
|
||||
local def="$4"
|
||||
local val
|
||||
|
||||
config_get val "$cfg" "$var"
|
||||
if [ -n "$val" ] || [ -n "$def" ]; then
|
||||
printf "\t%s = ${val:-$def};\n" "$opt"
|
||||
fi
|
||||
}
|
||||
|
||||
append_str() {
|
||||
local cfg="$1"
|
||||
local var="$2"
|
||||
local opt="$3"
|
||||
local def="$4"
|
||||
local val
|
||||
|
||||
config_get val "$cfg" "$var"
|
||||
if [ -n "$val" ] || [ -n "$def" ]; then
|
||||
printf "\t%s = \"%s\";\n" "$opt" "${val:-$def}"
|
||||
fi
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local cfg=$1
|
||||
local conf_custom conf_file aux
|
||||
|
||||
config_get_bool aux "$cfg" 'enabled' '0'
|
||||
[ "$aux" = 0 ] && return 1
|
||||
|
||||
config_get_bool conf_custom "$cfg" 'conf_custom' '0'
|
||||
config_get conf_file "$cfg" "conf_file"
|
||||
[ "$conf_custom" -ne 1 ] && [ -z "$conf_file" ] && {
|
||||
mkdir -p /var/etc
|
||||
conf_file="/var/etc/airplay2-${cfg}.conf"
|
||||
} && {
|
||||
printf "// Automatically generated from UCI config\n\n"
|
||||
|
||||
# General
|
||||
printf "general =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" name "name"
|
||||
append_str "$cfg" password "password"
|
||||
append_str "$cfg" interpolation "interpolation"
|
||||
append_str "$cfg" output_backend "output_backend"
|
||||
append_str "$cfg" mdns_backend "mdns_backend"
|
||||
append_num "$cfg" port "port"
|
||||
append_num "$cfg" udp_port_base "udp_port_base"
|
||||
append_num "$cfg" udp_port_range "udp_port_range"
|
||||
append_num "$cfg" drift "drift"
|
||||
append_num "$cfg" resync_threshold "resync_threshold"
|
||||
append_str "$cfg" ignore_volume_control "ignore_volume_control"
|
||||
append_num "$cfg" volume_range_db "volume_range_db"
|
||||
append_str "$cfg" regtype "regtype"
|
||||
append_str "$cfg" playback_mode "playback_mode"
|
||||
printf "};\n\n"
|
||||
|
||||
# Metadata
|
||||
printf "metadata =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" metadata_enabled "enabled"
|
||||
append_str "$cfg" metadata_cover_art "include_cover_art"
|
||||
append_str "$cfg" metadata_pipe_name "pipe_name"
|
||||
append_num "$cfg" metadata_pipe_timeout "pipe_timeout"
|
||||
append_str "$cfg" metadata_socket_address "socket_address"
|
||||
append_num "$cfg" metadata_socket_port "socket_port"
|
||||
append_num "$cfg" metadata_socket_msglength "socket_msglength"
|
||||
printf "};\n\n"
|
||||
|
||||
# Session control
|
||||
printf "sessioncontrol =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" sesctl_run_before_play_begins "run_this_before_play_begins"
|
||||
append_str "$cfg" sesctl_run_after_play_ends "run_this_after_play_ends"
|
||||
append_str "$cfg" sesctl_run_before_entering_active_state "run_this_before_entering_active_state"
|
||||
append_str "$cfg" sesctl_run_after_exiting_active_state "run_this_after_exiting_active_state"
|
||||
append_str "$cfg" sesctl_run_if_an_unfixable_error_is_detected "run_this_if_an_unfixable_error_is_detected"
|
||||
append_str "$cfg" sesctl_run_when_volume_is_set "run_this_when_volume_is_set"
|
||||
append_str "$cfg" sesctl_wait_for_completion "wait_for_completion"
|
||||
append_str "$cfg" sesctl_session_interruption "allow_session_interruption"
|
||||
append_num "$cfg" sesctl_session_timeout "session_timeout"
|
||||
printf "};\n\n"
|
||||
|
||||
# Alsa audio back end
|
||||
printf "alsa =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" alsa_output_device "output_device"
|
||||
append_str "$cfg" alsa_mixer_control_name "mixer_control_name"
|
||||
append_str "$cfg" alsa_mixer_device "mixer_device"
|
||||
append_num "$cfg" alsa_latency_offset "audio_backend_latency_offset"
|
||||
local alsa_output_rate_val
|
||||
config_get alsa_output_rate_val "$cfg" "alsa_output_rate"
|
||||
[ $alsa_output_rate_val != "auto" ] && append_num "$cfg" alsa_output_rate "output_rate" "44100"
|
||||
append_num "$cfg" alsa_buffer_length "audio_backend_buffer_desired_length"
|
||||
append_str "$cfg" alsa_disable_synchronization "disable_synchronization"
|
||||
append_num "$cfg" alsa_period_size "period_size"
|
||||
append_num "$cfg" alsa_buffer_size "buffer_size"
|
||||
printf "};\n\n"
|
||||
|
||||
# Pipe audio back end
|
||||
printf "pipe =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" pipe_name "name"
|
||||
append_num "$cfg" pipe_latency_offset "audio_backend_latency_offset"
|
||||
append_num "$cfg" pipe_buffer_length "audio_backend_buffer_desired_length"
|
||||
printf "};\n\n"
|
||||
|
||||
# Stdout audio back end
|
||||
printf "stdout =\n"
|
||||
printf "{\n"
|
||||
append_num "$cfg" stdout_latency_offset "audio_backend_latency_offset"
|
||||
append_num "$cfg" stdout_buffer_length "audio_backend_buffer_desired_length"
|
||||
printf "};\n\n"
|
||||
|
||||
# MQTT
|
||||
printf "mqtt =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" mqtt_enabled "enabled"
|
||||
append_str "$cfg" mqtt_hostname "hostname"
|
||||
append_num "$cfg" mqtt_port "port"
|
||||
append_str "$cfg" mqtt_username "username"
|
||||
append_str "$cfg" mqtt_password "password"
|
||||
append_str "$cfg" mqtt_topic "topic"
|
||||
append_str "$cfg" mqtt_publish_raw "publish_raw"
|
||||
append_str "$cfg" mqtt_publish_parsed "publish_parsed"
|
||||
append_str "$cfg" mqtt_publish_cover "publish_cover"
|
||||
append_str "$cfg" mqtt_enable_remote "enable_remote"
|
||||
printf "};\n\n"
|
||||
|
||||
# AO audio back end
|
||||
printf "ao =\n"
|
||||
printf "{\n"
|
||||
append_num "$cfg" ao_latency_offset "audio_backend_latency_offset"
|
||||
append_num "$cfg" ao_buffer_length "audio_backend_buffer_desired_length"
|
||||
printf "};\n\n"
|
||||
|
||||
# Diagnostics
|
||||
config_get log_verbosity "$cfg" log_verbosity
|
||||
config_get statistics "$cfg" statistics
|
||||
|
||||
printf "diagnostics =\n"
|
||||
printf "{\n"
|
||||
append_str "$cfg" diagnostics_statistics "statistics" "${statistics}"
|
||||
append_str "$cfg" diagnostics_log_output_to "log_output_to"
|
||||
append_num "$cfg" diagnostics_log_verbosity "log_verbosity" "${log_verbosity}"
|
||||
printf "};\n\n"
|
||||
} > "$conf_file"
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command /usr/bin/airplay2
|
||||
procd_append_param command -c "$conf_file"
|
||||
|
||||
config_get_bool aux "$cfg" 'respawn' '0'
|
||||
[ "$aux" = 1 ] && procd_set_param respawn
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "airplay2"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load airplay2
|
||||
config_foreach start_instance airplay2
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
Reference in New Issue
Block a user