Skip to content

Commit eeb8d13

Browse files
xabolcs1715173329
authored andcommitted
snapcast: add package snapserver and snapclient
Snapcast [1] is a multiroom client-server audio player, where all clients are time synchronized with the server to play perfectly synced audio. It's not a standalone player, but an extension that turns your existing audio player into a Sonos-like multiroom solution. Audio is captured by the server and routed to the connected clients. Several players can feed audio to the server in parallel and clients can be grouped to play the same audio stream. One of the most generic ways to use Snapcast is in conjunction with the music player daemon (MPD) [2] or Mopidy [3]. The inclusion starts with version 0.28.0 because of OpenSSL dependency issues of version 0.29.0. Newer versions (e.g. 0.32.3, see [4]) with optional OpenSSL support, will be incorporated with flavours, like "-mini" and "-full" in the upcoming PRs. More about this topic please check the inclusion PR at [5]! [1]: https://github.com/badaix/snapcast [2]: http://www.musicpd.org/ [3]: https://www.mopidy.com/ [4]: https://github.com/badaix/snapcast/blob/develop/changelog.md [5]: #23956 (comment) Fixes: #23924 Suggested-by: Tianling Shen <cnsztl@immortalwrt.org> Suggested-by: George Sapkin <george@sapk.in> Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
1 parent e5a64aa commit eeb8d13

6 files changed

Lines changed: 72 additions & 79 deletions

File tree

sound/snapcast/Makefile

Lines changed: 43 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,86 @@
1-
#
2-
# Copyright (C) 2015 OpenWrt.org
3-
#
4-
# This is free software, licensed under the GNU General Public License v2.
5-
# See /LICENSE for more information.
6-
#
1+
# SPDX-License-Identifier: GPL-2.0-or-later
72

83
include $(TOPDIR)/rules.mk
94

10-
PKG_NAME := snapcast
11-
PKG_VERSION := 0.27.0
12-
PKG_RELEASE := $(PKG_SOURCE_VERSION)
13-
PKG_USE_MIPS16 := 0
5+
PKG_NAME:=snapcast
6+
PKG_VERSION:=0.28.0
7+
PKG_RELEASE:=1
148

15-
# PKG_MIRROR_HASH=skip
169
PKG_SOURCE_PROTO:=git
1710
PKG_SOURCE_URL:=https://github.com/badaix/snapcast.git
18-
PKG_SOURCE_VERSION:=v0.27.0
19-
PKG_BUILD_DIR:=$(BUILD_DIR)/snapcast-$(PKG_VERSION)
11+
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
12+
PKG_MIRROR_HASH=288325fc8b134502adb522711c18210794734675684cf5d8eba8a0a82778f6c9
13+
14+
PKG_MAINTAINER:=Szabolcs Hubai <szab.hu@gmail.com>, David Andreoletti <david@andreoletti.net>
15+
PKG_LICENSE:=GPL-3.0-or-later
16+
PKG_LICENSE_FILES:=LICENSE
17+
PKG_CPE_ID:=cpe:/a:badaix:snapcast
2018

2119
include $(INCLUDE_DIR)/package.mk
2220
include $(INCLUDE_DIR)/cmake.mk
2321

2422
CMAKE_OPTIONS += -DBUILD_TESTS=OFF
2523

2624
define Package/snapcast/Default
27-
SECTION := sound
28-
CATEGORY := Sound
29-
TITLE := Synchronous multiroom audio player
30-
DEPENDS := +AUDIO_SUPPORT:alsa-lib +libstdcpp +libavahi-client +libatomic +libogg +libflac +libopus +boost +libsoxr
31-
URL := https://github.com/badaix/snapcast
25+
SECTION:=sound
26+
CATEGORY:=Sound
27+
TITLE:=Synchronous multiroom audio player
28+
DEPENDS:=+AUDIO_SUPPORT:alsa-lib +libavahi-client +libatomic +libogg +libflac +libopus +boost +libsoxr
29+
URL:=https://github.com/badaix/snapcast
3230
endef
3331

34-
define Package/snapcast/description/Default
35-
Synchronous audio player
36-
endef
32+
define Package/snapcast/Default/description
33+
Synchronous audio player - Snapcast
3734

38-
define Package/snapcast
39-
$(call Package/snapcast/Default)
40-
TITLE += packages
41-
endef
35+
Snapcast is a multi-room client-server audio player,
36+
where all clients are time synchronized with the server
37+
to play perfectly synced audio.
38+
It's not a standalone player, but an extension that turns
39+
your existing audio player into a Sonos-like multiroom solution.
40+
Audio is captured by the server and routed to the connected clients.
41+
Several players can feed audio to the server in parallel
42+
and clients can be grouped to play the same audio stream.
43+
One of the most generic ways to use Snapcast is in conjunction
44+
with the Music Player Daemon (MPD) or Mopidy.
4245

43-
define Package/snapcast/description
44-
$(call Package/snapcast/description/Default)
45-
Snapcast is a multi-room client-server audio player,
46-
where all clients are time synchronized with the server
47-
to play perfectly synced audio
4846
endef
4947

5048
define Package/snapserver
51-
$(call Package/snapcast/Default)
52-
TITLE += Snapserver
53-
DEPENDS += +AUDIO_SUPPORT:alsa-lib +libvorbis +libsoxr
54-
HIDDEN := 1
49+
$(call Package/snapcast/Default)
50+
TITLE+= (server)
51+
DEPENDS+=+libvorbis
5552
endef
5653

5754
define Package/snapclient
58-
$(call Package/snapcast/Default)
59-
TILE += Snapclient
60-
DEPENDS += +libvorbisidec +libsoxr
61-
HIDDEN := 1
55+
$(call Package/snapcast/Default)
56+
TITLE+= (client)
57+
DEPENDS+=+libvorbisidec
6258
endef
6359

6460
define Package/snapserver/description
65-
$(call Package/snapcast/description/Default)
66-
Snapcast server
61+
$(call Package/snapcast/Default/description)
62+
This package contains the Snapcast server.
6763
endef
6864

6965
define Package/snapclient/description
70-
$(call Package/snapcast/description/Default)
71-
Snapcast client
66+
$(call Package/snapcast/Default/description)
67+
This package contains the Snapcast client.
7268
endef
7369

74-
define Package/snapcast/config
75-
menu "Select Snapcast Options"
76-
depends on PACKAGE_snapcast
77-
comment "Choose server or client"
78-
config PACKAGE_snapserver
79-
prompt "Snapserver"
80-
help
81-
Snapcast server
82-
default n
83-
84-
config PACKAGE_snapclient
85-
prompt "Snapclient"
86-
help
87-
Snapcast client
88-
default y
89-
endmenu
70+
define Package/snapserver/conffiles
71+
/etc/config/snapserver
72+
/etc/snapserver.conf
9073
endef
9174

92-
define Package/snapcast/Default/install
93-
true
75+
define Package/snapclient/conffiles
76+
/etc/config/snapclient
9477
endef
9578

9679
define Package/snapserver/install
9780
$(INSTALL_DIR) $(1)/usr/bin
9881
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/snapserver $(1)/usr/bin/
9982
$(INSTALL_DIR) $(1)/etc/init.d
10083
$(INSTALL_BIN) ./files/snapserver.init $(1)/etc/init.d/snapserver
101-
$(INSTALL_DIR) $(1)/etc/default
102-
$(INSTALL_BIN) $(CURDIR)/../../debian/snapserver.default $(1)/etc/default/snapserver
10384
$(INSTALL_BIN) $(PKG_BUILD_DIR)/server/etc/snapserver.conf $(1)/etc/snapserver.conf
10485
endef
10586

@@ -108,10 +89,7 @@ define Package/snapclient/install
10889
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/snapclient $(1)/usr/bin/
10990
$(INSTALL_DIR) $(1)/etc/init.d
11091
$(INSTALL_BIN) ./files/snapclient.init $(1)/etc/init.d/snapclient
111-
$(INSTALL_DIR) $(1)/etc/default
112-
$(INSTALL_BIN) $(CURDIR)/../../debian/snapclient.default $(1)/etc/default/snapclient
11392
endef
11493

11594
$(eval $(call BuildPackage,snapserver))
11695
$(eval $(call BuildPackage,snapclient))
117-
$(eval $(call BuildPackage,snapcast))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config snapclient 'config'
2+
option enabled '0'
3+
option log_sink 'system'
4+
option opts ''

sound/snapcast/files/snapclient.init

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#!/bin/sh /etc/rc.common
22
# Author: Johannes Pohl <johannes.pohl@badaix.de>
3+
# Co-Author: Szabolcs Hubai <szab.hu@gmail.com>
34
START=90
45

56
USE_PROCD=1
67

78
NAME=snapclient
89
PROG=/usr/bin/$NAME
910
PID_FILE=/var/run/$NAME.pid
10-
CONFIG_FILE=/etc/default/$NAME
11-
1211

1312
start_service()
1413
{
15-
local autostart opts
14+
config_load "$NAME"
1615

17-
autostart=$(grep ^START_SNAPCLIENT $CONFIG_FILE |cut -d= -f2)
18-
[ "$autostart" != "true" ] && logger -t $NAME "Not starting due to START_SNAPCLIENT" && exit 0
16+
local enabled
17+
config_get_bool enabled "config" enabled 0
18+
[ "$enabled" -ne "1" ] && logger -t $NAME "Disabled in /etc/config/$NAME" && return 1
1919

20-
opts=$(grep ^SNAPCLIENT_OPTS $CONFIG_FILE |cut -d "\"" -f2)
21-
opts="--logsink system $opts"
20+
local log_sink opts
21+
config_get log_sink "config" log_sink system
22+
config_get opts "config" opts ""
2223

2324
procd_open_instance
2425
procd_set_param command $PROG
26+
procd_append_param command --logsink $log_sink
2527
procd_append_param command $opts
2628
procd_set_param pidfile $PID_FILE
2729
procd_set_param respawn # use the defaults for respawing crashed process
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config snapserver 'config'
2+
option enabled '0'
3+
option log_sink 'system'
4+
option opts ''

sound/snapcast/files/snapserver.init

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#!/bin/sh /etc/rc.common
22
# Author: Johannes Pohl <johannes.pohl@badaix.de>
3+
# Co-Author: Szabolcs Hubai <szab.hu@gmail.com>
34
START=90
45

56
USE_PROCD=1
67

78
NAME=snapserver
89
PROG=/usr/bin/$NAME
910
PID_FILE=/var/run/$NAME.pid
10-
CONFIG_FILE=/etc/default/$NAME
11-
1211

1312
start_service()
1413
{
15-
local autostart opts
14+
config_load "$NAME"
1615

17-
autostart=$(grep ^START_SNAPSERVER $CONFIG_FILE |cut -d= -f2)
18-
[ "$autostart" != "true" ] && logger -t $NAME "Not starting due to START_SNAPSERVER" && exit 0
16+
local enabled
17+
config_get_bool enabled "config" enabled 0
18+
[ "$enabled" -ne "1" ] && logger -t $NAME "Disabled in /etc/config/$NAME" && return 1
1919

20-
opts=$(grep ^SNAPSERVER_OPTS $CONFIG_FILE |cut -d "\"" -f2)
21-
opts="--logging.sink system $opts"
20+
local log_sink opts
21+
config_get log_sink "config" log_sink system
22+
config_get opts "config" opts ""
2223

2324
procd_open_instance
2425
procd_set_param command $PROG
26+
procd_append_param command --logging.sink $log_sink
2527
procd_append_param command $opts
2628
procd_set_param pidfile $PID_FILE
2729
procd_set_param respawn # use the defaults for respawing crashed process

sound/snapcast/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
"$1" --version | grep -F "$PKG_VERSION"

0 commit comments

Comments
 (0)