Add squeezelite-pa compiled with PortAudio instead of ALSA
Chris Boot
9 years ago
2 | 2 | * Enable full hardening build flags: |
3 | 3 | - Add DEB_BUILD_MAINT_OPTIONS := hardening=+all |
4 | 4 | - Strip -fPIC from Makefile |
5 | * Add squeezelite-pa compiled with PortAudio instead of ALSA | |
6 | - Add new squeezelite-pa binary package | |
7 | - Add Build-Depends on portaudio19-dev | |
8 | - Add Makefile-portaudio.patch | |
9 | - Tweak the squeezelite man page to document changed options | |
10 | - Minor shuffling around to accommodate the new package | |
5 | 11 | |
6 | 12 | -- Chris Boot <debian@bootc.net> Sun, 08 Dec 2013 09:42:57 +0000 |
7 | 13 |
2 | 2 | Priority: extra |
3 | 3 | Maintainer: Chris Boot <debian@bootc.net> |
4 | 4 | Build-Depends: debhelper (>= 9~), libasound2-dev, libflac-dev, libmad0-dev, |
5 | libvorbis-dev, libfaad-dev, libmpg123-dev, libsoxr-dev, libavformat-dev | |
5 | libvorbis-dev, libfaad-dev, libmpg123-dev, libsoxr-dev, libavformat-dev, | |
6 | portaudio19-dev | |
6 | 7 | Standards-Version: 3.9.5 |
7 | 8 | Homepage: https://code.google.com/p/squeezelite/ |
8 | 9 | Vcs-Git: git://anonscm.debian.org/collab-maint/squeezelite.git |
11 | 12 | Package: squeezelite |
12 | 13 | Architecture: any |
13 | 14 | Depends: ${shlibs:Depends}, ${misc:Depends} |
14 | Description: lightweight headless Squeezebox emulator | |
15 | Conflicts: squeezelite-pa | |
16 | Description: lightweight headless Squeezebox emulator - ALSA version | |
15 | 17 | Squeezelite is a small headless Squeezebox emulator. It is aimed at |
16 | 18 | supporting high quality audio including USB DAC based output at multiple |
17 | 19 | sample rates. |
23 | 25 | . |
24 | 26 | This package is built with the resampling, ffmpeg and visualisation export |
25 | 27 | options. It uses ALSA for audio output. |
28 | ||
29 | Package: squeezelite-pa | |
30 | Architecture: any | |
31 | Depends: ${shlibs:Depends}, ${misc:Depends} | |
32 | Conflicts: squeezelite | |
33 | Provides: squeezelite | |
34 | Description: lightweight headless Squeezebox emulator - PortAudio version | |
35 | Squeezelite is a small headless Squeezebox emulator. It is aimed at | |
36 | supporting high quality audio including USB DAC based output at multiple | |
37 | sample rates. | |
38 | . | |
39 | It supports decoding PCM (WAV/AIFF), FLAC, MP3, Ogg, AAC, WMA and ALAC | |
40 | audio formats. It can also resample audio, which allows squeezelite to | |
41 | upsample the output to the highest sample rate supported by the output | |
42 | device. | |
43 | . | |
44 | This package is built with the resampling, ffmpeg and visualisation export | |
45 | options. It uses PortAudio for audio output. |
0 | .so man1/squeezelite.1 |
54 | 54 | option in order to select a particular device or configuration to use for audio |
55 | 55 | playback. |
56 | 56 | .TP |
57 | .B \-a <b>:<p>:<f>:<m> | |
58 | Specify ALSA parameters used when opening an audio output device. | |
57 | .B \-a <params> | |
58 | Specify ALSA or PortAudio parameters used when opening an audio output device. | |
59 | For ALSA, the format | |
60 | .B <b>:<p>:<f>:<m> | |
61 | is used where | |
59 | 62 | .B <b> |
60 | 63 | is the buffer time in milliseconds (values less than 500) or size in bytes (default |
61 | 64 | .IR 40 ms); |
68 | 71 | .B <m> |
69 | 72 | is whether to use mmap (possible values: |
70 | 73 | .IR 0 " or " 1 ). |
74 | For PortAudio, the value is simply the target latency in milliseconds. | |
71 | 75 | .TP |
72 | 76 | .B \-b <stream>:<output> |
73 | 77 | Specify internal stream and output buffer sizes in kilobytes. |
102 | 106 | .B \-p <priority> |
103 | 107 | Set real time priority of output thread (1-99; default |
104 | 108 | .IR 45 ). |
109 | Not applicable when using PortAudio. | |
105 | 110 | .TP |
106 | 111 | .B \-r <rate> |
107 | 112 | Maximum sample rate for the output device; this is required if the ALSA output |
0 | Description: Simplify building of PortAudio based binary | |
1 | ||
2 | This Makefile patch conditionally adds libasound or libportaudio to the build | |
3 | flags depending on whether -DPORTAUDIO is included in CFLAGS. | |
4 | ||
5 | Author: Chris Boot <debian@bootc.net> | |
6 | Forwarded: no | |
7 | Last-Update: 2013-12-08 | |
8 | ||
9 | --- a/Makefile | |
10 | +++ b/Makefile | |
11 | @@ -1,6 +1,6 @@ | |
12 | # Cross compile support - create a Makefile which defines these three variables and then includes this Makefile... | |
13 | CFLAGS += -Wall $(OPTS) | |
14 | -LDFLAGS += -lasound -lpthread -lm -lrt | |
15 | +LDFLAGS += -lpthread -lm -lrt | |
16 | EXECUTABLE ?= squeezelite | |
17 | ||
18 | SOURCES = main.c slimproto.c utils.c output.c buffer.c stream.c decode.c process.c resample.c flac.c pcm.c mad.c vorbis.c faad.c mpg.c ffmpeg.c | |
19 | @@ -23,6 +23,12 @@ | |
20 | endif | |
21 | endif | |
22 | ||
23 | +ifneq (,$(findstring -DPORTAUDIO, $(CFLAGS))) | |
24 | + LDFLAGS += -lportaudio | |
25 | +else | |
26 | + LDFLAGS += -lasound | |
27 | +endif | |
28 | + | |
29 | OBJECTS = $(SOURCES:.c=.o) | |
30 | ||
31 | all: $(EXECUTABLE) |
12 | 12 | |
13 | 13 | %: |
14 | 14 | dh $@ |
15 | ||
16 | override_dh_auto_clean: clean_squeezelite clean_squeezelite-pa | |
17 | override_dh_auto_build: build_squeezelite build_squeezelite-pa | |
18 | ||
19 | override_dh_installinit: | |
20 | dh_installinit --name=squeezelite | |
21 | ||
22 | clean_squeezelite: | |
23 | dh_auto_clean -- EXECUTABLE=squeezelite | |
24 | ||
25 | build_squeezelite: clean_squeezelite | |
26 | dh_auto_build -- EXECUTABLE=squeezelite | |
27 | ||
28 | clean_squeezelite-pa: | |
29 | dh_auto_clean -- EXECUTABLE=squeezelite-pa | |
30 | ||
31 | build_squeezelite-pa: OPTS += -DPORTAUDIO | |
32 | build_squeezelite-pa: LDFLAGS += -lportaudio | |
33 | build_squeezelite-pa: clean_squeezelite-pa | |
34 | dh_auto_build -- EXECUTABLE=squeezelite-pa |
0 | squeezelite-pa /usr/bin |
0 | /usr/bin/squeezelite-pa /usr/bin/squeezelite |
0 | ||
1 | # There is no upstream changelog shipped with the package | |
2 | squeezelite-pa binary: no-upstream-changelog | |
3 |
0 | squeezelite.squeezelite.default⏎ |
0 | squeezelite.squeezelite.init⏎ |
0 | # Defaults for squeezelite initscript | |
1 | # sourced by /etc/init.d/squeezelite | |
2 | # installed at /etc/default/squeezelite by the maintainer scripts | |
3 | ||
4 | # The name for the squeezelite player: | |
5 | SL_NAME="$(hostname -s)" | |
6 | ||
7 | # ALSA output device: | |
8 | #SL_SOUNDCARD="default:CARD=Set" | |
9 | ||
10 | # Squeezebox server (Logitech Media Server): | |
11 | # Uncomment the next line if you want to point squeezelite at the IP address of | |
12 | # your squeezebox server. This is usually unnecessary as the server is | |
13 | # automatically discovered. | |
14 | #SB_SERVER_IP="192.168.x.y" | |
15 | ||
16 | # Additional options to pass to squeezelite: | |
17 | # Please do not include -z to make squeezelite daemonise itself. | |
18 | #SB_EXTRA_ARGS="" |
0 | #!/bin/sh | |
1 | ### BEGIN INIT INFO | |
2 | # Provides: squeezelite | |
3 | # Required-Start: $network $remote_fs | |
4 | # Required-Stop: $remote_fs | |
5 | # Default-Start: 2 3 4 5 | |
6 | # Default-Stop: 0 1 6 | |
7 | # Short-Description: Lightweight headless Squeezebox emulator | |
8 | # Description: Lightweight headless streaming audio player for Logitech's | |
9 | # Squeezebox audio server | |
10 | ### END INIT INFO | |
11 | ||
12 | # Author: Chris Boot <debian@bootc.net> | |
13 | ||
14 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
15 | DESC="Squeezebox client" | |
16 | NAME=squeezelite | |
17 | DAEMON=/usr/bin/$NAME | |
18 | PIDFILE=/run/$NAME.pid | |
19 | SCRIPTNAME=/etc/init.d/$NAME | |
20 | ||
21 | # Exit if the package is not installed | |
22 | [ -x "$DAEMON" ] || exit 0 | |
23 | ||
24 | # Read configuration variable file if it is present | |
25 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME | |
26 | ||
27 | # Load the VERBOSE setting and other rcS variables | |
28 | . /lib/init/vars.sh | |
29 | ||
30 | # Define LSB log_* functions. | |
31 | . /lib/lsb/init-functions | |
32 | ||
33 | # | |
34 | # Function that starts the daemon/service | |
35 | # | |
36 | do_start() | |
37 | { | |
38 | DAEMON_ARGS="" | |
39 | ||
40 | # add squeezelite name if set | |
41 | if [ -n "$SL_NAME" ]; then | |
42 | DAEMON_ARGS="${DAEMON_ARGS} -n ${SL_NAME}" | |
43 | fi | |
44 | ||
45 | # add souncard setting if set | |
46 | if [ -n "$SL_SOUNDCARD" ]; then | |
47 | DAEMON_ARGS="${DAEMON_ARGS} -o ${SL_SOUNDCARD}" | |
48 | fi | |
49 | ||
50 | # add squeezebox server ip address if set | |
51 | if [ -n "$SB_SERVER_IP" ]; then | |
52 | DAEMON_ARGS="${DAEMON_ARGS} -s ${SB_SERVER_IP}" | |
53 | fi | |
54 | ||
55 | # add any other options given by the user | |
56 | if [ -n "$SB_EXTRA_ARGS" ]; then | |
57 | DAEMON_ARGS="${DAEMON_ARGS} ${SB_EXTRA_ARGS}" | |
58 | fi | |
59 | ||
60 | # Return | |
61 | # 0 if daemon has been started | |
62 | # 1 if daemon was already running | |
63 | # 2 if daemon could not be started | |
64 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ | |
65 | --test > /dev/null || return 1 | |
66 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ | |
67 | --background --make-pidfile -- $DAEMON_ARGS || return 2 | |
68 | } | |
69 | ||
70 | # | |
71 | # Function that stops the daemon/service | |
72 | # | |
73 | do_stop() | |
74 | { | |
75 | # Return | |
76 | # 0 if daemon has been stopped | |
77 | # 1 if daemon was already stopped | |
78 | # 2 if daemon could not be stopped | |
79 | # other if a failure occurred | |
80 | start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ | |
81 | --pidfile $PIDFILE --name $NAME | |
82 | } | |
83 | ||
84 | case "$1" in | |
85 | start) | |
86 | [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" | |
87 | do_start; RET=$? | |
88 | case $RET in | |
89 | 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; | |
90 | *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; | |
91 | esac | |
92 | ;; | |
93 | stop) | |
94 | [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" | |
95 | do_stop; RET=$? | |
96 | case $RET in | |
97 | 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; | |
98 | *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; | |
99 | esac | |
100 | ;; | |
101 | status) | |
102 | status_of_proc "$DAEMON" "$NAME" | |
103 | ;; | |
104 | restart|force-reload) | |
105 | log_daemon_msg "Restarting $DESC" "$NAME" | |
106 | do_stop; RET=$? | |
107 | case $RET in | |
108 | 0|1) | |
109 | do_start; RET=$? | |
110 | case $RET in | |
111 | 0) log_end_msg 0; exit 0 ;; | |
112 | 1) log_end_msg 1; exit 1 ;; # Old process is still running | |
113 | *) log_end_msg 1; exit 1 ;; # Failed to start | |
114 | esac | |
115 | ;; | |
116 | *) | |
117 | # Failed to stop | |
118 | log_end_msg 1; exit 1 | |
119 | ;; | |
120 | esac | |
121 | ;; | |
122 | *) | |
123 | echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 | |
124 | exit 3 | |
125 | ;; | |
126 | esac | |
127 |
0 | # Defaults for squeezelite initscript | |
1 | # sourced by /etc/init.d/squeezelite | |
2 | # installed at /etc/default/squeezelite by the maintainer scripts | |
3 | ||
4 | # The name for the squeezelite player: | |
5 | SL_NAME="$(hostname -s)" | |
6 | ||
7 | # ALSA output device: | |
8 | #SL_SOUNDCARD="default:CARD=Set" | |
9 | ||
10 | # Squeezebox server (Logitech Media Server): | |
11 | # Uncomment the next line if you want to point squeezelite at the IP address of | |
12 | # your squeezebox server. This is usually unnecessary as the server is | |
13 | # automatically discovered. | |
14 | #SB_SERVER_IP="192.168.x.y" | |
15 | ||
16 | # Additional options to pass to squeezelite: | |
17 | # Please do not include -z to make squeezelite daemonise itself. | |
18 | #SB_EXTRA_ARGS="" |
0 | #!/bin/sh | |
1 | ### BEGIN INIT INFO | |
2 | # Provides: squeezelite | |
3 | # Required-Start: $network $remote_fs | |
4 | # Required-Stop: $remote_fs | |
5 | # Default-Start: 2 3 4 5 | |
6 | # Default-Stop: 0 1 6 | |
7 | # Short-Description: Lightweight headless Squeezebox emulator | |
8 | # Description: Lightweight headless streaming audio player for Logitech's | |
9 | # Squeezebox audio server | |
10 | ### END INIT INFO | |
11 | ||
12 | # Author: Chris Boot <debian@bootc.net> | |
13 | ||
14 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
15 | DESC="Squeezebox client" | |
16 | NAME=squeezelite | |
17 | DAEMON=/usr/bin/$NAME | |
18 | PIDFILE=/run/$NAME.pid | |
19 | SCRIPTNAME=/etc/init.d/$NAME | |
20 | ||
21 | # Exit if the package is not installed | |
22 | [ -x "$DAEMON" ] || exit 0 | |
23 | ||
24 | # Read configuration variable file if it is present | |
25 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME | |
26 | ||
27 | # Load the VERBOSE setting and other rcS variables | |
28 | . /lib/init/vars.sh | |
29 | ||
30 | # Define LSB log_* functions. | |
31 | . /lib/lsb/init-functions | |
32 | ||
33 | # | |
34 | # Function that starts the daemon/service | |
35 | # | |
36 | do_start() | |
37 | { | |
38 | DAEMON_ARGS="" | |
39 | ||
40 | # add squeezelite name if set | |
41 | if [ -n "$SL_NAME" ]; then | |
42 | DAEMON_ARGS="${DAEMON_ARGS} -n ${SL_NAME}" | |
43 | fi | |
44 | ||
45 | # add souncard setting if set | |
46 | if [ -n "$SL_SOUNDCARD" ]; then | |
47 | DAEMON_ARGS="${DAEMON_ARGS} -o ${SL_SOUNDCARD}" | |
48 | fi | |
49 | ||
50 | # add squeezebox server ip address if set | |
51 | if [ -n "$SB_SERVER_IP" ]; then | |
52 | DAEMON_ARGS="${DAEMON_ARGS} -s ${SB_SERVER_IP}" | |
53 | fi | |
54 | ||
55 | # add any other options given by the user | |
56 | if [ -n "$SB_EXTRA_ARGS" ]; then | |
57 | DAEMON_ARGS="${DAEMON_ARGS} ${SB_EXTRA_ARGS}" | |
58 | fi | |
59 | ||
60 | # Return | |
61 | # 0 if daemon has been started | |
62 | # 1 if daemon was already running | |
63 | # 2 if daemon could not be started | |
64 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ | |
65 | --test > /dev/null || return 1 | |
66 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ | |
67 | --background --make-pidfile -- $DAEMON_ARGS || return 2 | |
68 | } | |
69 | ||
70 | # | |
71 | # Function that stops the daemon/service | |
72 | # | |
73 | do_stop() | |
74 | { | |
75 | # Return | |
76 | # 0 if daemon has been stopped | |
77 | # 1 if daemon was already stopped | |
78 | # 2 if daemon could not be stopped | |
79 | # other if a failure occurred | |
80 | start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ | |
81 | --pidfile $PIDFILE --daemon $DAEMON | |
82 | } | |
83 | ||
84 | case "$1" in | |
85 | start) | |
86 | [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" | |
87 | do_start; RET=$? | |
88 | case $RET in | |
89 | 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; | |
90 | *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; | |
91 | esac | |
92 | ;; | |
93 | stop) | |
94 | [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" | |
95 | do_stop; RET=$? | |
96 | case $RET in | |
97 | 0|1) [ "$VERBOSE" != no ] && log_end_msg 0; exit 0 ;; | |
98 | *) [ "$VERBOSE" != no ] && log_end_msg 1; exit 1 ;; | |
99 | esac | |
100 | ;; | |
101 | status) | |
102 | status_of_proc "$DAEMON" "$NAME" | |
103 | ;; | |
104 | restart|force-reload) | |
105 | log_daemon_msg "Restarting $DESC" "$NAME" | |
106 | do_stop; RET=$? | |
107 | case $RET in | |
108 | 0|1) | |
109 | do_start; RET=$? | |
110 | case $RET in | |
111 | 0) log_end_msg 0; exit 0 ;; | |
112 | 1) log_end_msg 1; exit 1 ;; # Old process is still running | |
113 | *) log_end_msg 1; exit 1 ;; # Failed to start | |
114 | esac | |
115 | ;; | |
116 | *) | |
117 | # Failed to stop | |
118 | log_end_msg 1; exit 1 | |
119 | ;; | |
120 | esac | |
121 | ;; | |
122 | *) | |
123 | echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 | |
124 | exit 3 | |
125 | ;; | |
126 | esac | |
127 |