Browse Source

shairport-sync: update to latest version

- update to latest (2.4.1) version
- add support for config files
- switch uci to config files
- based on https://github.com/openwrt/packages/pull/1815
- merge maintainers
- add openssl/polarssl build variants

Signed-off-by: Mike Brady <mikebrady@eircom.net>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Álvaro Fernández Rojas 9 years ago
parent
commit
855c3e4c61

+ 53
- 15
sound/shairport-sync/Makefile View File

@@ -9,7 +9,7 @@
9 9
 include $(TOPDIR)/rules.mk
10 10
 
11 11
 PKG_NAME:=shairport-sync
12
-PKG_VERSION:=2.1.15
12
+PKG_VERSION:=2.4.1
13 13
 PKG_RELEASE:=1
14 14
 
15 15
 PKG_SOURCE_PROTO:=git
@@ -17,13 +17,12 @@ PKG_SOURCE_URL:=git://github.com/mikebrady/shairport-sync.git
17 17
 PKG_SOURCE_VERSION:=$(PKG_VERSION)
18 18
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
19 19
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
20
-PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
20
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, Mike Brady <mikebrady@eircom.net>
21 21
 
22 22
 PKG_LICENSE:=MIT
23 23
 PKG_LICENSE_FILES:=COPYING LICENSES shairport.c
24 24
 
25 25
 PKG_BUILD_PARALLEL:=1
26
-
27 26
 PKG_FIXUP:=autoreconf
28 27
 
29 28
 include $(INCLUDE_DIR)/package.mk
@@ -32,31 +31,70 @@ CONFIGURE_ARGS+= \
32 31
 	--with-alsa \
33 32
 	--with-avahi \
34 33
 	--with-soxr \
35
-	--with-ssl=openssl
34
+	--with-metadata
36 35
 
36
+ifeq ($(BUILD_VARIANT),openssl)
37
+  CONFIGURE_ARGS+= --with-ssl=openssl
38
+endif
39
+ifeq ($(BUILD_VARIANT),polarssl)
40
+  CONFIGURE_ARGS+= --with-ssl=polarssl
41
+endif
37 42
 
38
-define Package/shairport-sync
43
+define Package/shairport-sync/default
39 44
   SECTION:=sound
40 45
   CATEGORY:=Sound
41
-  TITLE:=iPhone/iTunes compatible audio player
42
-  DEPENDS:= +libpthread +libopenssl +libavahi-client +alsa-lib +libdaemon +libsoxr +libpopt
43
-  MAINTAINER:=Mike Brady <mikebrady@eircom.net>
46
+  TITLE:=iPhone/iTunes/AirPlay/Quicktime Player compatible Audio Player
47
+  DEPENDS:=@AUDIO_SUPPORT +libpthread +libavahi-client +alsa-lib +libconfig +libdaemon +libsoxr +libpopt
48
+  URL:=http://github.com/mikebrady/shairport-sync
49
+endef
50
+
51
+define Package/shairport-sync-openssl
52
+  $(Package/shairport-sync/default)
53
+  TITLE+= (openssl)
54
+  DEPENDS+= +PACKAGE_shairport-sync-openssl:libopenssl
55
+  VARIANT:=openssl
56
+endef
57
+
58
+define Package/shairport-sync-polarssl
59
+  $(Package/shairport-sync/default)
60
+  TITLE+= (polarssl)
61
+  DEPENDS+= +PACKAGE_shairport-sync-polarssl:libpolarssl
62
+  VARIANT:=polarssl
63
+  DEFAULT_VARIANT:=1
64
+endef
65
+
66
+define Package/shairport-sync/default/description
67
+  Shairport Sync plays audio from iTunes and AirPlay sources, including
68
+  iOS devices, Quicktime Player and third party sources such as forkedDaapd.
69
+  Audio played by a Shairport Sync-powered device stays synchronised with the source
70
+  and hence with similar devices playing the same source.
71
+  Thus, for example, synchronised multi-room audio is possible without difficulty.
72
+  (Hence the name Shairport Sync, BTW.)
73
+  Shairport Sync does not support AirPlay video or photo streaming.
74
+  Ensure Kernel Modules > Sound Support > kmod-sound-core is selected.
75
+  Also select kmod-usb-audio if you want to use USB-connected sound cards.
44 76
 endef
77
+Package/shairport-sync-openssl/description = $(Package/shairport-sync/default/description)
78
+Package/shairport-sync-polarssl/description = $(Package/shairport-sync/default/description)
45 79
 
46
-define Package/shairport-sync/description
47
-  Shairport Sync is server software that implements the Apple-originated RAOP protocol for
48
-  playback of audio from a compatible remote client such as the iPhone, iTunes, Apple TV, Quicktime Player or forked-daapd.
49
-  Shairport Sync implements audio synchronisation, supporting multi-room use.
50
-  Shairport Sync supports audio only.
80
+define Package/shairport-sync/default/conffiles
81
+/etc/shairport-sync.conf
51 82
 endef
83
+Package/shairport-sync-openssl/conffiles = $(Package/shairport-sync/default/conffiles)
84
+Package/shairport-sync-polarssl/conffiles = $(Package/shairport-sync/default/conffiles)
52 85
 
53
-define Package/shairport-sync/install
86
+define Package/shairport-sync/default/install
54 87
 	$(INSTALL_DIR) $(1)/usr/bin
55 88
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/shairport-sync $(1)/usr/bin/
89
+	$(INSTALL_DIR) $(1)/etc
90
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/scripts/shairport-sync.conf $(1)/etc/shairport-sync.conf
56 91
 	$(INSTALL_DIR) $(1)/etc/init.d
57 92
 	$(INSTALL_BIN) ./files/shairport-sync.init $(1)/etc/init.d/shairport-sync
58 93
 	$(INSTALL_DIR) $(1)/etc/config
59 94
 	$(INSTALL_DATA) ./files/shairport-sync.config $(1)/etc/config/shairport-sync
60 95
 endef
96
+Package/shairport-sync-openssl/install = $(Package/shairport-sync/default/install)
97
+Package/shairport-sync-polarssl/install = $(Package/shairport-sync/default/install)
61 98
 
62
-$(eval $(call BuildPackage,shairport-sync))
99
+$(eval $(call BuildPackage,shairport-sync-openssl))
100
+$(eval $(call BuildPackage,shairport-sync-polarssl))

+ 52
- 34
sound/shairport-sync/files/shairport-sync.config View File

@@ -1,35 +1,53 @@
1
-# Uncomment the stanza you want, and make sure to comment out the others, especially duplicate options.
1
+# Use your own config file
2
+config shairport-sync 'shairport_sync_file'
3
+	option disabled '1'
4
+	option respawn '1'
5
+	option conf_custom '1'
6
+	option conf_file '/etc/shairport-sync.conf'
2 7
 
3
-#Arguments and defaults are as follows
4
-config shairport-sync main
5
-#       option name 'Shairport Sync' 		#default name, "Shairport Sync on %d"
6
-#       option device default        		#default soundcard, volume control by software
7
-						#(Troubleshooting hint: make sure the soundcard's volume is turned up fully -- use alsamixer or amixer)
8
-#       option airplaylatency 88200
9
-#       option ituneslatency 99400
10
-#       option port 5000
11
-#       option stuffing basic 			#options are 'basic' or 'soxr' if shairport-sync was compiled with soxr support
12
-#       option awaitactioncompletion false 	#[don't] wait until beforeaction or afteraction completes
13
-#       option beforeaction <action> 		#action must be a fully qualified program with no arguments. Default no action.
14
-#       option afteraction <action> 		#action must be a fully qualified program with no arguments. Default no action.
15
-#       option devicetype <devicetype>
16
-#       option volumecontrolname <name>
17
-
18
-#Here are some sample stanzas:
19
-
20
-#For Raspberry Pi using the built-in soundcard for the headphone jack
21
-#       option device 'hw:0'
22
-#       option devicetype hardware
23
-#       option volumecontrolname Master
24
-
25
-#For Raspberry Pi with the "3D Sound" USB Soundcard
26
-#        option name 'Pi'
27
-#        option device 'hw:1'
28
-#        option devicetype hardware
29
-#        option volumecontrolname Speaker
30
-
31
-#For Raspberry Pi with the first generation iMic or the Topping TP30 Class T Digital Mini Amplifier
32
-#        option name 'Kitchen'
33
-#        option device 'hw:1'
34
-#        option devicetype hardware
35
-#        option volumecontrolname PCM
8
+# Use OpenWrt UCI config
9
+config shairport-sync 'shairport_sync'
10
+	option disabled '1'
11
+	option respawn '1'
12
+	# General
13
+	option name 'Shairport-Sync'
14
+	option password ''
15
+	option interpolation '' # basic/soxr
16
+	option output_backend '' # alsa/pipe/stdout/ao/dummy/pulse/sndio
17
+	option mdns_backend '' # avahi/external-avahi/dns-sd/external-dns-sd/tinysvcmdns
18
+	option port '' # 5000
19
+	option udp_port_base '' # 6001
20
+	option udp_port_range '' # 100
21
+	option statistics '' # no/yes
22
+	option drift '' # 88
23
+	option resync_threshold '' # 2205
24
+	option log_verbosity '' # 0/1/2/3
25
+	option ignore_volume_control '' # no/yes
26
+	# Latencies
27
+	option latencies_default '' # 88200
28
+	option latencies_itunes '' # 99400
29
+	option latencies_airplay '' # 88200
30
+	option latencies_forked_daapd '' # 99400
31
+	# Metadata
32
+	option metadata_enabled '' # no/yes
33
+	option metadata_cover_art '' # no/yes
34
+	option metadata_pipe_name '' # /tmp/shairport-sync-metadata
35
+	# Session Control
36
+	option sesctl_run_before_play_begins '' # /etc/shairport-sync-start.sh
37
+	option sesctl_run_after_play_ends '' # /etc/shairport-sync-stop.sh
38
+	option sesctl_wait_for_completion '' # no/yes
39
+	option sesctl_session_interruption '' # no/yes
40
+	option sesctl_session_timeout '' # 120
41
+	# ALSA
42
+	option alsa_output_device '' # default
43
+	option alsa_mixer_control_name '' # PCM
44
+	option alsa_mixer_device '' # default
45
+	option alsa_latency_offset '' # 0
46
+	option alsa_buffer_length '' # 6615
47
+	# Pipe
48
+	option pipe_name '' # /tmp/shairport-sync-audio
49
+	option pipe_latency_offset '' # 0
50
+	option pipe_buffer_length '' # 44100
51
+	# Stdout
52
+	option stdout_latency_offset '' # 0
53
+	option stdout_buffer_length '' # 44100

+ 108
- 51
sound/shairport-sync/files/shairport-sync.init View File

@@ -1,77 +1,134 @@
1 1
 #!/bin/sh /etc/rc.common
2
+# Copyright (C) 2015 OpenWrt.org
2 3
 
3
-NAME='shairport-sync'
4 4
 START=99
5
-
6 5
 USE_PROCD=1
7 6
 
8
-append_arg() {
7
+append_num() {
9 8
 	local cfg="$1"
10
-	local var="$2"
11
-	local opt="$3"
12
-	local def="$4"
9
+	local file="$2"
10
+	local var="$3"
11
+	local opt="$4"
12
+	local def="$5"
13 13
 	local val
14 14
 
15 15
 	config_get val "$cfg" "$var"
16
-	[ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
16
+	[ -n "$val" -o -n "$def" ] && echo -e "\t$opt = ${val:-$def};" >> $file
17 17
 }
18
-
19
-append_bool() {
18
+append_str() {
20 19
 	local cfg="$1"
21
-	local var="$2"
22
-	local opt="$3"
23
-	local def="$4"
20
+	local file="$2"
21
+	local var="$3"
22
+	local opt="$4"
23
+	local def="$5"
24 24
 	local val
25 25
 
26
-	config_get_bool val "$cfg" "$var" "$def"
27
-	[ "$val" = 1 ] && procd_append_param command "$opt"
26
+	config_get val "$cfg" "$var"
27
+	[ -n "$val" -o -n "$def" ] && echo -e "\t$opt = \"${val:-$def}\";" >> $file
28 28
 }
29 29
 
30
-start_shairport_service() {
30
+start_instance() {
31 31
 	local cfg=$1
32
-	local stuffing
33
-        local device
32
+	local conf_custom conf_file aux
33
+
34
+	config_get_bool aux "$cfg" 'disabled' '0'
35
+	[ "$aux" = 1 ] && return 1
36
+
37
+	config_get_bool conf_custom "$cfg" 'conf_custom' '0'
38
+	config_get conf_file "$cfg" "conf_file"
39
+	if [ $conf_custom -ne 1 ] && [ ! -n "$conf_file" ]; then
40
+		mkdir -p /var/etc
41
+		conf_file="/var/etc/shairport-sync-${cfg}.conf"
42
+
43
+		echo -e "// Automatically generated from UCI config\n" > $conf_file
44
+
45
+		# General
46
+		echo -e "general =" >> $conf_file
47
+		echo -e "{" >> $conf_file
48
+		append_str "$cfg" "$conf_file" name "name"
49
+		append_str "$cfg" "$conf_file" password "password"
50
+		append_str "$cfg" "$conf_file" interpolation "interpolation"
51
+		append_str "$cfg" "$conf_file" output_backend "output_backend"
52
+		append_str "$cfg" "$conf_file" mdns_backend "mdns_backend"
53
+		append_num "$cfg" "$conf_file" port "port"
54
+		append_num "$cfg" "$conf_file" udp_port_base "udp_port_base"
55
+		append_num "$cfg" "$conf_file" udp_port_range "udp_port_range"
56
+		append_str "$cfg" "$conf_file" statistics "statistics"
57
+		append_num "$cfg" "$conf_file" drift "drift"
58
+		append_num "$cfg" "$conf_file" resync_threshold "resync_threshold"
59
+		append_num "$cfg" "$conf_file" log_verbosity "log_verbosity"
60
+		append_str "$cfg" "$conf_file" ignore_volume_control "ignore_volume_control"
61
+		echo -e "};\n" >> $conf_file
62
+
63
+		# Latencies
64
+		echo -e "latencies =" >> $conf_file
65
+		echo -e "{" >> $conf_file
66
+		append_num "$cfg" "$conf_file" latencies_default "default"
67
+		append_num "$cfg" "$conf_file" latencies_itunes "itunes"
68
+		append_num "$cfg" "$conf_file" latencies_airplay "airplay"
69
+		append_num "$cfg" "$conf_file" latencies_forked_daapd "forkedDaapd"
70
+		echo -e "};\n" >> $conf_file
71
+
72
+		# Metadata
73
+		echo -e "metadata =" >> $conf_file
74
+		echo -e "{" >> $conf_file
75
+		append_str "$cfg" "$conf_file" metadata_enabled "enabled"
76
+		append_str "$cfg" "$conf_file" metadata_cover_art "include_cover_art"
77
+		append_str "$cfg" "$conf_file" metadata_pipe_name "pipe_name"
78
+		echo -e "};\n" >> $conf_file
79
+
80
+		# Session control
81
+		echo -e "sessioncontrol =" >> $conf_file
82
+		echo -e "{" >> $conf_file
83
+		append_str "$cfg" "$conf_file" sesctl_run_before_play_begins "run_this_before_play_begins"
84
+		append_str "$cfg" "$conf_file" sesctl_run_after_play_ends "run_this_after_play_ends"
85
+		append_str "$cfg" "$conf_file" sesctl_wait_for_completion "wait_for_completion"
86
+		append_str "$cfg" "$conf_file" sesctl_session_interruption "allow_session_interruption"
87
+		append_num "$cfg" "$conf_file" sesctl_session_timeout "session_timeout"
88
+		echo -e "};\n" >> $conf_file
89
+
90
+		# Alsa audio back end
91
+		echo -e "alsa =" >> $conf_file
92
+		echo -e "{" >> $conf_file
93
+		append_str "$cfg" "$conf_file" alsa_output_device "output_device"
94
+		append_str "$cfg" "$conf_file" alsa_mixer_control_name "mixer_control_name"
95
+		append_str "$cfg" "$conf_file" alsa_mixer_device "mixer_device"
96
+		append_num "$cfg" "$conf_file" alsa_latency_offset "audio_backend_latency_offset"
97
+		append_num "$cfg" "$conf_file" alsa_buffer_length "audio_backend_buffer_desired_length"
98
+		echo -e "};\n" >> $conf_file
99
+
100
+		# Pipe audio back end
101
+		echo -e "pipe =" >> $conf_file
102
+		echo -e "{" >> $conf_file
103
+		append_str "$cfg" "$conf_file" pipe_name "name"
104
+		append_num "$cfg" "$conf_file" pipe_latency_offset "audio_backend_latency_offset"
105
+		append_num "$cfg" "$conf_file" pipe_buffer_length "audio_backend_buffer_desired_length"
106
+		echo -e "};\n" >> $conf_file
107
+
108
+		# Stdout audio back end
109
+		echo -e "stdout =" >> $conf_file
110
+		echo -e "{" >> $conf_file
111
+		append_num "$cfg" "$conf_file" stdout_latency_offset "audio_backend_latency_offset"
112
+		append_num "$cfg" "$conf_file" stdout_buffer_length "audio_backend_buffer_desired_length"
113
+		echo -e "};\n" >> $conf_file
114
+	fi
34 115
 
35 116
 	procd_open_instance
36 117
 
37
-	procd_set_param command /usr/bin/$NAME
38
-
39
-	append_arg "$cfg" name "-a"
40
-	append_arg "$cfg" port "-p"
41
-	append_arg "$cfg" airplaylatency "-A"
42
-	append_arg "$cfg" ituneslatency "-i"
43
-
44
-        config_get stuffing "$cfg" stuffing ""
45
-
46
-	if [ -n "$stuffing" ] ; then
47
-                case "x$stuffing" in
48
-                        ( "xbasic" ) procd_append_param command -S basic ;;
49
-                        ( "xsoxr" ) procd_append_param command -S soxr ;;
50
-                        ( * ) logger "bad argument for -S option -- should be \"basic\" or \"soxr\"" ;;
51
-                esac
52
-        fi
53
-
54
-	append_arg "$cfg" beforeaction "-B"
55
-	append_arg "$cfg" afteraction "-E"
56
-	append_bool "$cfg" awaitactioncompletion "-w"
57
-
58
-        config_get device "$cfg" device ""
59
-	if [ -n "$device" ] ; then
60
-		procd_append_param command "--"
61
-		append_arg "$cfg" device "-d"
62
-		append_arg "$cfg" devicetype "-t"
63
-		append_arg "$cfg" volumecontrolname "-c"
64
-	fi
118
+	procd_set_param command /usr/bin/shairport-sync
119
+	procd_append_param command -c $conf_file
120
+
121
+	config_get_bool aux "$cfg" 'respawn' '0'
122
+	[ "$aux" = 1 ] && procd_set_param respawn
65 123
 
66 124
 	procd_close_instance
67 125
 }
68 126
 
69
-service_triggers() { 
70
-        procd_add_reload_trigger $NAME
71
-} 
127
+service_triggers() {
128
+	procd_add_reload_trigger "shairport-sync"
129
+}
72 130
 
73 131
 start_service() {
74
-        config_load $NAME
75
-	# Just a single instance
76
-        start_shairport_service "main"
132
+	config_load shairport-sync
133
+	config_foreach start_instance shairport-sync
77 134
 }