From 5bd060f73d02cf5360216d636426c2f640016684 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:31:18 +0200
Subject: [PATCH 01/44] Make the dummy, pipe and stdout backends optional and
rename initscript to systemv
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 97cebcbc..c6f6ed13 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
SUBDIRS = man
bin_PROGRAMS = shairport-sync
-shairport_sync_SOURCES = shairport.c rtsp.c mdns.c mdns_external.c common.c rtp.c player.c alac.c audio.c audio_dummy.c audio_pipe.c audio_stdout.c
+shairport_sync_SOURCES = shairport.c rtsp.c mdns.c mdns_external.c common.c rtp.c player.c alac.c audio.c
AM_CFLAGS = -Wno-multichar
@@ -56,7 +56,7 @@ if INSTALL_CONFIG_FILES
cp scripts/shairport-sync.conf $(DESTDIR)/etc/shairport-sync.conf.sample
[ -f $(DESTDIR)/etc/shairport-sync.conf ] || cp scripts/shairport-sync.conf $(DESTDIR)/etc/shairport-sync.conf
endif
-if INSTALL_INITSCRIPT
+if INSTALL_SYSTEMV
[ -e $(DESTDIR)/etc/init.d ] || mkdir -p $(DESTDIR)/etc/init.d
[ -f /etc/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)/etc/init.d/
update-rc.d shairport-sync defaults 90 10
From 55f57c1fb492e95066603b6185f5e0c987a8ef3c Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:32:03 +0200
Subject: [PATCH 02/44] Make dummy, pipe and stdout back ends truly optinal
---
audio.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/audio.c b/audio.c
index e8f56718..6c2c6fce 100644
--- a/audio.c
+++ b/audio.c
@@ -41,7 +41,15 @@ extern audio_output audio_pulse;
#ifdef CONFIG_ALSA
extern audio_output audio_alsa;
#endif
-extern audio_output audio_dummy, audio_pipe, audio_stdout;
+#ifdef CONFIG_DUMMY
+extern audio_output audio_dummy;
+#endif
+#ifdef CONFIG_PIPE
+extern audio_output audio_pipe;
+#endif
+#ifdef CONFIG_STDOUT
+extern audio_output audio_stdout;
+#endif
static audio_output *outputs[] = {
#ifdef CONFIG_SNDIO
@@ -56,7 +64,16 @@ static audio_output *outputs[] = {
#ifdef CONFIG_AO
&audio_ao,
#endif
- &audio_dummy, &audio_pipe, &audio_stdout, NULL};
+#ifdef CONFIG_DUMMY
+ &audio_dummy,
+#endif
+#ifdef CONFIG_PIPE
+ &audio_pipe,
+#endif
+#ifdef CONFIG_STDOUT
+ &audio_stdout,
+#endif
+ NULL};
audio_output *audio_get_output(char *name) {
audio_output **out;
From afd8017f60219cfb7b9df206a8746bd5e213fa61 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:33:24 +0200
Subject: [PATCH 03/44] Remove redundant conditional compilation flags
---
shairport.c | 24 +-----------------------
1 file changed, 1 insertion(+), 23 deletions(-)
diff --git a/shairport.c b/shairport.c
index 0c81e745..b77b1807 100644
--- a/shairport.c
+++ b/shairport.c
@@ -62,9 +62,7 @@
static int shutting_down = 0;
static char *appName = NULL;
-#ifdef SUPPORT_CONFIG_FILES
- char configuration_file_path[4096];
-#endif
+char configuration_file_path[4096];
void shairport_shutdown() {
if (shutting_down)
@@ -149,9 +147,6 @@ void print_version(void) {
#endif
#ifdef CONFIG_METADATA
strcat(version_string, "-metadata");
-#endif
-#ifdef SUPPORT_CONFIG_FILES
- strcat(version_string, "-configfile");
#endif
printf("%s\n", version_string);
}
@@ -170,7 +165,6 @@ void usage(char *progname) {
printf(" -c, --configfile=FILE read configuration settings from FILE. Default is "
"/etc/shairport-sync.conf.\n");
-#ifdef COMMAND_LINE_ARGUMENT_SUPPORT
printf(" -v, --verbose -v print debug information; -vv more; -vvv lots\n");
printf(" -p, --port=PORT set RTSP listening port\n");
printf(" -a, --name=NAME set advertised name\n");
@@ -217,10 +211,7 @@ void usage(char *progname) {
"--metadata-pipename=/tmp/shairport-sync-metadata.\n");
printf(" --get-coverart send cover art through the metadata pipe.\n");
#endif
-#endif
-#ifdef SUPPORT_CONFIG_FILES
printf("\nGeneral options can be configured in /etc/%s.conf.\n", appName);
-#endif
printf("\n");
mdns_ls_backends();
printf("\n");
@@ -240,10 +231,7 @@ int parse_options(int argc, char **argv) {
{"reconnectToOutput", 'R', POPT_ARG_NONE, NULL, 0, NULL},
{"kill", 'k', POPT_ARG_NONE, NULL, 0, NULL},
{"daemon", 'd', POPT_ARG_NONE, &config.daemonise, 0, NULL},
-#ifdef SUPPORT_CONFIG_FILES
{"configfile", 'c', POPT_ARG_STRING, &config.configfile, 0, NULL},
-#endif
-#ifdef COMMAND_LINE_ARGUMENT_SUPPORT
{"statistics", 0, POPT_ARG_NONE, &config.statistics_requested, 0, NULL},
{"version", 'V', POPT_ARG_NONE, NULL, 0, NULL},
{"port", 'p', POPT_ARG_INT, &config.port, 0, NULL},
@@ -267,7 +255,6 @@ int parse_options(int argc, char **argv) {
{"get-coverart", 'g', POPT_ARG_NONE, &config.get_coverart, 'g', NULL},
#endif
POPT_AUTOHELP
-#endif
{NULL, 0, 0, NULL, 0}};
// we have to parse the command line arguments to look for a config file
@@ -281,7 +268,6 @@ int parse_options(int argc, char **argv) {
optCon = poptGetContext(NULL, optind, (const char **)argv, optionsTable, 0);
poptSetOtherOptionHelp(optCon, "[OPTIONS]* ");
-#ifdef SUPPORT_CONFIG_FILES
config_setting_t *setting;
const char *str;
int value;
@@ -477,8 +463,6 @@ int parse_options(int argc, char **argv) {
}
}
-#endif
-
// now, do the command line options again, but this time do them fully -- it's a unix convention that command line
// arguments have precedence over configuration file settings.
@@ -600,10 +584,8 @@ const char *pid_file_proc(void) {
#endif
void exit_function() {
-#ifdef SUPPORT_CONFIG_FILES
if (config.cfg)
config_destroy(config.cfg);
-#endif
}
int main(int argc, char **argv) {
@@ -619,12 +601,10 @@ int main(int argc, char **argv) {
free(basec);
// set defaults
-#ifdef SUPPORT_CONFIG_FILES
strcpy(configuration_file_path, "/etc/");
strcat(configuration_file_path, appName);
strcat(configuration_file_path, ".conf");
config.configfile = configuration_file_path;
-#endif
config.statistics_requested - 0; // don't print stats in the log
config.latency = 88200; // AirPlay. Is also reset in rtsp.c when play is about to start
@@ -840,9 +820,7 @@ int main(int argc, char **argv) {
debug(2, "audio backend desired buffer length is %d.",
config.audio_backend_buffer_desired_length);
debug(2, "audio backend latency offset is %d.", config.audio_backend_latency_offset);
-#ifdef SUPPORT_CONFIG_FILES
debug(2, "Configuration file name \"%s\".", config.configfile);
-#endif
#ifdef CONFIG_METADATA
debug(2, "metdata enabled is %d.", config.metadata_enabled);
debug(2, "metadata pipename is \"%s\".", config.metadata_pipename);
From ff95a96e61effeffdb083018af80f1829dacbab9 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:34:35 +0200
Subject: [PATCH 04/44] Allow more stack space for thread, include freebsd in
the name of condional compilation variable
---
player.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/player.c b/player.c
index 522b6fa4..29fb1810 100644
--- a/player.c
+++ b/player.c
@@ -663,7 +663,7 @@ static abuf_t *buffer_get_frame(void) {
time_to_wait_for_wakeup_fp *= 4 * 352; // four full 352-frame packets
time_to_wait_for_wakeup_fp /= 3; // four thirds of a packet time
-#ifdef COMPILE_FOR_LINUX
+#ifdef COMPILE_FOR_LINUX_AND_FREEBSD
uint64_t time_of_wakeup_fp = local_time_now + time_to_wait_for_wakeup_fp;
uint64_t sec = time_of_wakeup_fp >> 32;
uint64_t nsec = ((time_of_wakeup_fp & 0xffffffff) * 1000000000) >> 32;
@@ -1268,7 +1268,7 @@ int player_play(stream_cfg *stream) {
#endif
// set the flowcontrol condition variable to wait on a monotonic clock
-#ifdef COMPILE_FOR_LINUX
+#ifdef COMPILE_FOR_LINUX_AND_FREEBSD
pthread_condattr_t attr;
pthread_condattr_init(&attr);
pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); // can't do this in OS X, and don't need it.
@@ -1280,7 +1280,7 @@ int player_play(stream_cfg *stream) {
if (rc)
debug(1, "Error initialising condition variable.");
config.output->start(sampling_rate);
- size_t size = (PTHREAD_STACK_MIN + 128 * 1024);
+ size_t size = (PTHREAD_STACK_MIN + 256 * 1024);
pthread_attr_t tattr;
pthread_attr_init(&tattr);
rc = pthread_attr_setstacksize(&tattr, size);
From 43c13ae73766060fe02681876be2dc71515e1b8d Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:35:48 +0200
Subject: [PATCH 05/44] Remove a redundant conditional compilation stanza and
redefine a linux compilation flag to include the name freebsd
---
common.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/common.h b/common.h
index 39855c59..2ed250a2 100644
--- a/common.h
+++ b/common.h
@@ -18,9 +18,9 @@
#endif
#endif
-#if defined(__linux__)
-/* Linux. --------------------------------------------------- */
-#define COMPILE_FOR_LINUX 1
+#if defined(__linux__) || defined(__FreeBSD__)
+/* Linux and FreeBSD */
+#define COMPILE_FOR_LINUX_AND_FREEBSD 1
#endif
// struct sockaddr_in6 is bigger than struct sockaddr. derp
@@ -77,9 +77,7 @@ typedef struct {
char *pidfile;
char *logfile;
char *errfile;
-#ifdef SUPPORT_CONFIG_FILES
char *configfile;
-#endif
uint32_t audio_backend_buffer_desired_length; // this will be the desired number of frames in the
// audio backend buffer -- the DAC buffer for ALSA
uint32_t audio_backend_latency_offset; // this will be the offset to compensate for any fixed latency
From 670dd933a2069c3ff943029f093b2875839614fa Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:36:42 +0200
Subject: [PATCH 06/44] Use the renamed linux compilation flag renamed to
include the word freebsd
---
README.md | 4 +--
RELEASENOTES.md | 18 ++++++++++++++
common.c | 3 ++-
configure.ac | 66 +++++++++++++++++++------------------------------
4 files changed, 48 insertions(+), 43 deletions(-)
diff --git a/README.md b/README.md
index 937c0328..fb2fa085 100644
--- a/README.md
+++ b/README.md
@@ -98,9 +98,9 @@ Choose the appropriate `--with-*` options:
Here is an example, suitable for most installations:
-`$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr`
+`$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-systemv --with-soxr`
-Omit the `--with-soxr` if the libsoxr library is not available.
+Omit the `--with-soxr` if the libsoxr library is not available. For installation into a `systemd` system, replace the `--with-systemv` with `--with-systemd`.
`$ make`
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 53a2595c..9c395a7d 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,3 +1,21 @@
+Version 2.3.8
+----
+* Pesky changes you must make
+ * You must change the `./configure` arguments. The flag `with-initscript` has changed to `with-systemv`. It was previously enabled by default; now you must enable it explicitly.
+
+* Changes
+ * Support for installing into `systemd` and Fedora systems. For `systemd` support, use the configuration flag `--with-systemd` in place of `--with-systemv`.
+ * Renamed `with-initscript` configuration flag to `with-systemv` to better describe its role.
+ * System V startup script is no longer enabled by default; if you want is, ask for it with the `--with-systemv` configuration flag.
+ * Added limited support for FreeBSD. You must specify `LDFLAGS='-I/usr/local/lib'` and `CPPFLAGS='-L/usr/local/include'` before running `./configure --with-foo etc.`
+ * Removed "-configfile" annotation from the version string because it'n no longer optional; it's always there.
+ * Removed the `dummy`, `pipe` and `stdout` backends from the standard build -- they are now optional and are no longer automatically included in the build.
+
+* Bug fixes
+ * Allow more stack space to prevent a segfault in certain configurations. Thanks @joerg-krause.
+ * Add missing header files. Thanks @joerg-krause.
+ * Removed some (hopefully) mostly silent bugs from the configure.ac file.
+
Version 2.3.7
----
* Changes
diff --git a/common.c b/common.c
index 83837437..fb8702e0 100644
--- a/common.c
+++ b/common.c
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
@@ -472,7 +473,7 @@ double vol2attn(double vol, long max_db, long min_db) {
uint64_t get_absolute_time_in_fp() {
uint64_t time_now_fp;
-#ifdef COMPILE_FOR_LINUX
+#ifdef COMPILE_FOR_LINUX_AND_FREEBSD
struct timespec tn;
// can't use CLOCK_MONOTONIC_RAW as it's not implemented in OpenWrt
clock_gettime(CLOCK_MONOTONIC, &tn);
diff --git a/configure.ac b/configure.ac
index af40f651..e74a187d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.3.7], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.3.8], [mikebrady@eircom.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
@@ -32,14 +32,14 @@ fi
##### to control how to deal with them
AC_ARG_WITH([pkg_config],
-[ --with-pkg-config = use pkg-config to find libraries], ,[with_pkg_config=1])
+[ --with-pkg-config = use pkg-config to find libraries], ,[with_pkg_config=yes])
AC_CHECK_LIB([daemon],[daemon_log], , AC_MSG_ERROR(libdaemon needed))
AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed))
AC_CHECK_LIB([m],[exp], , AC_MSG_ERROR(maths library needed))
AC_MSG_RESULT(>>Including libpopt)
-if test "x${with_pkg_config}" = x1 ; then
+if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[POPT], [popt],
[LIBS="${POPT_LIBS} ${LIBS}"
@@ -50,54 +50,41 @@ else
fi
AC_ARG_WITH([dummy],[ --with-dummy = include the dummy audio back end ],[AC_MSG_RESULT(>>Including the dummy audio back end) AC_DEFINE([CONFIG_DUMMY], 1, [Needed by the compiler.]) ], )
-AM_CONDITIONAL([USE_DUMMY], [test "x$with_dummy" = "x1" ])
+AM_CONDITIONAL([USE_DUMMY], [test "x$with_dummy" = "xyes" ])
AC_ARG_WITH([stdout],[ --with-stdout = include the stdout audio back end ],[ AC_MSG_RESULT(>>Including the stdout audio back end) AC_DEFINE([CONFIG_STDOUT], 1, [Needed by the compiler.]) ], )
-AM_CONDITIONAL([USE_STDOUT], [test "x$with_stdout" = "x1" ])
+
+AM_CONDITIONAL([USE_STDOUT], [test "x$with_stdout" = "xyes" ])
AC_ARG_WITH([pipe],[ --with-pipe = include the pipe audio back end ],[ AC_MSG_RESULT(>>Including the pipe audio back end) AC_DEFINE([CONFIG_PIPE], 1, [Needed by the compiler.]) ], )
-AM_CONDITIONAL([USE_PIPE], [test "x$with_pipe" = "x1" ])
+AM_CONDITIONAL([USE_PIPE], [test "x$with_pipe" = "xyes" ])
-AC_ARG_WITH([initscript],
-[ --with-initscript = include a startup script], ,[with_initscript=1])
-AM_CONDITIONAL([INSTALL_INITSCRIPT], [test "x$with_initscript" = "x1"])
+# Check to see if we should include the System V initscript
+
+AC_ARG_WITH([systemv],
+[ --with-systemv = include a startup script], , )
+AM_CONDITIONAL([INSTALL_SYSTEMV], [test "x$with_systemv" = "xyes"])
+
+# Check to see if we should include the systemd stuff to define it as a service
AC_ARG_WITH([systemd],
-[ --with-systemd = include a systemd service], ,[with_systemd=1])
-AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "x1"])
+[ --with-systemd = include a systemd service], , )
+AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "xyes"])
-# Check if we want to support reading arguments from the command line
-AC_ARG_WITH([command_line_argument_support],
-[ --with-command-line-argument-support = read configuration from command line arguments], ,[with_command_line_argument_support=1])
-
-if test "x${with_command_line_argument_support}" = x1 ; then
- AC_MSG_RESULT(>>Including command line argument support)
- AC_DEFINE([COMMAND_LINE_ARGUMENT_SUPPORT],[1],[Define to 1 if you want to support command line arguments])
-fi
-
-# Check if we want to support reading from a configuration file chosen -- i.e. take parameters from /etc/shairport-sync.conf
-AC_ARG_WITH([configfile_support],
-[ --with-configfile-support = support reading of configuration from a configuration file], ,[with_configfile_support=1])
-
-if test "x${with_configfile_support}" = x1 ; then
- AC_MSG_RESULT(>>Including configuration file support)
- if test "x${with_pkg_config}" = x1 ; then
- PKG_CHECK_MODULES(
- [LIBCONFIG], [libconfig],
- [LIBS="${LIBCONFIG_LIBS} ${LIBS}"])
- else
- AC_CHECK_LIB([config],[config_init], , AC_MSG_ERROR([libconfig library needed]))
- fi
- AC_DEFINE([SUPPORT_CONFIG_FILES],[1],[Define to 1 if you want to support configuration files])
+# Add the libconfig package
+if test "x${with_pkg_config}" = xyes ; then
+ PKG_CHECK_MODULES(
+ [LIBCONFIG], [libconfig],
+ [LIBS="${LIBCONFIG_LIBS} ${LIBS}"])
+else
+ AC_CHECK_LIB([config],[config_init], , AC_MSG_ERROR([libconfig library needed]))
fi
AC_ARG_WITH([configfiles],
-[ --with-configfiles = include configuration files in installation ], ,[with_configfiles=1])
-AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "x1" -a "x$with_configfile_support" = "x1" ])
+[ --with-configfiles = include configuration files in installation ], ,[with_configfiles=yes])
+AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"])
-# Check to see if we should include the initscript
-
# Look for piddir flag
AC_ARG_WITH(piddir, [ --with-piddir= Specify a pathname to a directory in which to write the PID file.], [
AC_MSG_CHECKING(--with-piddir argument)
@@ -146,9 +133,8 @@ AC_ARG_WITH(soxr, [ --with-soxr = choose libsoxr for high-quality interpolation
# Look for metadata flag -- set flag for conditional compilation
AC_ARG_WITH(metadata, [ --with-metadata = include support for a metadata feed], [
AC_MSG_RESULT(>>Including metadata support)
- HAS_METADATA=1
AC_DEFINE([CONFIG_METADATA], 1, [Needed by the compiler.])], )
-AM_CONDITIONAL([USE_METADATA], [test "x$HAS_METADATA" = "x1"])
+AM_CONDITIONAL([USE_METADATA], [test "x$with_metadata" = "xyes"])
# What follows is a bit messy, because if the relevant library is requested, a compiler flag is defined, a file is included in the compilation
# and the relevant link files are added.
From d570a14fbf930cf8fc483c1cbc6d4ec5da187541 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:44:08 +0200
Subject: [PATCH 07/44] Add the identifier freebsd -- we might begin to make
more use of it in the future
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index e74a187d..11ae3daf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,7 @@ AC_CONFIG_HEADERS([config.h])
#
# Specifying the OS type, defaulting to linux.
#
-AC_ARG_WITH(os_type, AS_HELP_STRING([--with-os-type=OSType],[Specify the distribution to target: One of linux darwin]))
+AC_ARG_WITH(os_type, AS_HELP_STRING([--with-os-type=OSType],[Specify the distribution to target: One of linux freebsd or darwin]))
if test "z$with_os_type" = "z"; then
with_os_type="linux"
fi
@@ -24,7 +24,7 @@ AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG([0.9.0])
# Checks for libraries.
-if test "x${with_os_type}" = xlinux; then
+if test "x${with_os_type}" = xlinux -o "x${with_os_type}" = xfreebsd ; then
AC_CHECK_LIB([rt],[clock_gettime], , AC_MSG_ERROR(librt needed))
fi
From 8637a23af7fd318a9290a8d50aeaaca1f4943098 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 14:50:45 +0200
Subject: [PATCH 08/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 9c395a7d..358002a4 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -6,7 +6,7 @@ Version 2.3.8
* Changes
* Support for installing into `systemd` and Fedora systems. For `systemd` support, use the configuration flag `--with-systemd` in place of `--with-systemv`.
* Renamed `with-initscript` configuration flag to `with-systemv` to better describe its role.
- * System V startup script is no longer enabled by default; if you want is, ask for it with the `--with-systemv` configuration flag.
+ * System V startup script is no longer enabled by default; if you want it, ask for it with the `--with-systemv` configuration flag.
* Added limited support for FreeBSD. You must specify `LDFLAGS='-I/usr/local/lib'` and `CPPFLAGS='-L/usr/local/include'` before running `./configure --with-foo etc.`
* Removed "-configfile" annotation from the version string because it'n no longer optional; it's always there.
* Removed the `dummy`, `pipe` and `stdout` backends from the standard build -- they are now optional and are no longer automatically included in the build.
From 565d3458e5ca655f2dbcde707560dd7e8c741b21 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 1 Aug 2015 15:38:44 +0200
Subject: [PATCH 09/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 358002a4..890151b0 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,19 +1,19 @@
Version 2.3.8
----
* Pesky changes you must make
- * You must change the `./configure` arguments. The flag `with-initscript` has changed to `with-systemv`. It was previously enabled by default; now you must enable it explicitly.
+ * You probably need to change your `./configure` arguments. The flag `with-initscript` has changed to `with-systemv`. It was previously enabled by default; now you must enable it explicitly.
* Changes
- * Support for installing into `systemd` and Fedora systems. For `systemd` support, use the configuration flag `--with-systemd` in place of `--with-systemv`.
+ * Support for installing into `systemd` and Fedora systems. For `systemd` support, use the configuration flag `--with-systemd` in place of `--with-systemv`. (Arch Linux users should continue to use the package provided by Elia Cereda.)
* Renamed `with-initscript` configuration flag to `with-systemv` to better describe its role.
* System V startup script is no longer enabled by default; if you want it, ask for it with the `--with-systemv` configuration flag.
* Added limited support for FreeBSD. You must specify `LDFLAGS='-I/usr/local/lib'` and `CPPFLAGS='-L/usr/local/include'` before running `./configure --with-foo etc.`
- * Removed "-configfile" annotation from the version string because it'n no longer optional; it's always there.
- * Removed the `dummy`, `pipe` and `stdout` backends from the standard build -- they are now optional and are no longer automatically included in the build.
+ * Removed the `-configfile` annotation from the version string because it's no longer optional; it's always there.
+ * Removed the `dummy`, `pipe` and `stdout` backends from the standard build – they are now optional and are no longer automatically included in the build.
* Bug fixes
- * Allow more stack space to prevent a segfault in certain configurations. Thanks @joerg-krause.
- * Add missing header files. Thanks @joerg-krause.
+ * Allow more stack space to prevent a segfault in certain configurations (thanks to https://github.com/joerg-krause).
+ * Add missing header files(thanks to https://github.com/joerg-krause).
* Removed some (hopefully) mostly silent bugs from the configure.ac file.
Version 2.3.7
From 30907b130df51156e9e0e2251ce1b7acf6edea69 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sun, 2 Aug 2015 12:38:40 +0200
Subject: [PATCH 10/44] Update configure.ac
---
configure.ac | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 11ae3daf..06c1c620 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,13 +62,13 @@ AM_CONDITIONAL([USE_PIPE], [test "x$with_pipe" = "xyes" ])
# Check to see if we should include the System V initscript
AC_ARG_WITH([systemv],
-[ --with-systemv = include a startup script], , )
+[ --with-systemv = install a System V startup script during a make install], , )
AM_CONDITIONAL([INSTALL_SYSTEMV], [test "x$with_systemv" = "xyes"])
# Check to see if we should include the systemd stuff to define it as a service
AC_ARG_WITH([systemd],
-[ --with-systemd = include a systemd service], , )
+[ --with-systemd = install a systemd service description file during a make install], , )
AM_CONDITIONAL([INSTALL_SYSTEMD], [test "x$with_systemd" = "xyes"])
# Add the libconfig package
@@ -81,7 +81,7 @@ else
fi
AC_ARG_WITH([configfiles],
-[ --with-configfiles = include configuration files in installation ], ,[with_configfiles=yes])
+[ --with-configfiles = install configuration files during a make install ], ,[with_configfiles=yes])
AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"])
From 04fadca49786fbd9541f5dd929dfa7e9d00d22c6 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sun, 2 Aug 2015 12:39:46 +0200
Subject: [PATCH 11/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 890151b0..74afcbbd 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,6 +1,6 @@
Version 2.3.8
----
-* Pesky changes you must make
+* Annoying changes you must make
* You probably need to change your `./configure` arguments. The flag `with-initscript` has changed to `with-systemv`. It was previously enabled by default; now you must enable it explicitly.
* Changes
From 07af6b1001a57b18598097b381c63d404afa7e9a Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sun, 2 Aug 2015 12:46:37 +0200
Subject: [PATCH 12/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 74afcbbd..fbdf268f 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -4,9 +4,9 @@ Version 2.3.8
* You probably need to change your `./configure` arguments. The flag `with-initscript` has changed to `with-systemv`. It was previously enabled by default; now you must enable it explicitly.
* Changes
- * Support for installing into `systemd` and Fedora systems. For `systemd` support, use the configuration flag `--with-systemd` in place of `--with-systemv`. (Arch Linux users should continue to use the package provided by Elia Cereda.)
- * Renamed `with-initscript` configuration flag to `with-systemv` to better describe its role.
- * System V startup script is no longer enabled by default; if you want it, ask for it with the `--with-systemv` configuration flag.
+ * Added limited support for installing into `systemd` and Fedora systems. For `systemd` support, use the configuration flag `--with-systemd` in place of `--with-systemv`. The installation does not do everything needed, such as defining special users and groups.
+ * Renamed `with-initscript` configuration flag to `with-systemv` to describe its role more accurately.
+ * A System V startup script is no longer installed by default; if you want it, ask for it with the `--with-systemv` configuration flag.
* Added limited support for FreeBSD. You must specify `LDFLAGS='-I/usr/local/lib'` and `CPPFLAGS='-L/usr/local/include'` before running `./configure --with-foo etc.`
* Removed the `-configfile` annotation from the version string because it's no longer optional; it's always there.
* Removed the `dummy`, `pipe` and `stdout` backends from the standard build – they are now optional and are no longer automatically included in the build.
From b365f16b2f307a8bc0689dfcef96b3c9bf795ac5 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 11:07:30 +0200
Subject: [PATCH 13/44] Make configuration file spec work correctly if it's
relative; honour debug verbosity from the very start
---
configure.ac | 2 +-
shairport.c | 404 +++++++++++++++++++++------------------
var/shairport-sync.conf | 6 +
var/shairport-sync.conf~ | 6 +
4 files changed, 230 insertions(+), 188 deletions(-)
create mode 100644 var/shairport-sync.conf
create mode 100644 var/shairport-sync.conf~
diff --git a/configure.ac b/configure.ac
index 06c1c620..8824e600 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.3.8], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.3.9], [mikebrady@eircom.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
diff --git a/shairport.c b/shairport.c
index b77b1807..8acd523b 100644
--- a/shairport.c
+++ b/shairport.c
@@ -62,7 +62,8 @@
static int shutting_down = 0;
static char *appName = NULL;
-char configuration_file_path[4096];
+char configuration_file_path[4096+1];
+char actual_configuration_file_path[4096+1];
void shairport_shutdown() {
if (shutting_down)
@@ -267,200 +268,222 @@ int parse_options(int argc, char **argv) {
optCon = poptGetContext(NULL, optind, (const char **)argv, optionsTable, 0);
poptSetOtherOptionHelp(optCon, "[OPTIONS]* ");
+
+ /* Now do options processing just to get a debug level */
+ debuglev = 0;
+ while ((c = poptGetNextOpt(optCon)) >= 0) {
+ switch (c) {
+ case 'v':
+ debuglev++;
+ break;
+ }
+ }
+ if (c < -1) {
+ die("%s: %s", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(c));
+ }
config_setting_t *setting;
const char *str;
int value;
+ debug(1,"Looking for the configuration file \"%s\".",config.configfile);
+
config_init(&config_file_stuff);
- debug(1, "Looking for configuration file \"%s\"", config.configfile);
- /* Read the file. If there is an error, report it and exit. */
- if (config_read_file(&config_file_stuff, config.configfile)) {
- // make config.cfg point to it
- config.cfg = &config_file_stuff;
- /* Get the Service Name. */
- if (config_lookup_string(config.cfg, "general.name", &str))
- config.apname = (char *)str;
-
- /* Get the Daemonize setting. */
- if (config_lookup_string(config.cfg, "general.daemonize", &str)) {
- if (strcasecmp(str, "no") == 0)
- config.daemonise = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.daemonise = 1;
- else
- die("Invalid daemonize option choice \"%s\". It should be \"yes\" or \"no\"");
- }
-
- /* Get the mdns_backend setting. */
- if (config_lookup_string(config.cfg, "general.mdns_backend", &str))
- config.mdns_name = (char *)str;
-
- /* Get the output_backend setting. */
- if (config_lookup_string(config.cfg, "general.output_backend", &str))
- config.output_name = (char *)str;
-
- /* Get the port setting. */
- if (config_lookup_int(config.cfg, "general.port", &value)) {
- if ((value < 0) || (value > 65535))
- die("Invalid port number \"%sd\". It should be between 0 and 65535, default is 5000",
- value);
- else
- config.port = value;
- }
-
- /* Get the udp port base setting. */
- if (config_lookup_int(config.cfg, "general.udp_port_base", &value)) {
- if ((value < 0) || (value > 65535))
- die("Invalid port number \"%sd\". It should be between 0 and 65535, default is 6001",
- value);
- else
- config.udp_port_base = value;
- }
-
- /* Get the udp port range setting. This is number of ports that will be tried for free ports , starting at the port base. Only three ports are needed. */
- if (config_lookup_int(config.cfg, "general.udp_port_range", &value)) {
- if ((value < 0) || (value > 65535))
- die("Invalid port range \"%sd\". It should be between 0 and 65535, default is 100",
- value);
- else
- config.udp_port_range = value;
- }
-
- /* Get the password setting. */
- if (config_lookup_string(config.cfg, "general.password", &str))
- config.password = (char *)str;
-
- if (config_lookup_string(config.cfg, "general.interpolation", &str)) {
- if (strcasecmp(str, "basic") == 0)
- config.packet_stuffing = ST_basic;
- else if (strcasecmp(str, "soxr") == 0)
- config.packet_stuffing = ST_soxr;
- else
- die("Invalid interpolation option choice \"%s\". It should be \"basic\" or \"soxr\"");
- }
-
- /* Get the statistics setting. */
- if (config_lookup_string(config.cfg, "general.statistics", &str)) {
- if (strcasecmp(str, "no") == 0)
- config.statistics_requested = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.statistics_requested = 1;
- else
- die("Invalid statistics option choice \"%s\". It should be \"yes\" or \"no\"");
- }
-
- /* Get the drift tolerance setting. */
- if (config_lookup_int(config.cfg, "general.drift", &value))
- config.tolerance = value;
-
- /* Get the resync setting. */
- if (config_lookup_int(config.cfg, "general.resync_threshold", &value))
- config.resyncthreshold = value;
-
- /* Get the verbosity setting. */
- if (config_lookup_int(config.cfg, "general.log_verbosity", &value))
- if ((value >= 0) && (value <= 3))
- debuglev = value;
- else
- die("Invalid log verbosity setting option choice \"%d\". It should be between 0 and 3, "
- "inclusive.",
- value);
-
- /* Get the ignore_volume_control setting. */
- if (config_lookup_string(config.cfg, "general.ignore_volume_control", &str)) {
- if (strcasecmp(str, "no") == 0)
- config.ignore_volume_control = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.ignore_volume_control = 1;
- else
- die("Invalid ignore_volume_control option choice \"%s\". It should be \"yes\" or \"no\"");
- }
-
- /* Get the default latency. */
- if (config_lookup_int(config.cfg, "latencies.default", &value))
- config.latency = value;
-
- /* Get the itunes latency. */
- if (config_lookup_int(config.cfg, "latencies.itunes", &value))
- config.iTunesLatency = value;
-
- /* Get the AirPlay latency. */
- if (config_lookup_int(config.cfg, "latencies.airplay", &value))
- config.AirPlayLatency = value;
-
- /* Get the forkedDaapd latency. */
- if (config_lookup_int(config.cfg, "latencies.forkedDaapd", &value))
- config.ForkedDaapdLatency = value;
-
-#ifdef CONFIG_METADATA
- /* Get the metadata setting. */
- if (config_lookup_string(config.cfg, "metadata.enabled", &str)) {
- if (strcasecmp(str, "no") == 0)
- config.metadata_enabled = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.metadata_enabled = 1;
- else
- die("Invalid metadata enabled option choice \"%s\". It should be \"yes\" or \"no\"");
- }
-
- if (config_lookup_string(config.cfg, "metadata.include_cover_art", &str)) {
- if (strcasecmp(str, "no") == 0)
- config.get_coverart = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.get_coverart = 1;
- else
- die("Invalid metadata include_cover_art option choice \"%s\". It should be \"yes\" or "
- "\"no\"");
- }
-
- if (config_lookup_string(config.cfg, "metadata.pipe_name", &str)) {
- config.metadata_pipename = (char *)str;
- }
-#endif
-
- if (config_lookup_string(config.cfg, "sessioncontrol.run_this_before_play_begins", &str)) {
- config.cmd_start = (char *)str;
- }
-
- if (config_lookup_string(config.cfg, "sessioncontrol.run_this_after_play_ends", &str)) {
- config.cmd_stop = (char *)str;
- }
-
- if (config_lookup_string(config.cfg, "sessioncontrol.wait_for_completion", &str)) {
- if (strcasecmp(str, "no") == 0)
- config.cmd_blocking = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.cmd_blocking = 1;
- else
- die("Invalid session control wait_for_completion option choice \"%s\". It should be "
- "\"yes\" or \"no\"");
- }
-
- if (config_lookup_string(config.cfg, "sessioncontrol.allow_session_interruption", &str)) {
- config.dont_check_timeout = 0; // this is for legacy -- only set by -t 0
- if (strcasecmp(str, "no") == 0)
- config.allow_session_interruption = 0;
- else if (strcasecmp(str, "yes") == 0)
- config.allow_session_interruption = 1;
- else
- die("Invalid session control allow_interruption option choice \"%s\". It should be \"yes\" "
- "or \"no\"");
- }
-
- if (config_lookup_int(config.cfg, "sessioncontrol.session_timeout", &value)) {
- config.timeout = value;
- config.dont_check_timeout = 0; // this is for legacy -- only set by -t 0
- }
-
+
+ char *config_file_real_path = realpath(config.configfile, NULL);
+ if (config_file_real_path==NULL) {
+ debug(2,"Can't resolve the configuration file \"%s\".",config.configfile);
} else {
- if (config_error_type(&config_file_stuff) == CONFIG_ERR_FILE_IO)
- debug(1, "Error reading configuration file \"%s\": \"%s\".",
+ debug(2, "Looking for configuration file at full path \"%s\"", config_file_real_path);
+ /* Read the file. If there is an error, report it and exit. */
+ if (config_read_file(&config_file_stuff, config_file_real_path)) {
+ // make config.cfg point to it
+ config.cfg = &config_file_stuff;
+ /* Get the Service Name. */
+ if (config_lookup_string(config.cfg, "general.name", &str))
+ config.apname = (char *)str;
+
+ /* Get the Daemonize setting. */
+ if (config_lookup_string(config.cfg, "general.daemonize", &str)) {
+ if (strcasecmp(str, "no") == 0)
+ config.daemonise = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.daemonise = 1;
+ else
+ die("Invalid daemonize option choice \"%s\". It should be \"yes\" or \"no\"");
+ }
+
+ /* Get the mdns_backend setting. */
+ if (config_lookup_string(config.cfg, "general.mdns_backend", &str))
+ config.mdns_name = (char *)str;
+
+ /* Get the output_backend setting. */
+ if (config_lookup_string(config.cfg, "general.output_backend", &str))
+ config.output_name = (char *)str;
+
+ /* Get the port setting. */
+ if (config_lookup_int(config.cfg, "general.port", &value)) {
+ if ((value < 0) || (value > 65535))
+ die("Invalid port number \"%sd\". It should be between 0 and 65535, default is 5000",
+ value);
+ else
+ config.port = value;
+ }
+
+ /* Get the udp port base setting. */
+ if (config_lookup_int(config.cfg, "general.udp_port_base", &value)) {
+ if ((value < 0) || (value > 65535))
+ die("Invalid port number \"%sd\". It should be between 0 and 65535, default is 6001",
+ value);
+ else
+ config.udp_port_base = value;
+ }
+
+ /* Get the udp port range setting. This is number of ports that will be tried for free ports , starting at the port base. Only three ports are needed. */
+ if (config_lookup_int(config.cfg, "general.udp_port_range", &value)) {
+ if ((value < 0) || (value > 65535))
+ die("Invalid port range \"%sd\". It should be between 0 and 65535, default is 100",
+ value);
+ else
+ config.udp_port_range = value;
+ }
+
+ /* Get the password setting. */
+ if (config_lookup_string(config.cfg, "general.password", &str))
+ config.password = (char *)str;
+
+ if (config_lookup_string(config.cfg, "general.interpolation", &str)) {
+ if (strcasecmp(str, "basic") == 0)
+ config.packet_stuffing = ST_basic;
+ else if (strcasecmp(str, "soxr") == 0)
+ config.packet_stuffing = ST_soxr;
+ else
+ die("Invalid interpolation option choice \"%s\". It should be \"basic\" or \"soxr\"");
+ }
+
+ /* Get the statistics setting. */
+ if (config_lookup_string(config.cfg, "general.statistics", &str)) {
+ if (strcasecmp(str, "no") == 0)
+ config.statistics_requested = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.statistics_requested = 1;
+ else
+ die("Invalid statistics option choice \"%s\". It should be \"yes\" or \"no\"");
+ }
+
+ /* Get the drift tolerance setting. */
+ if (config_lookup_int(config.cfg, "general.drift", &value))
+ config.tolerance = value;
+
+ /* Get the resync setting. */
+ if (config_lookup_int(config.cfg, "general.resync_threshold", &value))
+ config.resyncthreshold = value;
+
+ /* Get the verbosity setting. */
+ if (config_lookup_int(config.cfg, "general.log_verbosity", &value))
+ if ((value >= 0) && (value <= 3))
+ debuglev = value;
+ else
+ die("Invalid log verbosity setting option choice \"%d\". It should be between 0 and 3, "
+ "inclusive.",
+ value);
+
+ /* Get the ignore_volume_control setting. */
+ if (config_lookup_string(config.cfg, "general.ignore_volume_control", &str)) {
+ if (strcasecmp(str, "no") == 0)
+ config.ignore_volume_control = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.ignore_volume_control = 1;
+ else
+ die("Invalid ignore_volume_control option choice \"%s\". It should be \"yes\" or \"no\"");
+ }
+
+ /* Get the default latency. */
+ if (config_lookup_int(config.cfg, "latencies.default", &value))
+ config.latency = value;
+
+ /* Get the itunes latency. */
+ if (config_lookup_int(config.cfg, "latencies.itunes", &value))
+ config.iTunesLatency = value;
+
+ /* Get the AirPlay latency. */
+ if (config_lookup_int(config.cfg, "latencies.airplay", &value))
+ config.AirPlayLatency = value;
+
+ /* Get the forkedDaapd latency. */
+ if (config_lookup_int(config.cfg, "latencies.forkedDaapd", &value))
+ config.ForkedDaapdLatency = value;
+
+ #ifdef CONFIG_METADATA
+ /* Get the metadata setting. */
+ if (config_lookup_string(config.cfg, "metadata.enabled", &str)) {
+ if (strcasecmp(str, "no") == 0)
+ config.metadata_enabled = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.metadata_enabled = 1;
+ else
+ die("Invalid metadata enabled option choice \"%s\". It should be \"yes\" or \"no\"");
+ }
+
+ if (config_lookup_string(config.cfg, "metadata.include_cover_art", &str)) {
+ if (strcasecmp(str, "no") == 0)
+ config.get_coverart = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.get_coverart = 1;
+ else
+ die("Invalid metadata include_cover_art option choice \"%s\". It should be \"yes\" or "
+ "\"no\"");
+ }
+
+ if (config_lookup_string(config.cfg, "metadata.pipe_name", &str)) {
+ config.metadata_pipename = (char *)str;
+ }
+ #endif
+
+ if (config_lookup_string(config.cfg, "sessioncontrol.run_this_before_play_begins", &str)) {
+ config.cmd_start = (char *)str;
+ }
+
+ if (config_lookup_string(config.cfg, "sessioncontrol.run_this_after_play_ends", &str)) {
+ config.cmd_stop = (char *)str;
+ }
+
+ if (config_lookup_string(config.cfg, "sessioncontrol.wait_for_completion", &str)) {
+ if (strcasecmp(str, "no") == 0)
+ config.cmd_blocking = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.cmd_blocking = 1;
+ else
+ die("Invalid session control wait_for_completion option choice \"%s\". It should be "
+ "\"yes\" or \"no\"");
+ }
+
+ if (config_lookup_string(config.cfg, "sessioncontrol.allow_session_interruption", &str)) {
+ config.dont_check_timeout = 0; // this is for legacy -- only set by -t 0
+ if (strcasecmp(str, "no") == 0)
+ config.allow_session_interruption = 0;
+ else if (strcasecmp(str, "yes") == 0)
+ config.allow_session_interruption = 1;
+ else
+ die("Invalid session control allow_interruption option choice \"%s\". It should be \"yes\" "
+ "or \"no\"");
+ }
+
+ if (config_lookup_int(config.cfg, "sessioncontrol.session_timeout", &value)) {
+ config.timeout = value;
+ config.dont_check_timeout = 0; // this is for legacy -- only set by -t 0
+ }
+
+ } else {
+ if (config_error_type(&config_file_stuff) == CONFIG_ERR_FILE_IO)
+ debug(1, "Error reading configuration file \"%s\": \"%s\".",
+ config_error_file(&config_file_stuff), config_error_text(&config_file_stuff));
+ else {
+ die("Line %d of the configuration file \"%s\":\n%s", config_error_line(&config_file_stuff),
config_error_file(&config_file_stuff), config_error_text(&config_file_stuff));
- else {
- die("Line %d of the configuration file \"%s\":\n%s", config_error_line(&config_file_stuff),
- config_error_file(&config_file_stuff), config_error_text(&config_file_stuff));
+ }
}
+ free(config_file_real_path);
}
// now, do the command line options again, but this time do them fully -- it's a unix convention that command line
@@ -820,7 +843,14 @@ int main(int argc, char **argv) {
debug(2, "audio backend desired buffer length is %d.",
config.audio_backend_buffer_desired_length);
debug(2, "audio backend latency offset is %d.", config.audio_backend_latency_offset);
- debug(2, "Configuration file name \"%s\".", config.configfile);
+
+ char *realConfigPath = realpath(config.configfile,NULL);
+ if (realConfigPath) {
+ debug(2, "configuration file name \"%s\" resolves to \"%s\".", config.configfile,realConfigPath);
+ free(realConfigPath);
+ } else {
+ debug(2, "configuration file name \"%s\" can not be resolved.", config.configfile);
+ }
#ifdef CONFIG_METADATA
debug(2, "metdata enabled is %d.", config.metadata_enabled);
debug(2, "metadata pipename is \"%s\".", config.metadata_pipename);
diff --git a/var/shairport-sync.conf b/var/shairport-sync.conf
new file mode 100644
index 00000000..93524e37
--- /dev/null
+++ b/var/shairport-sync.conf
@@ -0,0 +1,6 @@
+general =
+{
+ port = 8303;
+ udp_port_base = 8303;
+ udp_port_range = 10;
+};
diff --git a/var/shairport-sync.conf~ b/var/shairport-sync.conf~
new file mode 100644
index 00000000..93524e37
--- /dev/null
+++ b/var/shairport-sync.conf~
@@ -0,0 +1,6 @@
+general =
+{
+ port = 8303;
+ udp_port_base = 8303;
+ udp_port_range = 10;
+};
From 55c11037a0e724ba02dbac3abe2efeb817dd6a71 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 11:08:22 +0200
Subject: [PATCH 14/44] Un-include test files, duh.
---
var/shairport-sync.conf | 6 ------
var/shairport-sync.conf~ | 6 ------
2 files changed, 12 deletions(-)
delete mode 100644 var/shairport-sync.conf
delete mode 100644 var/shairport-sync.conf~
diff --git a/var/shairport-sync.conf b/var/shairport-sync.conf
deleted file mode 100644
index 93524e37..00000000
--- a/var/shairport-sync.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-general =
-{
- port = 8303;
- udp_port_base = 8303;
- udp_port_range = 10;
-};
diff --git a/var/shairport-sync.conf~ b/var/shairport-sync.conf~
deleted file mode 100644
index 93524e37..00000000
--- a/var/shairport-sync.conf~
+++ /dev/null
@@ -1,6 +0,0 @@
-general =
-{
- port = 8303;
- udp_port_base = 8303;
- udp_port_range = 10;
-};
From bd5a89d4fbcc787a91206db49089860bcc41dd98 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 12:03:54 +0200
Subject: [PATCH 15/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index fbdf268f..fb6066b2 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,3 +1,9 @@
+Version 2.3.9
+----
+* Bug fix
+ * Specifying the configuration file using a *relative* file path now works properly.
+ * The debug verbosity requested with `-v`, `-vv`, etc. is now honoured before the configuration file is read. It is read and honoured from when the command line arguments are scanned the first time to get a possible configuration file path.
+
Version 2.3.8
----
* Annoying changes you must make
From fdbf64e9a6857235c41c905a75466dd7cc5e533d Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 14:29:58 +0200
Subject: [PATCH 16/44] Make output non-blocking; don't allow the pipe to be
stdout
---
audio_pipe.c | 45 ++++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/audio_pipe.c b/audio_pipe.c
index 210f99f9..d38cd8f8 100644
--- a/audio_pipe.c
+++ b/audio_pipe.c
@@ -40,24 +40,32 @@ static int fd = -1;
char *pipename = NULL;
static void start(int sample_rate) {
- debug(1, "Pipename to start is \"%s\"", pipename);
- if (strcasecmp(pipename, "STDOUT") == 0)
- fd = STDOUT_FILENO;
- else
- fd = open(pipename, O_WRONLY);
+ // this will leave fd as -1 if a reader hasn't been attached
+ fd = open(pipename, O_WRONLY | O_NONBLOCK);
}
-static void play(short buf[], int samples) { int ignore = write(fd, buf, samples * 4); }
+static void play(short buf[], int samples) {
+ // if the file is not open, try to open it.
+ if (fd == -1) {
+ fd = open(pipename, O_WRONLY | O_NONBLOCK);
+ }
+ // if it's got a reader, write to it.
+ if (fd != -1) {
+ int ignore = non_blocking_write(fd, buf, samples * 4);
+ }
+}
static void stop(void) {
- if (fd != STDOUT_FILENO)
- close(fd);
+// Don't close the pipe just because a play session has stopped.
+// if (fd > 0)
+// close(fd);
}
static int init(int argc, char **argv) {
+ debug(1, "pipe init");
const char *str;
int value;
-
+
config.audio_backend_buffer_desired_length = 44100; // one second.
config.audio_backend_latency_offset = 0;
@@ -67,6 +75,9 @@ static int init(int argc, char **argv) {
if (config_lookup_string(config.cfg, "pipe.name", &str)) {
pipename = (char *)str;
}
+
+ if ((pipename) && (strcasecmp(pipename, "STDOUT") == 0))
+ die("Can't use \"pipe\" backend for STDOUT. Use the \"stdout\" backend instead.");
/* Get the desired buffer size setting. */
if (config_lookup_int(config.cfg, "pipe.audio_backend_buffer_desired_length", &value)) {
@@ -86,29 +97,25 @@ static int init(int argc, char **argv) {
config.audio_backend_latency_offset = value;
}
}
-
+
if ((pipename == NULL) && (argc != 1))
die("bad or missing argument(s) to pipe");
if (argc == 1)
pipename = strdup(argv[0]);
-
+
+
// here, create the pipe
- if (strcasecmp(pipename, "STDOUT") != 0)
- if (mkfifo(pipename, 0644) && errno != EEXIST)
- die("Could not create output pipe \"%s\"", pipename);
+ if (mkfifo(pipename, 0644) && errno != EEXIST)
+ die("Could not create output pipe \"%s\"", pipename);
debug(1, "Pipename is \"%s\"", pipename);
- // test open pipe so we error on startup if it's going to fail
- start(44100);
- stop();
-
return 0;
}
static void deinit(void) {
- if ((fd > 0) && (fd != STDOUT_FILENO))
+ if (fd > 0)
close(fd);
}
From 1b52e26f8fdc03a8dabd2934a10381bab3194e44 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 14:30:44 +0200
Subject: [PATCH 17/44] Move non-blocking-write code here from rtsp.c
---
common.c | 26 ++++++++++++++++++++++++++
common.h | 2 ++
2 files changed, 28 insertions(+)
diff --git a/common.c b/common.c
index fb8702e0..bb6dafa2 100644
--- a/common.c
+++ b/common.c
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
@@ -510,3 +511,28 @@ uint64_t get_absolute_time_in_fp() {
#endif
return time_now_fp;
}
+
+ssize_t non_blocking_write(int fd, const void *buf, size_t count) {
+ // debug(1,"writing %u to pipe...",count);
+ // we are assuming that the count is always smaller than the FIFO's buffer
+ struct pollfd ufds[1];
+ ssize_t reply;
+ do {
+ ufds[0].fd = fd;
+ ufds[0].events = POLLOUT;
+ int rv = poll(ufds, 1, 5000);
+ if (rv == -1)
+ debug(1, "error waiting for pipe to unblock...");
+ if (rv == 0)
+ debug(1, "timeout waiting for pipe to unblock");
+ reply = write(fd, buf, count);
+ if ((reply == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)))
+ debug(1, "writing to pipe will block...");
+ // else
+ // debug(1,"writing %u to pipe done...",reply);
+ } while ((reply == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)));
+ return reply;
+
+ // return write(fd,buf,count);
+}
+
diff --git a/common.h b/common.h
index 2ed250a2..4a6c44f0 100644
--- a/common.h
+++ b/common.h
@@ -90,6 +90,8 @@ int get_requested_connection_state_to_output();
void set_requested_connection_state_to_output(int v);
+ssize_t non_blocking_write(int fd, const void *buf, size_t count); // used in a few places
+
int debuglev;
void die(char *format, ...);
void warn(char *format, ...);
From 84307f6beb7ae1b6d0da6a0f1da10b07c5e8899a Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 14:31:40 +0200
Subject: [PATCH 18/44] Move non-blocking-write code from here to common
---
rtsp.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/rtsp.c b/rtsp.c
index 1a81b98f..9340dbfb 100644
--- a/rtsp.c
+++ b/rtsp.c
@@ -922,30 +922,6 @@ static void metadata_close(void) {
fd = -1;
}
-ssize_t non_blocking_write(int fd, const void *buf, size_t count) {
- // debug(1,"writing %u to pipe...",count);
- // we are assuming that the count is always smaller than the FIFO's buffer
- struct pollfd ufds[1];
- ssize_t reply;
- do {
- ufds[0].fd = fd;
- ufds[0].events = POLLOUT;
- int rv = poll(ufds, 1, 5000);
- if (rv == -1)
- debug(1, "error waiting for pipe to unblock...");
- if (rv == 0)
- debug(1, "timeout waiting for pipe to unblock");
- reply = write(fd, buf, count);
- if ((reply == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)))
- debug(1, "writing to pipe will block...");
- // else
- // debug(1,"writing %u to pipe done...",reply);
- } while ((reply == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)));
- return reply;
-
- // return write(fd,buf,count);
-}
-
void metadata_process(uint32_t type, uint32_t code, char *data, uint32_t length) {
debug(2, "Process metadata with type %x, code %x and length %u.", type, code, length);
int ret;
From 60e5f18165fb05e67a20409b3300a47292ac9467 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 14:32:56 +0200
Subject: [PATCH 19/44] Bump bugfix number
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 8824e600..b31cbb07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.3.9], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.3.10], [mikebrady@eircom.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
From 586f4e72136088b81a215049420c225349bdbb20 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 15:17:21 +0200
Subject: [PATCH 20/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index fb6066b2..717f12cd 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,3 +1,12 @@
+Version 2.3.10
+----
+* Bug fix
+ * The "pipe" backend used output code that would block if the pipe didn't have a reader. This has been replaced by non-blocking code. Here are some implications:
+ * When the pipe is created, Shairport Sync will not block if a reader isn't present.
+ * If the pipe doesn't have a reader when Shairport Sync wants to output to it, the output will be discarded.
+ * If a reader disappears while writing is occuring, the write will time out after five seconds.
+ * Shairport Sync will only close the pipe on termination.
+
Version 2.3.9
----
* Bug fix
From 96a059079a7cf9e020de7059f8e73e8a210897f9 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 6 Aug 2015 15:54:05 +0200
Subject: [PATCH 21/44] Begin to add documentation about the settins in the
configuration file.
---
man/shairport-sync.7 | 150 ++++++++++++++++++++++++++-
man/shairport-sync.7.xml | 212 +++++++++++++++++++++++++++++++++++++-
man/shairport-sync.html | 214 ++++++++++++++++++++++++++++++++++++++-
3 files changed, 572 insertions(+), 4 deletions(-)
diff --git a/man/shairport-sync.7 b/man/shairport-sync.7
index d7c05777..a9302b7d 100644
--- a/man/shairport-sync.7
+++ b/man/shairport-sync.7
@@ -2,7 +2,7 @@
.SH NAME
shairport-sync \- Synchronised Audio Player for iTunes / AirPlay
.SH SYNOPSIS
-\fBshairport-sync [-dvw]\fB [-a \fB\fIname\fB]\fB [-A \fB\fIlatency\fB]\fB [-B \fB\fIcommand\fB]\fB [-E \fB\fIcommand\fB]\fB [--forkedDaapdLatency=\fB\fIlatency\fB]\fB [--get-cover-art]\fB [-i \fB\fIlatency\fB]\fB [-L \fB\fIlatency\fB]\fB [-m \fB\fIbackend\fB]\fB [--meta-dir=\fB\fIdirectory\fB]\fB [-o \fB\fIbackend\fB]\fB [--password=\fB\fIsecret\fB]\fB [-r \fB\fIthreshold\fB]\fB [--statistics]\fB [-S \fB\fImode\fB]\fB [-t \fB\fItimeout\fB]\fB [--tolerance=\fB\fIframes\fB]\fB [-- \fB\fIaudio_backend_options\fB]\fB
+\fBshairport-sync [-dvw]\fB [-a \fB\fIname\fB]\fB [-A \fB\fIlatency\fB]\fB [-B \fB\fIcommand\fB]\fB [-c \fB\fIconfigurationfile\fB]\fB [-E \fB\fIcommand\fB]\fB [--forkedDaapdLatency=\fB\fIlatency\fB]\fB [--get-cover-art]\fB [-i \fB\fIlatency\fB]\fB [-L \fB\fIlatency\fB]\fB [-m \fB\fIbackend\fB]\fB [--meta-dir=\fB\fIdirectory\fB]\fB [-o \fB\fIbackend\fB]\fB [--password=\fB\fIsecret\fB]\fB [-r \fB\fIthreshold\fB]\fB [--statistics]\fB [-S \fB\fImode\fB]\fB [-t \fB\fItimeout\fB]\fB [--tolerance=\fB\fIframes\fB]\fB [-- \fB\fIaudio_backend_options\fB]\fB
shairport-sync -D\fB
@@ -20,6 +20,149 @@ shairport-sync -V\fB
shairport-sync plays audio streamed from iTunes or from an AirPlay device to an audio device connected via an audio back end. At present, the only fully-implemented back end is for ALSA.
A feature of shairport-sync is that the audio is played synchronously. This means that if many devices are playing the same stream at the same time, all the outputs will stay in step with one another. This allows multiple devices play the same source without getting out of phase with one another, enabling, for example, simultaneous multi-room operation.
+
+Settings can be made using the configuration file (recommended for all new installations) or the by using command-line options.
+.SH CONFIGURATION FILE SETTINGS
+You should use the configuration file for setting up shairport-sync. This file is normally \fI/etc/shairport-sync.conf\f1. You may need to have root privileges to modify it.
+
+Settings are organised into groups, for example, there is a "general" group of standard settings, and there is an "alsa" group with settings that pertain to the ALSA back end.
+
+Most of the settings have sensible default values, so most users will only need to set (1) the service name, (2) a password (if desired) and (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced.
+
+A sample configuration file, with all settings commented out and with some usage notes, is installed at \fI/etc/shairport-sync.conf.sample\f1.
+
+To retain backwards compatability with previous versions of shairport-sync you can use still use command line options, but any new features, etc. will be available only via configuration file settings.
+
+The configuration file is processed using the \fIlibconfig\f1 library -- see \fBhttp://www.hyperrealm.com/libconfig/libconfig_manual.html\f1.
+.TP
+\fB"GENERAL" SETTINGS\f1
+These are the settings available within the \fBgeneral\f1 group:
+.TP
+\fBname=\f1\fI"service_name"\f1\fB;\f1
+Use this \fIservice_name\f1 to identify this player in iTunes, etc. The default name is "Shairport Sync on ".
+.TP
+\fBmdns_backend=\f1\fI"avahi"\f1\fB;\f1
+Not used, not tested
+.TP
+\fBoutput_backend=\f1\fI"alsa"\f1\fB;\f1
+Default is "alsa"; other possibilities are "stdout", "pulse", "dummy". Only alsa supports synchronisation.
+.TP
+\fBport=\f1\fI5000\f1\fB;\f1
+This is the port on which Shairport Sync listens for service requests.
+.TP
+\fBudp_port_base=\f1\fI6001\f1\fB;\f1
+Allocation of UDP ports starts from this port number.
+.TP
+\fBudp_port_range=\f1\fI100\f1\fB;\f1
+Look for free ports in this number of places, starting at the UDP port base. Only three ports are needed.
+.TP
+\fBpassword=\f1\fI"secret"\f1\fB;\f1
+The default is that no password is needed.
+.TP
+\fBinterpolation=\f1\fI"basic"\f1\fB;\f1
+Interpolation method, also known as the "stuffing" method. The default is "basic", alternative is "soxr".
+.TP
+\fBstatistics=\f1\fI"no"\f1\fB;\f1
+Log statistics from time to time.
+.TP
+\fBdrift=\f1\fI88\f1\fB;\f1
+Allow synchronisation to drift by this number of frames before trying to correct it.
+.TP
+\fBresync_threshold=\f1\fI2205\f1\fB;\f1
+A synchronisation error greater than this will cause audio to be muted while Shairport Sync attempts to resynchrone with the audio feed; 0 disables it.
+.TP
+\fBlog_verbosity=\f1\fI0\f1\fB;\f1
+"0" means no verbosity, "3" is most verbose.
+.TP
+\fBignore_volume_control=\f1\fI"no"\f1\fB;\f1
+Set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
+.TP
+\fB"LATENCIES" SETTINGS\f1
+These are the settings available within the \fBlatencies\f1 group:
+.TP
+\fBdefault=\f1\fI88200\f1\fB;\f1
+Comment Here
+.TP
+\fBitunes=\f1\fI99400\f1\fB;\f1
+Comment Here
+.TP
+\fBairplay=\f1\fI88200\f1\fB;\f1
+Comment Here
+.TP
+\fBforkedDaapd=\f1\fI99400\f1\fB;\f1
+Comment Here
+.TP
+\fB"METADATA" SETTINGS\f1
+These are the settings available within the \fBmetadata\f1 group:
+.TP
+\fBenabled=\f1\fI"no"\f1\fB;\f1
+Comment Here
+.TP
+\fBinclude_cover_art=\f1\fI"no"\f1\fB;\f1
+Comment Here
+.TP
+\fBpipe_name=\f1\fI"/tmp/shairport-sync-metadata"\f1\fB;\f1
+Comment Here
+.TP
+\fB"SESSIONCONTROL" SETTINGS\f1
+These are the settings available within the \fBsessioncontrol\f1 group:
+.TP
+\fBrun_this_before_play_begins=\f1\fI"/path/to/application and args"\f1\fB;\f1
+Comment Here
+.TP
+\fBrun_this_after_play_ends=\f1\fI"/path/to/application and args"\f1\fB;\f1
+Comment Here
+.TP
+\fBwait_for_completion=\f1\fI"no"\f1\fB;\f1
+Comment Here
+.TP
+\fBallow_session_interruption=\f1\fI"no"\f1\fB;\f1
+Comment Here
+.TP
+\fBsession_timeout=\f1\fI120\f1\fB;\f1
+Comment Here
+.TP
+\fB"ALSA" SETTINGS\f1
+These are the settings available within the \fBalsa\f1 group:
+.TP
+\fBoutput_device=\f1\fI"default"\f1\fB;\f1
+Comment Here
+.TP
+\fBmixer_type=\f1\fI"software"\f1\fB;\f1
+"software" or "hardware"
+.TP
+\fBmixer_device=\f1\fI"default"\f1\fB;\f1
+actually, the mixer default is whatever the output_device is. Normally you wouldn't have to use this.
+.TP
+\fBmixer_control_name=\f1\fI"PCM"\f1\fB;\f1
+the name of the mixer to use -- there is no default.
+.TP
+\fBaudio_backend_latency_offset=\f1\fI0\f1\fB;\f1
+Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+.TP
+\fBaudio_backend_buffer_desired_length=\f1\fI6615\f1\fB;\f1
+If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
+.TP
+\fB"PIPE" SETTINGS\f1
+These are the settings available within the \fBpipe\f1 group:
+.TP
+\fBaudio_backend_latency_offset=\f1\fI0\f1\fB;\f1
+Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+.TP
+\fBaudio_backend_buffer_desired_length=\f1\fI44100\f1\fB;\f1
+Comment Here
+.TP
+\fBname=\f1\fI"/path/to/pipe"\f1\fB;\f1
+there is no default pipe name for the output
+.TP
+\fB"STDOUT" SETTINGS\f1
+These are the settings available within the \fBstdout\f1 group:
+.TP
+\fBaudio_backend_latency_offset=\f1\fI0\f1\fB;\f1
+Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+.TP
+\fBaudio_backend_buffer_desired_length=\f1\fI44100\f1\fB;\f1
+Comment Here
.SH OPTIONS
Many of the options take sensible default values, so you can normally ignore most of them. See the EXAMPLES section for typical usages.
@@ -38,6 +181,9 @@ Execute \fIprogram\f1 when playback is about to begin. Specify the full path to
If you want shairport-sync to wait until the command has completed before starting to play, select the \fB-w\f1 option as well.
.TP
+\fB-c \f1\fIfilename\f1\fB | --configfile=\f1\fIfilename\f1
+Read configuration settings from \fIfilename\f1. The default is to read them from \fI/etc/shairport-sync.conf\f1. For information about configuration settings, see the "Configuration File Settings" section above.
+.TP
\fB-D | --disconnectFromOutput\f1
Disconnect the shairport-sync daemon from the output device and exit. (Requires that the daemon has written its PID to an agreed file -- see the \fB-d\f1 option).
.TP
@@ -70,7 +216,7 @@ Kill the shairport-sync daemon and exit. (Requires that the daemon has written i
Use this to set the \fIdefault latency\f1, in frames, for audio coming from an unidentified source or from an iTunes Version 9 or earlier source. The standard value for the \fIdefault latency\f1 is 88,200 frames, where there are 44,100 frames to the second.
.TP
\fB--meta-dir=\f1\fIdirectory\f1
-Listen for metadata coming from the source and send it, along with metadata from shairport-sync itself, to a pipe called \fIshairport-sync-metadata\f1 in the \fIdirectory\f1 you specify. If you add the \fB--get-cover-art\f1 then cover art will be sent through the pipe too. See https://github.com/mikebrady/shairport-sync-metadata-reader for a sample metadata reader.
+Listen for metadata coming from the source and send it, along with metadata from shairport-sync itself, to a pipe called \fIshairport-sync-metadata\f1 in the \fIdirectory\f1 you specify. If you add the \fB--get-cover-art\f1 then cover art will be sent through the pipe too. See \fBhttps://github.com/mikebrady/shairport-sync-metadata-reader\f1 for a sample metadata reader.
.TP
\fB-m \f1\fImdnsbackend\f1\fB | --mdns=\f1\fImdnsbackend\f1
Force the use of the specified mDNS backend to advertise the player on the network. The default is to try all mDNS backends until one works.
diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml
index 235eeb18..65f81b1e 100644
--- a/man/shairport-sync.7.xml
+++ b/man/shairport-sync.7.xml
@@ -39,6 +39,7 @@
[-a name][-A latency][-B command]
+ [-c configurationfile][-E command][--forkedDaapdLatency=latency][--get-cover-art]
@@ -74,8 +75,210 @@
This allows multiple devices play the same source without getting out of phase with one another,
enabling, for example, simultaneous multi-room operation.
-
+
+
Settings can be made using the configuration file (recommended for all new installations) or the by using command-line options.
+
+
+
+
You should use the configuration file for setting up shairport-sync.
+ This file is normally /etc/shairport-sync.conf.
+ You may need to have root privileges to modify it.
+
+
Settings are organised into groups, for example, there is a "general" group of
+ standard settings, and there is an "alsa" group with settings that pertain to the ALSA
+ back end.
+
+
Most of the settings have sensible default values, so most users will only need to set (1) the service name, (2) a password (if desired) and
+ (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced.
+
+
A sample configuration file, with all settings commented out and with some usage notes,
+ is installed at /etc/shairport-sync.conf.sample.
+
+
To retain backwards compatability with previous versions of shairport-sync
+ you can use still use command line options, but any new features, etc. will
+ be available only via configuration file settings.
+
+
The configuration file is processed using the libconfig library
+ -- see .
+
+
+ These are the settings available within the general group:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ These are the settings available within the latencies group:
+
+
+
+
+
+
+
+ These are the settings available within the metadata group:
+
+
+
+
+
+
+
+ These are the settings available within the sessioncontrol group:
+
+
+
+
+
+
+
+
+ These are the settings available within the alsa group:
+
+
+
+
+
+
+
+
+
+ These are the settings available within the pipe group:
+
+
+
+
+
+
+ These are the settings available within the stdout group:
+
+
+
+
@@ -122,6 +325,13 @@
+
+
-
mdns_backend="avahi";
- Not used, not tested
+
mdns_backend="backend";
+ Shairport Sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS backend. The default is "avahi". Perform the command shairport-sync -h to get a list of available mDNS modules.
-
output_backend="alsa";
-
Default is "alsa"; other possibilities are "stdout", "pulse", "dummy". Only alsa supports synchronisation.
+
output_backend="backend";
+ Shairport Sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio backend. The default is "alsa". Perform the command shairport-sync -h to get a list of available audio backends. Only the alsa backend supports synchronisation.
-
port=5000;
-
This is the port on which Shairport Sync listens for service requests.
+
port=portnumber;
+ Use this to specify the portnumber Shairport Sync uses to listen for service requests from iTunes, etc. The default is port 5000.
udp_port_base=6001;
-
Allocation of UDP ports starts from this port number.
+ When Shairport Sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting portnumber for these three ports. It will pick the first three unused ports starting from portnumber. The default is port 6001.
udp_port_range=100;
-
Look for free ports in this number of places, starting at the UDP port base. Only three ports are needed.
+ Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
-
password="secret";
-
The default is that no password is needed.
+
password="password";
+ Require the password password to connect to the service. If you leave this setting commented out, no password is needed.
-
interpolation="basic";
-
Interpolation method, also known as the "stuffing" method. The default is "basic", alternative is "soxr".
+
interpolation="mode";
+ Interpolate, or "stuff", the audio stream using the mode. Interpolation here refers to the
+ process of adding or removing frames of audio to or from the
+ stream sent to the output device to keep it exactly in synchrony
+ with the player.
+ The default mode, "basic", is normally almost completely inaudible.
+ The alternative mode, "soxr", is even less obtrusive but
+ requires much more processing power. For this mode, support for
+ libsoxr, the SoX Resampler Library, must be selected when
+ shairport-sync is compiled.
+
-
statistics="no";
-
Log statistics from time to time.
+
statistics="setting";
+ Use this setting to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
-
drift=88;
-
Allow synchronisation to drift by this number of frames before trying to correct it.
+
drift=frames;
+ Allow playback to be up to frames out of exact synchronization before attempting to correct it.
+ The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur.
+ Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the statistics setting to
+ monitor correction levels. Corrections should not greatly exceed net corrections.
+
-
resync_threshold=2205;
-
A synchronisation error greater than this will cause audio to be muted while Shairport Sync attempts to resynchrone with the audio feed; 0 disables it.
+
resync_threshold=threshold;
+ Resynchronise if timings differ by more than threshold frames.
+ If the output timing differs from the source timing by more than
+ the threshold, output will be muted and a full resynchronisation
+ will occur. The default threshold is 2,205 frames, i.e. 50
+ milliseconds. Specify 0 to disable resynchronisation.
log_verbosity=0;
-
"0" means no verbosity, "3" is most verbose.
+ Use this to specify how much debugging information should be output or logged. "0" means no debug information, "3" means most debug information. The default is "0".
-
ignore_volume_control="no";
-
Set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
+
ignore_volume_control="choice";
+ Set this choice to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to. This might be useful if you want to set the volume on the output device, independently of the setting at the source. The default is "no".
"LATENCIES" SETTINGS
- These are the settings available within the latencies group:
+
There are four default latency settings, chosen automatically. One latency matches the latency used by recent versions of iTunes when playing audio and another matches the latency used by so-called "AirPlay" devices, including iOS devices and iTunes and Quicktime Player when they are playing video. A third latency is used when the audio source is forked-daapd. The fourth latency is the default if no other latency is chosen and is used for older versions of iTunes.
-
default=88200;
- Comment Here
+
itunes=latency;
+ This is the latency, in frames, used for iTunes 10 or later. Default is 99,400.
-
itunes=99400;
- Comment Here
+
airplay=latency;
+ This is the latency, in frames, used for AirPlay devices, including iOS devices and iTunes and Quicktime Player when they are playing video. Default is 88,200.
-
airplay=88200;
- Comment Here
-
+
forkedDaapd=latency;
+ This is the latency, in frames, used for forkedDaapd sources. Default is 99,400.
+
-
forkedDaapd=99400;
- Comment Here
-
+
default=latency;
+ This is the latency, in frames, used when the source is unrecognised. Default is 88,200.
+
+
"METADATA" SETTINGS
- These are the settings available within the metadata group:
+
These are the settings available within the metadata group:
diff --git a/man/shairport-sync.html b/man/shairport-sync.html
index 364c365f..7edb1f2d 100644
--- a/man/shairport-sync.html
+++ b/man/shairport-sync.html
@@ -85,87 +85,105 @@
-- see http://www.hyperrealm.com/libconfig/libconfig_manual.html.
"GENERAL" SETTINGS
- These are the settings available within the general group:
+
These are the settings available within the general group:
name="service_name";
-
+
Use this service_name to identify this player in iTunes, etc.
The default name is "Shairport Sync on <hostname>".
-
+
-
mdns_backend="avahi";
- Not used, not tested
+
mdns_backend="backend";
+ Shairport Sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS backend. The default is "avahi". Perform the command shairport-sync -h to get a list of available mDNS modules.
-
output_backend="alsa";
-
Default is "alsa"; other possibilities are "stdout", "pulse", "dummy". Only alsa supports synchronisation.
+
output_backend="backend";
+ Shairport Sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio backend. The default is "alsa". Perform the command shairport-sync -h to get a list of available audio backends. Only the alsa backend supports synchronisation.
-
port=5000;
-
This is the port on which Shairport Sync listens for service requests.
+
port=portnumber;
+ Use this to specify the portnumber Shairport Sync uses to listen for service requests from iTunes, etc. The default is port 5000.
udp_port_base=6001;
-
Allocation of UDP ports starts from this port number.
+ When Shairport Sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting portnumber for these three ports. It will pick the first three unused ports starting from portnumber. The default is port 6001.
udp_port_range=100;
-
Look for free ports in this number of places, starting at the UDP port base. Only three ports are needed.
+ Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
-
password="secret";
-
The default is that no password is needed.
+
password="password";
+ Require the password password to connect to the service. If you leave this setting commented out, no password is needed.
-
interpolation="basic";
-
Interpolation method, also known as the "stuffing" method. The default is "basic", alternative is "soxr".
+
interpolation="mode";
+ Interpolate, or "stuff", the audio stream using the mode. Interpolation here refers to the
+ process of adding or removing frames of audio to or from the
+ stream sent to the output device to keep it exactly in synchrony
+ with the player.
+ The default mode, "basic", is normally almost completely inaudible.
+ The alternative mode, "soxr", is even less obtrusive but
+ requires much more processing power. For this mode, support for
+ libsoxr, the SoX Resampler Library, must be selected when
+ shairport-sync is compiled.
+
-
statistics="no";
-
Log statistics from time to time.
+
statistics="setting";
+ Use this setting to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
-
drift=88;
-
Allow synchronisation to drift by this number of frames before trying to correct it.
+
drift=frames;
+ Allow playback to be up to frames out of exact synchronization before attempting to correct it.
+ The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur.
+ Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the statistics setting to
+ monitor correction levels. Corrections should not greatly exceed net corrections.
+
-
resync_threshold=2205;
-
A synchronisation error greater than this will cause audio to be muted while Shairport Sync attempts to resynchrone with the audio feed; 0 disables it.
+
resync_threshold=threshold;
+ Resynchronise if timings differ by more than threshold frames.
+ If the output timing differs from the source timing by more than
+ the threshold, output will be muted and a full resynchronisation
+ will occur. The default threshold is 2,205 frames, i.e. 50
+ milliseconds. Specify 0 to disable resynchronisation.
log_verbosity=0;
-
"0" means no verbosity, "3" is most verbose.
+ Use this to specify how much debugging information should be output or logged. "0" means no debug information, "3" means most debug information. The default is "0".
-
ignore_volume_control="no";
-
Set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
+
ignore_volume_control="choice";
+ Set this choice to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to. This might be useful if you want to set the volume on the output device, independently of the setting at the source. The default is "no".
"LATENCIES" SETTINGS
- These are the settings available within the latencies group:
+
There are four default latency settings, chosen automatically. One latency matches the latency used by recent versions of iTunes when playing audio and another matches the latency used by so-called "AirPlay" devices, including iOS devices and iTunes and Quicktime Player when they are playing video. A third latency is used when the audio source is forked-daapd. The fourth latency is the default if no other latency is chosen and is used for older versions of iTunes.
-
default=88200;
- Comment Here
+
itunes=latency;
+ This is the latency, in frames, used for iTunes 10 or later. Default is 99,400.
-
itunes=99400;
- Comment Here
+
airplay=latency;
+ This is the latency, in frames, used for AirPlay devices, including iOS devices and iTunes and Quicktime Player when they are playing video. Default is 88,200.
-
airplay=88200;
- Comment Here
-
-
-
forkedDaapd=99400;
- Comment Here
+
forkedDaapd=latency;
+ This is the latency, in frames, used for forkedDaapd sources. Default is 99,400.
+
+
default=latency;
+ This is the latency, in frames, used when the source is unrecognised. Default is 88,200.
+
+
"METADATA" SETTINGS
- These are the settings available within the metadata group:
+
These are the settings available within the metadata group:
From 896d374a45fcef7f2539c09df0d330db37566d6c Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Fri, 7 Aug 2015 20:13:38 +0200
Subject: [PATCH 26/44] More edits...
---
man/shairport-sync.7 | 32 +++++++++++++++++++++++++++-----
man/shairport-sync.7.xml | 25 ++++++++++++++++++-------
man/shairport-sync.html | 25 ++++++++++++++++++-------
3 files changed, 63 insertions(+), 19 deletions(-)
diff --git a/man/shairport-sync.7 b/man/shairport-sync.7
index 27e9a4f7..ad7c255f 100644
--- a/man/shairport-sync.7
+++ b/man/shairport-sync.7
@@ -25,11 +25,33 @@ Settings can be made using the configuration file (recommended for all new insta
.SH CONFIGURATION FILE SETTINGS
You should use the configuration file for setting up shairport-sync. This file is normally \fI/etc/shairport-sync.conf\f1. You may need to have root privileges to modify it.
-Settings are organised into groups, for example, there is a "general" group of standard settings, and there is an "alsa" group with settings that pertain to the ALSA back end.
+Settings are organised into groups, for example, there is a "general" group of standard settings, and there is an "alsa" group with settings that pertain to the ALSA back end. Here is an example of a typical configuration file:
-Most of the settings have sensible default values, so most users will only need to set (1) the service name, (2) a password (if desired) and (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced.
+\fBgeneral = {\f1
-A sample configuration file, with all settings commented out and with some usage notes, is installed at \fI/etc/shairport-sync.conf.sample\f1.
+\fBname = "Mike's Boombox";\f1
+
+\fBinterpolation = "soxr";\f1
+
+\fBpassword = "secret";\f1
+
+\fB};\f1
+
+\fB\f1
+
+\fBalsa = {\f1
+
+\fBoutput_device = "hw:0";\f1
+
+\fBmixer_type = "hardware";\f1
+
+\fBmixer_control_name = "PCM";\f1
+
+\fB};\f1
+
+Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
+
+A sample configuration file with all possible settings, but with all of them commented out, is installed at \fI/etc/shairport-sync.conf.sample\f1.
To retain backwards compatability with previous versions of shairport-sync you can use still use command line options, but any new features, etc. will be available only via configuration file settings.
@@ -93,9 +115,9 @@ This is the \fIlatency\f1, in frames, used for forkedDaapd sources. Default is 9
This is the \fIlatency\f1, in frames, used when the source is unrecognised. Default is 88,200.
.TP
\fB"METADATA" SETTINGS\f1
-These are the settings available within the \fBmetadata\f1 group:
+Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default \fI/tmp/shairport-sync-metadata\f1. To process metadata, Shairport Sync must have been compiled with metadata support included. The \fBmetadata\f1 group of settings allow you to enable metadata handling and to control certain aspects of it. These are the settings available within the \fBmetadata\f1 group:
.TP
-\fBenabled=\f1\fI"no"\f1\fB;\f1
+\fBenabled=\f1\fI"choice"\f1\fB;\f1
Comment Here
.TP
\fBinclude_cover_art=\f1\fI"no"\f1\fB;\f1
diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml
index 6e2657bb..0fe71a47 100644
--- a/man/shairport-sync.7.xml
+++ b/man/shairport-sync.7.xml
@@ -87,13 +87,24 @@
Settings are organised into groups, for example, there is a "general" group of
standard settings, and there is an "alsa" group with settings that pertain to the ALSA
- back end.
+ back end. Here is an example of a typical configuration file:
-
Most of the settings have sensible default values, so most users will only need to set (1) the service name, (2) a password (if desired) and
- (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced.
+
general = {
+
name = "Mike's Boombox";
+
interpolation = "soxr";
+
password = "secret";
+
};
+
+
alsa = {
+
output_device = "hw:0";
+
mixer_type = "hardware";
+
mixer_control_name = "PCM";
+
};
-
A sample configuration file, with all settings commented out and with some usage notes,
- is installed at /etc/shairport-sync.conf.sample.
+
Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and
+ (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
+
+
A sample configuration file with all possible settings, but with all of them commented out, is installed at /etc/shairport-sync.conf.sample.
To retain backwards compatability with previous versions of shairport-sync
you can use still use command line options, but any new features, etc. will
@@ -201,11 +212,11 @@
"METADATA" SETTINGS
-
These are the settings available within the metadata group:
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. The metadata group of settings allow you to enable metadata handling and to control certain aspects of it. These are the settings available within the metadata group:
Settings are organised into groups, for example, there is a "general" group of
standard settings, and there is an "alsa" group with settings that pertain to the ALSA
- back end.
+ back end. Here is an example of a typical configuration file:
-
Most of the settings have sensible default values, so most users will only need to set (1) the service name, (2) a password (if desired) and
- (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced.
+
general = {
+
name = "Mike's Boombox";
+
interpolation = "soxr";
+
password = "secret";
+
};
+
+
alsa = {
+
output_device = "hw:0";
+
mixer_type = "hardware";
+
mixer_control_name = "PCM";
+
};
-
A sample configuration file, with all settings commented out and with some usage notes,
- is installed at /etc/shairport-sync.conf.sample.
+
Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and
+ (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
+
+
A sample configuration file with all possible settings, but with all of them commented out, is installed at /etc/shairport-sync.conf.sample.
To retain backwards compatability with previous versions of shairport-sync
you can use still use command line options, but any new features, etc. will
@@ -183,11 +194,11 @@
"METADATA" SETTINGS
-
These are the settings available within the metadata group:
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. The metadata group of settings allow you to enable metadata handling and to control certain aspects of it. These are the settings available within the metadata group:
-
enabled="no";
+
enabled="choice";
Comment Here
From 1ab305e0c3eafe0e8a20c7787924e1754a3d6a9e Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 8 Aug 2015 14:53:44 +0200
Subject: [PATCH 27/44] Ignore .xml~ files
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index a559c3e4..a7708cab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
/shairport-sync
/*.o
/*~
+*.xml~
/config.mk
/config.h
Makefile
From 5d664671a06c87fd696085f3f06d773453e55766 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Sat, 8 Aug 2015 14:54:47 +0200
Subject: [PATCH 28/44] Some more documentation updates.
---
man/shairport-sync.7 | 46 +++++++++++++------------
man/shairport-sync.7.xml | 72 ++++++++++++++++++++++------------------
man/shairport-sync.html | 72 ++++++++++++++++++++++------------------
3 files changed, 103 insertions(+), 87 deletions(-)
diff --git a/man/shairport-sync.7 b/man/shairport-sync.7
index ad7c255f..e5f98305 100644
--- a/man/shairport-sync.7
+++ b/man/shairport-sync.7
@@ -63,6 +63,15 @@ These are the settings available within the \fBgeneral\f1 group:
\fBname=\f1\fI"service_name"\f1\fB;\f1
Use this \fIservice_name\f1 to identify this player in iTunes, etc. The default name is "Shairport Sync on ".
.TP
+\fBpassword=\f1\fI"password"\f1\fB;\f1
+Require the password \fIpassword\f1 to connect to the service. If you leave this setting commented out, no password is needed.
+.TP
+\fBinterpolation=\f1\fI"mode"\f1\fB;\f1
+Interpolate, or "stuff", the audio stream using the \fImode\f1. Interpolation here refers to the process of adding or removing frames of audio to or from the stream sent to the output device to keep it exactly in synchrony with the player. The default mode, "basic", is normally almost completely inaudible. The alternative mode, "soxr", is even less obtrusive but requires much more processing power. For this mode, support for libsoxr, the SoX Resampler Library, must be selected when shairport-sync is compiled.
+.TP
+\fBstatistics=\f1\fI"setting"\f1\fB;\f1
+Use this \fIsetting\f1 to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
+.TP
\fBmdns_backend=\f1\fI"backend"\f1\fB;\f1
Shairport Sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS \fIbackend\f1. The default is "avahi". Perform the command \fBshairport-sync -h\f1 to get a list of available mDNS modules.
.TP
@@ -78,17 +87,8 @@ When Shairport Sync starts to play audio, it establises three UDP connections to
\fBudp_port_range=\f1\fI100\f1\fB;\f1
Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
.TP
-\fBpassword=\f1\fI"password"\f1\fB;\f1
-Require the password \fIpassword\f1 to connect to the service. If you leave this setting commented out, no password is needed.
-.TP
-\fBinterpolation=\f1\fI"mode"\f1\fB;\f1
-Interpolate, or "stuff", the audio stream using the \fImode\f1. Interpolation here refers to the process of adding or removing frames of audio to or from the stream sent to the output device to keep it exactly in synchrony with the player. The default mode, "basic", is normally almost completely inaudible. The alternative mode, "soxr", is even less obtrusive but requires much more processing power. For this mode, support for libsoxr, the SoX Resampler Library, must be selected when shairport-sync is compiled.
-.TP
-\fBstatistics=\f1\fI"setting"\f1\fB;\f1
-Use this \fIsetting\f1 to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
-.TP
\fBdrift=\f1\fIframes\f1\fB;\f1
-Allow playback to be up to \fIframes\f1 out of exact synchronization before attempting to correct it. The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur. Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the \fBstatistics\f1 setting to monitor correction levels. Corrections should not greatly exceed net corrections.
+Allow playback to drift up to \fIframes\f1 out of exact synchronization before attempting to correct it. The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur. Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the \fBstatistics\f1 setting to monitor correction levels. Corrections should not greatly exceed net corrections.
.TP
\fBresync_threshold=\f1\fIthreshold\f1\fB;\f1
Resynchronise if timings differ by more than \fBthreshold\f1 frames. If the output timing differs from the source timing by more than the threshold, output will be muted and a full resynchronisation will occur. The default threshold is 2,205 frames, i.e. 50 milliseconds. Specify 0 to disable resynchronisation.
@@ -101,6 +101,8 @@ Set this \fIchoice\f1 to "yes" if you want the volume to be at 100% no matter wh
.TP
\fB"LATENCIES" SETTINGS\f1
There are four default latency settings, chosen automatically. One latency matches the latency used by recent versions of iTunes when playing audio and another matches the latency used by so-called "AirPlay" devices, including iOS devices and iTunes and Quicktime Player when they are playing video. A third latency is used when the audio source is forked-daapd. The fourth latency is the default if no other latency is chosen and is used for older versions of iTunes.
+
+If you want to change latencies to compensate for a delay in the audio output device (which will have the same effect on all sources), instead of changing these individual latencies, consider using the \fBaudio_backend_latency_offset\f1 setting in the \fBalsa\f1 group (or the appropriate other group if you're not outputing through the alsa backend).
.TP
\fBitunes=\f1\fIlatency\f1\fB;\f1
This is the \fIlatency\f1, in frames, used for iTunes 10 or later. Default is 99,400.
@@ -115,28 +117,30 @@ This is the \fIlatency\f1, in frames, used for forkedDaapd sources. Default is 9
This is the \fIlatency\f1, in frames, used when the source is unrecognised. Default is 88,200.
.TP
\fB"METADATA" SETTINGS\f1
-Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default \fI/tmp/shairport-sync-metadata\f1. To process metadata, Shairport Sync must have been compiled with metadata support included. The \fBmetadata\f1 group of settings allow you to enable metadata handling and to control certain aspects of it. These are the settings available within the \fBmetadata\f1 group:
+Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default \fI/tmp/shairport-sync-metadata\f1. To process metadata, Shairport Sync must have been compiled with metadata support included. You can check tht this is so by running \fBshairport-sync -V\f1; the identification string will contain the word \fBmetadata\f1.
+
+The \fBmetadata\f1 group of settings allow you to enable metadata handling and to control certain aspects of it:
.TP
\fBenabled=\f1\fI"choice"\f1\fB;\f1
-Comment Here
+Set the \fIchoice\f1 to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it, along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
.TP
-\fBinclude_cover_art=\f1\fI"no"\f1\fB;\f1
-Comment Here
+\fBinclude_cover_art=\f1\fI"choice"\f1\fB;\f1
+Set the \fIchoice\f1 to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe. A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe. The default is "no".
.TP
-\fBpipe_name=\f1\fI"/tmp/shairport-sync-metadata"\f1\fB;\f1
-Comment Here
+\fBpipe_name=\f1\fI"filepathname"\f1\fB;\f1
+Specify the absolute path name of the pipe through which metadata should be sent The default is \fI/tmp/shairport-sync-metadata\f1".
.TP
\fB"SESSIONCONTROL" SETTINGS\f1
-These are the settings available within the \fBsessioncontrol\f1 group:
+Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
.TP
\fBrun_this_before_play_begins=\f1\fI"/path/to/application and args"\f1\fB;\f1
-Comment Here
+Here you can specify a program and its arguments that will be run just before a play session begins. Be careful to include the full path to the application. The application must be marked as executable and, if it is a script, its first line must begin with the standard \fI#!/bin/...\f1 as appropriate.
.TP
\fBrun_this_after_play_ends=\f1\fI"/path/to/application and args"\f1\fB;\f1
-Comment Here
+Here you can specify a program and its arguments that will be run just after a play session ends. Be careful to include the full path to the application. The application must be marked as executable and, if it is a script, its first line must begin with the standard \fI#!/bin/...\f1 as appropriate.
.TP
-\fBwait_for_completion=\f1\fI"no"\f1\fB;\f1
-Comment Here
+\fBwait_for_completion=\f1\fI"choice"\f1\fB;\f1
+Set \fIchoice\f1 to "yes" to make Shairport Sync wait until the programs specified in the \fBrun_this_before_play_begins\f1 and \fBrun_this_after_play_ends=\f1 have completed execution before continuing. The default is "no".
.TP
\fBallow_session_interruption=\f1\fI"no"\f1\fB;\f1
Comment Here
diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml
index 0fe71a47..17f3194b 100644
--- a/man/shairport-sync.7.xml
+++ b/man/shairport-sync.7.xml
@@ -123,6 +123,29 @@
The default name is "Shairport Sync on <hostname>".
+
+
+
password="password";
+ Require the password password to connect to the service. If you leave this setting commented out, no password is needed.
+
+
+
interpolation="mode";
+ Interpolate, or "stuff", the audio stream using the mode. Interpolation here refers to the
+ process of adding or removing frames of audio to or from the
+ stream sent to the output device to keep it exactly in synchrony
+ with the player.
+ The default mode, "basic", is normally almost completely inaudible.
+ The alternative mode, "soxr", is even less obtrusive but
+ requires much more processing power. For this mode, support for
+ libsoxr, the SoX Resampler Library, must be selected when
+ shairport-sync is compiled.
+
+
+
+
+
statistics="setting";
+ Use this setting to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
+
mdns_backend="backend";
@@ -145,29 +168,8 @@
Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
-
password="password";
- Require the password password to connect to the service. If you leave this setting commented out, no password is needed.
-
-
-
interpolation="mode";
- Interpolate, or "stuff", the audio stream using the mode. Interpolation here refers to the
- process of adding or removing frames of audio to or from the
- stream sent to the output device to keep it exactly in synchrony
- with the player.
- The default mode, "basic", is normally almost completely inaudible.
- The alternative mode, "soxr", is even less obtrusive but
- requires much more processing power. For this mode, support for
- libsoxr, the SoX Resampler Library, must be selected when
- shairport-sync is compiled.
-
-
-
-
statistics="setting";
- Use this setting to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
-
-
drift=frames;
- Allow playback to be up to frames out of exact synchronization before attempting to correct it.
+ Allow playback to drift up to frames out of exact synchronization before attempting to correct it.
The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur.
Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the statistics setting to
monitor correction levels. Corrections should not greatly exceed net corrections.
@@ -192,6 +194,7 @@
"LATENCIES" SETTINGS
There are four default latency settings, chosen automatically. One latency matches the latency used by recent versions of iTunes when playing audio and another matches the latency used by so-called "AirPlay" devices, including iOS devices and iTunes and Quicktime Player when they are playing video. A third latency is used when the audio source is forked-daapd. The fourth latency is the default if no other latency is chosen and is used for older versions of iTunes.
+
If you want to change latencies to compensate for a delay in the audio output device (which will have the same effect on all sources), instead of changing these individual latencies, consider using the audio_backend_latency_offset setting in the alsa group (or the appropriate other group if you're not outputing through the alsa backend).
@@ -212,36 +215,39 @@
"METADATA" SETTINGS
-
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. The metadata group of settings allow you to enable metadata handling and to control certain aspects of it. These are the settings available within the metadata group:
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
enabled="choice";
- Comment Here
+ Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it, along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
-
include_cover_art="no";
- Comment Here
+
include_cover_art="choice";
+ Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe. A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe. The default is "no".
-
pipe_name="/tmp/shairport-sync-metadata";
- Comment Here
+
pipe_name="filepathname";
+ Specify the absolute path name of the pipe through which metadata should be sent The default is /tmp/shairport-sync-metadata".
"SESSIONCONTROL" SETTINGS
- These are the settings available within the sessioncontrol group:
+
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
+
run_this_before_play_begins="/path/to/application and args";
- Comment Here
+ Here you can specify a program and its arguments that will be run just before a play session begins. Be careful to include the full path to the application.
+ The application must be marked as executable and, if it is a script, its first line must begin with the standard #!/bin/... as appropriate.
run_this_after_play_ends="/path/to/application and args";
- Comment Here
+ Here you can specify a program and its arguments that will be run just after a play session ends. Be careful to include the full path to the application.
+ The application must be marked as executable and, if it is a script, its first line must begin with the standard #!/bin/... as appropriate.
-
wait_for_completion="no";
- Comment Here
+
wait_for_completion="choice";
+ Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins and run_this_after_play_ends= have completed execution before continuing. The default is "no".
allow_session_interruption="no";
diff --git a/man/shairport-sync.html b/man/shairport-sync.html
index bf8645b9..ad655522 100644
--- a/man/shairport-sync.html
+++ b/man/shairport-sync.html
@@ -105,6 +105,29 @@
The default name is "Shairport Sync on <hostname>".
+
+
+
password="password";
+ Require the password password to connect to the service. If you leave this setting commented out, no password is needed.
+
+
+
interpolation="mode";
+ Interpolate, or "stuff", the audio stream using the mode. Interpolation here refers to the
+ process of adding or removing frames of audio to or from the
+ stream sent to the output device to keep it exactly in synchrony
+ with the player.
+ The default mode, "basic", is normally almost completely inaudible.
+ The alternative mode, "soxr", is even less obtrusive but
+ requires much more processing power. For this mode, support for
+ libsoxr, the SoX Resampler Library, must be selected when
+ shairport-sync is compiled.
+
+
+
+
+
statistics="setting";
+ Use this setting to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
+
mdns_backend="backend";
@@ -127,29 +150,8 @@
Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
-
password="password";
- Require the password password to connect to the service. If you leave this setting commented out, no password is needed.
-
-
-
interpolation="mode";
- Interpolate, or "stuff", the audio stream using the mode. Interpolation here refers to the
- process of adding or removing frames of audio to or from the
- stream sent to the output device to keep it exactly in synchrony
- with the player.
- The default mode, "basic", is normally almost completely inaudible.
- The alternative mode, "soxr", is even less obtrusive but
- requires much more processing power. For this mode, support for
- libsoxr, the SoX Resampler Library, must be selected when
- shairport-sync is compiled.
-
-
-
-
statistics="setting";
- Use this setting to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
-
-
drift=frames;
- Allow playback to be up to frames out of exact synchronization before attempting to correct it.
+ Allow playback to drift up to frames out of exact synchronization before attempting to correct it.
The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur.
Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the statistics setting to
monitor correction levels. Corrections should not greatly exceed net corrections.
@@ -174,6 +176,7 @@
"LATENCIES" SETTINGS
There are four default latency settings, chosen automatically. One latency matches the latency used by recent versions of iTunes when playing audio and another matches the latency used by so-called "AirPlay" devices, including iOS devices and iTunes and Quicktime Player when they are playing video. A third latency is used when the audio source is forked-daapd. The fourth latency is the default if no other latency is chosen and is used for older versions of iTunes.
+
If you want to change latencies to compensate for a delay in the audio output device (which will have the same effect on all sources), instead of changing these individual latencies, consider using the audio_backend_latency_offset setting in the alsa group (or the appropriate other group if you're not outputing through the alsa backend).
@@ -194,36 +197,39 @@
"METADATA" SETTINGS
-
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. The metadata group of settings allow you to enable metadata handling and to control certain aspects of it. These are the settings available within the metadata group:
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
enabled="choice";
- Comment Here
+ Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it, along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
-
include_cover_art="no";
- Comment Here
+
include_cover_art="choice";
+ Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe. A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe. The default is "no".
-
pipe_name="/tmp/shairport-sync-metadata";
- Comment Here
+
pipe_name="filepathname";
+ Specify the absolute path name of the pipe through which metadata should be sent The default is /tmp/shairport-sync-metadata".
"SESSIONCONTROL" SETTINGS
- These are the settings available within the sessioncontrol group:
+
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
+
run_this_before_play_begins="/path/to/application and args";
- Comment Here
+ Here you can specify a program and its arguments that will be run just before a play session begins. Be careful to include the full path to the application.
+ The application must be marked as executable and, if it is a script, its first line must begin with the standard #!/bin/... as appropriate.
run_this_after_play_ends="/path/to/application and args";
- Comment Here
+ Here you can specify a program and its arguments that will be run just after a play session ends. Be careful to include the full path to the application.
+ The application must be marked as executable and, if it is a script, its first line must begin with the standard #!/bin/... as appropriate.
-
wait_for_completion="no";
- Comment Here
+
wait_for_completion="choice";
+ Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins and run_this_after_play_ends= have completed execution before continuing. The default is "no".
- Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins and run_this_after_play_ends= have completed execution before continuing. The default is "no".
+ Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins and run_this_after_play_ends have completed execution before continuing. The default is "no".
allow_session_interruption="no";
From e238bf238c5e0c55ffd9e5a9f34deb9f2c5aaaf0 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Wed, 12 Aug 2015 17:36:28 +0200
Subject: [PATCH 31/44] Begin to add time-related changes to stuffing.
---
player.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/player.c b/player.c
index 29fb1810..63c20df5 100644
--- a/player.c
+++ b/player.c
@@ -902,8 +902,9 @@ static void *player_thread_func(void *arg) {
missing_packets = late_packets = too_late_packets = resend_requests = 0;
flush_rtp_timestamp = 0; // it seems this number has a special significance -- it seems to be used
// as a null operand, so we'll use it like that too
- int sync_error_out_of_bounds =
- 0; // number of times in a row that there's been a serious sync error
+ int sync_error_out_of_bounds = 0; // number of times in a row that there's been a serious sync error
+
+ uint64_t tens_of_seconds = 0;
while (!please_stop) {
abuf_t *inframe = buffer_get_frame();
if (inframe) {
@@ -1009,6 +1010,17 @@ static void *player_thread_func(void *arg) {
}
// try to keep the corrections definitely below 1 in 1000 audio frames
+
+ // calculate the time elapsed since the play session started.
+
+ uint64_t time_since_play_started = local_time_now - first_packet_time_to_play;
+ if ((local_time_now) && (first_packet_time_to_play)) {
+ uint64_t t = tens_of_seconds;
+ tens_of_seconds = (time_since_play_started / 10)>>32;
+ // if (tens_of_seconds!=t)
+ // debug(1,"%llu seconds of play have elapsed.",tens_of_seconds*10);
+ }
+
if (amount_to_stuff) {
uint32_t x = random() % 1000;
if (x > 352)
From 970300733105e5c67418bf6871f199a5baa627e9 Mon Sep 17 00:00:00 2001
From: Mke Brady
Date: Wed, 12 Aug 2015 20:25:04 +0100
Subject: [PATCH 32/44] Don't start stuffing in the first five seconds. Allow
1:300 stuffing after 30 seconds.
---
player.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/player.c b/player.c
index 63c20df5..7c269652 100644
--- a/player.c
+++ b/player.c
@@ -130,7 +130,7 @@ static pthread_mutex_t ab_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t flush_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t flowcontrol;
-static int64_t first_packet_time_to_play; // nanoseconds
+static int64_t first_packet_time_to_play, time_since_play_started; // nanoseconds
static audio_parameters audio_information;
@@ -441,6 +441,7 @@ static abuf_t *buffer_get_frame(void) {
ab_resync();
first_packet_timestamp = 0;
first_packet_time_to_play = 0;
+ time_since_play_started = 0;
flush_requested = 0;
}
pthread_mutex_unlock(&flush_mutex);
@@ -559,6 +560,7 @@ static abuf_t *buffer_get_frame(void) {
ab_resync();
first_packet_timestamp = 0;
first_packet_time_to_play = 0;
+ time_since_play_started = 0;
} else {
if (config.output->delay) {
dac_delay = config.output->delay();
@@ -1013,20 +1015,20 @@ static void *player_thread_func(void *arg) {
// calculate the time elapsed since the play session started.
- uint64_t time_since_play_started = local_time_now - first_packet_time_to_play;
- if ((local_time_now) && (first_packet_time_to_play)) {
- uint64_t t = tens_of_seconds;
- tens_of_seconds = (time_since_play_started / 10)>>32;
- // if (tens_of_seconds!=t)
- // debug(1,"%llu seconds of play have elapsed.",tens_of_seconds*10);
- }
-
if (amount_to_stuff) {
- uint32_t x = random() % 1000;
- if (x > 352)
- amount_to_stuff = 0;
- }
+ if ((local_time_now) && (first_packet_time_to_play) && (local_time_now >= first_packet_time_to_play)) {
+ int64_t tp = (local_time_now - first_packet_time_to_play)>>32; // seconds
+
+ if (tp<5)
+ amount_to_stuff = 0; // wait at least five seconds
+ else if (tp<30) {
+ if ((random() % 1000) > 352) // keep it to about 1:1000 for the first thirty seconds
+ amount_to_stuff = 0;
+ }
+ }
+ }
+
if ((amount_to_stuff == 0) && (fix_volume == 0x10000)) {
// if no stuffing needed and no volume adjustment, then
// don't send to stuff_buffer_* and don't copy to outbuf; just send directly to the
From 07c888e0e750868526e41b5768e27b11b57eb75a Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Tue, 18 Aug 2015 08:13:00 -0400
Subject: [PATCH 33/44] Clean up a few comments
---
player.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/player.c b/player.c
index 63c20df5..aa3d4049 100644
--- a/player.c
+++ b/player.c
@@ -502,8 +502,7 @@ static abuf_t *buffer_get_frame(void) {
// Here, calculate when we should start playing. We need to know when to allow the
// packets to be sent to the player.
// We will send packets of silence from now until that time and then we will send the
- // first packet,
- // which will be followed by the subsequent packets.
+ // first packet, which will be followed by the subsequent packets.
// we will get a fix every second or so, which will be stored as a pair consisting of
// the time when the packet with a particular timestamp should be played, neglecting
@@ -513,9 +512,8 @@ static abuf_t *buffer_get_frame(void) {
// to do some calculations.
// To calculate when the first packet will be played, we figure out the exact time the
- // packet should
- // be played according to its timestamp and the reference time. We then need to add
- // the desired latency, typically 88200 frames.
+ // packet should be played according to its timestamp and the reference time.
+ // We then need to add the desired latency, typically 88200 frames.
// Then we need to offset this by the backend latency offset. For example, if we knew
// that the audio back end has a latency of 100 ms, we would
From 60038acc4ebdfa2fac6b962ba143b2c41a7140a8 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Tue, 18 Aug 2015 08:13:29 -0400
Subject: [PATCH 34/44] Initial documentation of configuration file settings.
---
man/shairport-sync.7 | 71 +++++++++++---------
man/shairport-sync.7.xml | 135 ++++++++++++++++++++++++++++-----------
man/shairport-sync.html | 135 ++++++++++++++++++++++++++++-----------
3 files changed, 232 insertions(+), 109 deletions(-)
diff --git a/man/shairport-sync.7 b/man/shairport-sync.7
index e5f98305..b2737a4d 100644
--- a/man/shairport-sync.7
+++ b/man/shairport-sync.7
@@ -140,55 +140,64 @@ Here you can specify a program and its arguments that will be run just before a
Here you can specify a program and its arguments that will be run just after a play session ends. Be careful to include the full path to the application. The application must be marked as executable and, if it is a script, its first line must begin with the standard \fI#!/bin/...\f1 as appropriate.
.TP
\fBwait_for_completion=\f1\fI"choice"\f1\fB;\f1
-Set \fIchoice\f1 to "yes" to make Shairport Sync wait until the programs specified in the \fBrun_this_before_play_begins\f1 and \fBrun_this_after_play_ends=\f1 have completed execution before continuing. The default is "no".
+Set \fIchoice\f1 to "yes" to make Shairport Sync wait until the programs specified in the \fBrun_this_before_play_begins\f1 and \fBrun_this_after_play_ends\f1 have completed execution before continuing. The default is "no".
.TP
-\fBallow_session_interruption=\f1\fI"no"\f1\fB;\f1
-Comment Here
+\fBallow_session_interruption=\f1\fI"choice"\f1\fB;\f1
+If \fBchoice\f1 is set to "yes", then another source will be able to interrupt an existing play session and start a new one. When set to "no" (the default), other devices attempting to interrupt a session will fail, receiving a busy signal.
.TP
-\fBsession_timeout=\f1\fI120\f1\fB;\f1
-Comment Here
+\fBsession_timeout=\f1\fIseconds\f1\fB;\f1
+If a play session has been established and the source disappears without warning (such as a device going out of range of a network) then wait for \fIseconds\f1 seconds before ending the session. Once the session has terminated, other devices can use it. The default is 120 seconds.
.TP
\fB"ALSA" SETTINGS\f1
-These are the settings available within the \fBalsa\f1 group:
+These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system. (By the way, you can use tools such as \fBalsamixer\f1 or \fBaplay\f1 to discover what devices are available.) Use these settings to select the output device and the mixer control to be used to control the output volume. You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the \fBalsa\f1 group settings:
.TP
-\fBoutput_device=\f1\fI"default"\f1\fB;\f1
-Comment Here
+\fBoutput_device=\f1\fI"output_device"\f1\fB;\f1
+Use the output device called \fIoutput_device\f1. The default is the device called "device".
.TP
-\fBmixer_type=\f1\fI"software"\f1\fB;\f1
-"software" or "hardware"
.TP
-\fBmixer_device=\f1\fI"default"\f1\fB;\f1
-actually, the mixer default is whatever the output_device is. Normally you wouldn't have to use this.
+\fBmixer_control_name=\f1\fI"name"\f1\fB;\f1
+Specify the \fIname\f1 of the mixer control to be used by shairport-sync to control the volume. The mixer control must be on the mixer device, which by default is the output device. If you do not specify a mixer control name, shaiport-sync will control the volume in software. \fBmixer_type=\f1\fI"mixer_type"\f1\fB;\f1
+This setting is deprecated and will be removed soon. If you wish to use a mixer control to control the volume, then set \fImixer_type\f1 to "hardware". The default is "software".
.TP
-\fBmixer_control_name=\f1\fI"PCM"\f1\fB;\f1
-the name of the mixer to use -- there is no default.
+\fBmixer_device=\f1\fI"mixer_device"\f1\fB;\f1
+By default, the mixer is assumed to be output_device is. Use this setting to specify a device other than the output device.
.TP
-\fBaudio_backend_latency_offset=\f1\fI0\f1\fB;\f1
-Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+\fBaudio_backend_latency_offset=\f1\fIoffset\f1\fB;\f1
+Set this \fIoffset\f1, in frames, to compensate for a fixed delay in the audio back end. For example, if the output device delays by 100 ms, set this to -4410.
.TP
-\fBaudio_backend_buffer_desired_length=\f1\fI6615\f1\fB;\f1
-If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
+\fBaudio_backend_buffer_desired_length=\f1\fIlength\f1\fB;\f1
+Use this to set the desired number frames to be in the output device's hardware output buffer. The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines. If too large, the response times when using a software mixer become annoying, or it may exceed the hardware buffer size. It may need to be larger on low-powered machines performing other tasks, such as processing metadata.
.TP
\fB"PIPE" SETTINGS\f1
-These are the settings available within the \fBpipe\f1 group:
-.TP
-\fBaudio_backend_latency_offset=\f1\fI0\f1\fB;\f1
-Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-.TP
-\fBaudio_backend_buffer_desired_length=\f1\fI44100\f1\fB;\f1
-Comment Here
+These settings are for the PIPE backend, used to route audio to a named unix pipe. The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
+
+Use the \fIname\f1 setting to set the name and location of the pipe.
+
+There are two further settings affecting timing that might be useful if the pipe reader is, for example, a program to play an audio stream such as \fBaplay\f1. The \fIaudio_backend_latency_offset\f1 affects precisely when the first audio packet is sent and the \fIaudio_backend_buffer_desired_length\f1 setting affects the nominal output buffer size.
+
+These are the settings available within the \fBpipe\f1 group:
.TP
\fBname=\f1\fI"/path/to/pipe"\f1\fB;\f1
-there is no default pipe name for the output
+Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown. Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached. The sender will wait for up to five seconds for a packet to be written before discarding it.
+.TP
+\fBaudio_backend_latency_offset=\f1\fIoffset_in_frames\f1\fB;\f1
+Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410.
+.TP
+\fBaudio_backend_buffer_desired_length=\f1\fIbuffer_length_in_frames\f1\fB;\f1
+Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to a pipe.
.TP
\fB"STDOUT" SETTINGS\f1
-These are the settings available within the \fBstdout\f1 group:
+These settings are for the STDOUT backend, used to route audio to standard output ("stdout"). The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
+
+There are two settings affecting timing that might be useful if the stdout reader is, for example, a program to play an audio stream such as \fBaplay\f1. The \fIaudio_backend_latency_offset\f1 affects precisely when the first audio packet is sent and the \fIaudio_backend_buffer_desired_length\f1 setting affects the nominal output buffer size.
+
+These are the settings available within the \fBstdout\f1 group:
.TP
-\fBaudio_backend_latency_offset=\f1\fI0\f1\fB;\f1
-Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+\fBaudio_backend_latency_offset=\f1\fIoffset_in_frames\f1\fB;\f1
+Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410.
.TP
-\fBaudio_backend_buffer_desired_length=\f1\fI44100\f1\fB;\f1
-Comment Here
+\fBaudio_backend_buffer_desired_length=\f1\fIbuffer_length_in_frames\f1\fB;\f1
+Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to stdout.
.SH OPTIONS
Many of the options take sensible default values, so you can normally ignore most of them. See the EXAMPLES section for typical usages.
diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml
index 6128b953..38b32898 100644
--- a/man/shairport-sync.7.xml
+++ b/man/shairport-sync.7.xml
@@ -215,16 +215,23 @@
"METADATA" SETTINGS
-
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level,
+ pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata.
+ To process metadata, Shairport Sync must have been compiled with metadata support included.
+ You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
+
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
enabled="choice";
- Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it, along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
+ Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it,
+ along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
include_cover_art="choice";
- Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe. A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe. The default is "no".
+ Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe.
+ A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe.
+ The default is "no".
pipe_name="filepathname";
@@ -232,7 +239,8 @@
"SESSIONCONTROL" SETTINGS
-
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
+
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes.
+ You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
@@ -247,72 +255,121 @@
wait_for_completion="choice";
- Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins and run_this_after_play_ends have completed execution before continuing. The default is "no".
+ Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins
+ and run_this_after_play_ends have completed execution before continuing. The default is "no".
-
allow_session_interruption="no";
- Comment Here
+
allow_session_interruption="choice";
+ If choice is set to "yes", then another source will be able to interrupt an existing play session and start a new one.
+ When set to "no" (the default), other devices attempting to interrupt a session will fail, receiving a busy signal.
-
session_timeout=120;
- Comment Here
+
session_timeout=seconds;
+ If a play session has been established and the source disappears without warning (such as a device going out of range of a network)
+ then wait for seconds seconds before ending the session. Once the session has terminated, other devices can use it.
+ The default is 120 seconds.
"ALSA" SETTINGS
- These are the settings available within the alsa group:
+
These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system.
+ (By the way, you can use tools such as alsamixer or aplay to discover what devices are available.)
+ Use these settings to select the output device and the mixer control to be used to control the output volume.
+ You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the alsa group settings:
-
output_device="default";
- Comment Here
+
output_device="output_device";
+ Use the output device called output_device. The default is the device called "device".
-
mixer_type="software";
- "software" or "hardware"
+
+
mixer_control_name="name";
+ Specify the name of the mixer control to be used by shairport-sync to control the volume.
+ The mixer control must be on the mixer device, which by default is the output device.
+ If you do not specify a mixer control name, shaiport-sync will control the volume in software.
+
+
mixer_type="mixer_type";
+ This setting is deprecated and will be removed soon. If you wish to use a mixer control to control the volume, then set mixer_type to "hardware".
+ The default is "software".
-
mixer_device="default";
- actually, the mixer default is whatever the output_device is. Normally you wouldn't have to use this.
+
mixer_device="mixer_device";
+ By default, the mixer is assumed to be output_device is. Use this setting to specify a device other than the output device.
-
mixer_control_name="PCM";
- the name of the mixer to use -- there is no default.
+
audio_backend_latency_offset=offset;
+ Set this offset, in frames, to compensate for a fixed delay in the audio back end.
+ For example, if the output device delays by 100 ms, set this to -4410.
-
audio_backend_latency_offset=0;
- Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-
-
-
audio_backend_buffer_desired_length=6615;
- If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
+
audio_backend_buffer_desired_length=length;
+ Use this to set the desired number frames to be in the output device's hardware output buffer.
+ The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines.
+ If too large, the response times when using a software mixer become annoying, or it may exceed the hardware buffer size.
+ It may need to be larger on low-powered machines performing other tasks, such as processing metadata.
"PIPE" SETTINGS
- These are the settings available within the pipe group:
+
These settings are for the PIPE backend, used to route audio to a named unix pipe. The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second,
+ stereo.
+
Use the name setting to set the name and location of the pipe.
+
There are two further settings affecting timing that might be useful if the pipe reader is, for example,
+ a program to play an audio stream such as aplay. The audio_backend_latency_offset affects precisely when the first audio packet is sent
+ and the audio_backend_buffer_desired_length setting affects the nominal output buffer size.
+
These are the settings available within the pipe group:
-
-
audio_backend_latency_offset=0;
- Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-
-
-
audio_backend_buffer_desired_length=44100;
- Comment Here
-
name="/path/to/pipe";
- there is no default pipe name for the output
+ Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown.
+ Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached.
+ The sender will wait for up to five seconds for a packet to be written before discarding it.
+
+
+
+
audio_backend_latency_offset=offset_in_frames;
+
+ Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played.
+ You can offset the time of initial audio output relative to its nominal time using this setting.
+ For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410.
+
+
+ Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe.
+ For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
+ send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames.
+ Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
+ Shairport Sync performs no stuffing or interpolation when writing to a pipe.
+
"STDOUT" SETTINGS
- These are the settings available within the stdout group:
+
These settings are for the STDOUT backend, used to route audio to standard output ("stdout").
+ The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
+
There are two settings affecting timing that might be useful if the stdout reader is, for example,
+ a program to play an audio stream such as aplay. The audio_backend_latency_offset affects precisely when the first audio packet is sent
+ and the audio_backend_buffer_desired_length setting affects the nominal output buffer size.
+
These are the settings available within the stdout group:
-
audio_backend_latency_offset=0;
- Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+
audio_backend_latency_offset=offset_in_frames;
+
+ Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played.
+ You can offset the time of initial audio output relative to its nominal time using this setting.
+ For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410.
+
+ Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout.
+ For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
+ send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames.
+ Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
+ Shairport Sync performs no stuffing or interpolation when writing to stdout.
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata. To process metadata, Shairport Sync must have been compiled with metadata support included. You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
+
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level,
+ pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata.
+ To process metadata, Shairport Sync must have been compiled with metadata support included.
+ You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
+
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
enabled="choice";
- Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it, along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
+ Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it,
+ along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
include_cover_art="choice";
- Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe. A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe. The default is "no".
+ Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe.
+ A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe.
+ The default is "no".
pipe_name="filepathname";
@@ -214,7 +221,8 @@
"SESSIONCONTROL" SETTINGS
-
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
+
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes.
+ You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
@@ -229,72 +237,121 @@
wait_for_completion="choice";
- Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins and run_this_after_play_ends= have completed execution before continuing. The default is "no".
+ Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins
+ and run_this_after_play_ends have completed execution before continuing. The default is "no".
-
allow_session_interruption="no";
- Comment Here
+
allow_session_interruption="choice";
+ If choice is set to "yes", then another source will be able to interrupt an existing play session and start a new one.
+ When set to "no" (the default), other devices attempting to interrupt a session will fail, receiving a busy signal.
-
session_timeout=120;
- Comment Here
+
session_timeout=seconds;
+ If a play session has been established and the source disappears without warning (such as a device going out of range of a network)
+ then wait for seconds seconds before ending the session. Once the session has terminated, other devices can use it.
+ The default is 120 seconds.
"ALSA" SETTINGS
- These are the settings available within the alsa group:
+
These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system.
+ (By the way, you can use tools such as alsamixer or aplay to discover what devices are available.)
+ Use these settings to select the output device and the mixer control to be used to control the output volume.
+ You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the alsa group settings:
-
output_device="default";
- Comment Here
+
output_device="output_device";
+ Use the output device called output_device. The default is the device called "device".
-
mixer_type="software";
- "software" or "hardware"
+
+
mixer_control_name="name";
+ Specify the name of the mixer control to be used by shairport-sync to control the volume.
+ The mixer control must be on the mixer device, which by default is the output device.
+ If you do not specify a mixer control name, shaiport-sync will control the volume in software.
+
+
mixer_type="mixer_type";
+ This setting is deprecated and will be removed soon. If you wish to use a mixer control to control the volume, then set mixer_type to "hardware".
+ The default is "software".
-
mixer_device="default";
- actually, the mixer default is whatever the output_device is. Normally you wouldn't have to use this.
+
mixer_device="mixer_device";
+ By default, the mixer is assumed to be output_device is. Use this setting to specify a device other than the output device.
-
mixer_control_name="PCM";
- the name of the mixer to use -- there is no default.
+
audio_backend_latency_offset=offset;
+ Set this offset, in frames, to compensate for a fixed delay in the audio back end.
+ For example, if the output device delays by 100 ms, set this to -4410.
-
audio_backend_latency_offset=0;
- Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-
-
-
audio_backend_buffer_desired_length=6615;
- If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
+
audio_backend_buffer_desired_length=length;
+ Use this to set the desired number frames to be in the output device's hardware output buffer.
+ The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines.
+ If too large, the response times when using a software mixer become annoying, or it may exceed the hardware buffer size.
+ It may need to be larger on low-powered machines performing other tasks, such as processing metadata.
"PIPE" SETTINGS
- These are the settings available within the pipe group:
+
These settings are for the PIPE backend, used to route audio to a named unix pipe. The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second,
+ stereo.
+
Use the name setting to set the name and location of the pipe.
+
There are two further settings affecting timing that might be useful if the pipe reader is, for example,
+ a program to play an audio stream such as aplay. The audio_backend_latency_offset affects precisely when the first audio packet is sent
+ and the audio_backend_buffer_desired_length setting affects the nominal output buffer size.
+
These are the settings available within the pipe group:
-
audio_backend_latency_offset=0;
- Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-
-
-
audio_backend_buffer_desired_length=44100;
- Comment Here
-
-
name="/path/to/pipe";
- there is no default pipe name for the output
+ Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown.
+ Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached.
+ The sender will wait for up to five seconds for a packet to be written before discarding it.
+
+
+
+
audio_backend_latency_offset=offset_in_frames;
+
+ Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played.
+ You can offset the time of initial audio output relative to its nominal time using this setting.
+ For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410.
+
+
+
+
+
+ Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe.
+ For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
+ send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames.
+ Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
+ Shairport Sync performs no stuffing or interpolation when writing to a pipe.
+
"STDOUT" SETTINGS
- These are the settings available within the stdout group:
+
These settings are for the STDOUT backend, used to route audio to standard output ("stdout").
+ The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
+
There are two settings affecting timing that might be useful if the stdout reader is, for example,
+ a program to play an audio stream such as aplay. The audio_backend_latency_offset affects precisely when the first audio packet is sent
+ and the audio_backend_buffer_desired_length setting affects the nominal output buffer size.
+
These are the settings available within the stdout group:
-
audio_backend_latency_offset=0;
- Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+
audio_backend_latency_offset=offset_in_frames;
+
+ Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played.
+ You can offset the time of initial audio output relative to its nominal time using this setting.
+ For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410.
-
+
+ Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout.
+ For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
+ send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames.
+ Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
+ Shairport Sync performs no stuffing or interpolation when writing to stdout.
+
+
+
From 3016ed33bfa2f5ed2a4110dbdf5014f2df593d1a Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Tue, 18 Aug 2015 08:19:36 -0400
Subject: [PATCH 35/44] Small typo fixes
---
man/shairport-sync.7 | 10 +++++-----
man/shairport-sync.7.xml | 10 +++++-----
man/shairport-sync.html | 10 +++++-----
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/man/shairport-sync.7 b/man/shairport-sync.7
index b2737a4d..6301ed32 100644
--- a/man/shairport-sync.7
+++ b/man/shairport-sync.7
@@ -152,7 +152,7 @@ If a play session has been established and the source disappears without warning
These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system. (By the way, you can use tools such as \fBalsamixer\f1 or \fBaplay\f1 to discover what devices are available.) Use these settings to select the output device and the mixer control to be used to control the output volume. You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the \fBalsa\f1 group settings:
.TP
\fBoutput_device=\f1\fI"output_device"\f1\fB;\f1
-Use the output device called \fIoutput_device\f1. The default is the device called "device".
+Use the output device called \fIoutput_device\f1. The default is the device called "default".
.TP
.TP
\fBmixer_control_name=\f1\fI"name"\f1\fB;\f1
@@ -181,10 +181,10 @@ These are the settings available within the \fBpipe\f1 group:
Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown. Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached. The sender will wait for up to five seconds for a packet to be written before discarding it.
.TP
\fBaudio_backend_latency_offset=\f1\fIoffset_in_frames\f1\fB;\f1
-Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410.
+Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
.TP
\fBaudio_backend_buffer_desired_length=\f1\fIbuffer_length_in_frames\f1\fB;\f1
-Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to a pipe.
+Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100.
.TP
\fB"STDOUT" SETTINGS\f1
These settings are for the STDOUT backend, used to route audio to standard output ("stdout"). The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
@@ -194,10 +194,10 @@ There are two settings affecting timing that might be useful if the stdout reade
These are the settings available within the \fBstdout\f1 group:
.TP
\fBaudio_backend_latency_offset=\f1\fIoffset_in_frames\f1\fB;\f1
-Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410.
+Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
.TP
\fBaudio_backend_buffer_desired_length=\f1\fIbuffer_length_in_frames\f1\fB;\f1
-Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to stdout.
+Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100.
.SH OPTIONS
Many of the options take sensible default values, so you can normally ignore most of them. See the EXAMPLES section for typical usages.
diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml
index 38b32898..79023243 100644
--- a/man/shairport-sync.7.xml
+++ b/man/shairport-sync.7.xml
@@ -278,7 +278,7 @@
output_device="output_device";
- Use the output device called output_device. The default is the device called "device".
+ Use the output device called output_device. The default is the device called "default".
@@ -329,7 +329,7 @@
Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played.
You can offset the time of initial audio output relative to its nominal time using this setting.
- For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410.
+ For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
@@ -339,7 +339,7 @@
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames.
Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to a pipe.
+ Shairport Sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100.
@@ -356,7 +356,7 @@
Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played.
You can offset the time of initial audio output relative to its nominal time using this setting.
- For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410.
+ For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
@@ -366,7 +366,7 @@
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames.
Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to stdout.
+ Shairport Sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100.
- Use the output device called output_device. The default is the device called "device".
+ Use the output device called output_device. The default is the device called "default".
@@ -311,7 +311,7 @@
Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played.
You can offset the time of initial audio output relative to its nominal time using this setting.
- For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410.
+ For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
@@ -321,7 +321,7 @@
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames.
Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to a pipe.
+ Shairport Sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100.
@@ -338,7 +338,7 @@
Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played.
You can offset the time of initial audio output relative to its nominal time using this setting.
- For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410.
+ For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
@@ -348,7 +348,7 @@
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames.
Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to stdout.
+ Shairport Sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100.
From bc7aadc53e0f8d3b0f65d7f35c9d8b9cc6d584b8 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 10:09:50 -0400
Subject: [PATCH 36/44] Drop the update-rc.d from the make install script
---
Makefile.am | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 0a4239a0..fcf68059 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,7 +59,6 @@ endif
if INSTALL_SYSTEMV
[ -e $(DESTDIR)/etc/init.d ] || mkdir -p $(DESTDIR)/etc/init.d
[ -f $(DESTDIR)/etc/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)/etc/init.d/
- update-rc.d shairport-sync defaults 90 10
endif
if INSTALL_SYSTEMD
[ -e $(DESTDIR)/usr/lib/systemd/system ] || mkdir -p $(DESTDIR)/usr/lib/systemd/system
From dc81e7d5929aaaed4bc9a38713f236a1a7259af0 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 10:10:53 -0400
Subject: [PATCH 37/44] Bump version
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index e7dd927a..85ac9dfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.3.11], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.3.12], [mikebrady@eircom.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
From f8f7a3f11dda4214096f21e6d82c8e7e3d0905d5 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 10:11:43 -0400
Subject: [PATCH 38/44] Remove mixer_type stuff and edit and reorganise
settings and comments
---
scripts/shairport-sync.conf | 59 ++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf
index 3bfcde5b..b2ac51a5 100644
--- a/scripts/shairport-sync.conf
+++ b/scripts/shairport-sync.conf
@@ -5,74 +5,73 @@
general =
{
// name = "Shairport Sync Player"; // This is the name the service will advertise to iTunes. The default is "Shairport Sync on "
-// mdns_backend = "avahi"; // not used, not tested
-// output_backend = "alsa"; // alsa is default, other possibilities are "stdout", "pulse", "dummy". Only alsa supports synchronisation.
-// port = 5000;
-// udp_port_base = 6001; // start allocation UDP ports from this port number
+// password = "secret"; // comment out this line if you want to have no password
+// interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor.
+// output_backend = "alsa"; // Run "shairport-sync -h" to get a list of all output_backends, e.g. "alsa", "pipe", "stdout". The default is the first one.
+// mdns_backend = "avahi"; // Run "shairport-sync -h" to get a list of all mdns_backends. The default is the first one.
+// port = 5000; // Listen for service requests on this port
+// udp_port_base = 6001; // start allocating UDP ports from this port number when needed
// udp_port_range = 100; // look for free ports in this number of places, starting at the UDP port base (only three are needed).
-// password = "secret"; // default is no password
-// interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr"
-// statistics = "no"; // print statistics in the log
-// drift = 88; // allow this number of frames of drift before correcting it
+// statistics = "no"; // set to "yes" to print statistics in the log
+// drift = 88; // allow this number of frames of drift away from exact synchronisation before attempting to correct it
// resync_threshold = 2205; // a synchronisation error greater than this will cause resynchronisation; 0 disables it
-// log_verbosity = 0; // "0" means no verbosity, "3" is most verbose.
+// log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
// ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
};
-// Latencies for different sources.
+// Latencies for different sources. These have been estimated from listening tests.
+// It's probably better to compensate for a delay in the output device using the alsa "audio_backend_latency_offset" setting -- see below.
latencies =
{
-// default = 88200;
-// itunes = 99400;
+// default = 88200; // used for unrecognised sources and for iTunes up to and including iTunes 9.X.
+// itunes = 99400; // used for iTunes 10 or later
// airplay = 88200;
// forkedDaapd = 99400;
};
-
// How to deal with metadata, including artwork
metadata =
{
-// enabled = "no";
-// include_cover_art = "no";
+// enabled = "no"; // et to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
+// include_cover_art = "no"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
// pipe_name = "/tmp/shairport-sync-metadata";
};
// Advanced parameters for controlling how a Shairport Sync runs
sessioncontrol =
{
-// run_this_before_play_begins = "/path/to/application and args";
-// run_this_after_play_ends = "/path/to/application and args";
-// wait_for_completion = "no";
-// allow_session_interruption = "no";
-// session_timeout = 120;
+// run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line
+// run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line
+// wait_for_completion = "no"; // set to "yes" to get Shairport Sync to wait until the "run_this..." applications have terminated before continuing
+// allow_session_interruption = "no"; // set to "yes" to allow another device to interrupt Shairport Sync while it's playing from an existing audio source
+// session_timeout = 120; // wait for this number of seconds after a source disappears before terminating the session and becoming available again.
};
//
// Back End Settings
//
-// These are parameters for the alsa back end, the only back end that supports synchronisation
+// These are parameters for the "alsa" audio back end, the only back end that supports synchronised audio.
alsa =
{
-// output_device = "default";
-// mixer_type = "software"; // "software" or "hardware"
-// mixer_device = "default"; //actually, the mixer default is whatever the output_device is. Normally you wouldn't have to use this.
-// mixer_control_name = "PCM"; // the name of the mixer to use -- there is no default.
+// output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
+// mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
+// mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
// audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
// audio_backend_buffer_desired_length = 6615; // If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
};
-// These are parameters for the pipe back end, an experimental back end that directs output to a pipe.
+// These are parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
pipe =
{
-// audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-// audio_backend_buffer_desired_length = 44100;
// name = "/path/to/pipe"; // there is no default pipe name for the output
+// audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+// audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
};
-// These are parameters for the stdout audio back end, an experimental back end that directs output to stdout.
+// These are parameters for the "stdout" audio back end, a back end that directs raw CD-style audio output to stdout. No interpolation is done.
stdout =
{
// audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
-// audio_backend_buffer_desired_length = 44100;
+// audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
};
From a258925eae6ced61cc6bc73d21e3ee8134943f51 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 10:12:53 -0400
Subject: [PATCH 39/44] More edits and typo fixes and update references to
mixer_type
---
man/shairport-sync.7 | 60 +++++++++++++++--------------
man/shairport-sync.7.xml | 82 ++++++++++++++++++++--------------------
man/shairport-sync.html | 82 ++++++++++++++++++++--------------------
3 files changed, 113 insertions(+), 111 deletions(-)
diff --git a/man/shairport-sync.7 b/man/shairport-sync.7
index 6301ed32..1449c43d 100644
--- a/man/shairport-sync.7
+++ b/man/shairport-sync.7
@@ -17,11 +17,13 @@ shairport-sync -R\fB
shairport-sync -V\fB
\f1
.SH DESCRIPTION
-shairport-sync plays audio streamed from iTunes or from an AirPlay device to an audio device connected via an audio back end. At present, the only fully-implemented back end is for ALSA.
+shairport-sync plays audio streamed from iTunes or from an AirPlay device to an ALSA-compatible audio output device.
A feature of shairport-sync is that the audio is played synchronously. This means that if many devices are playing the same stream at the same time, all the outputs will stay in step with one another. This allows multiple devices play the same source without getting out of phase with one another, enabling, for example, simultaneous multi-room operation.
-Settings can be made using the configuration file (recommended for all new installations) or the by using command-line options.
+shairport-sync can additionally be compiled and configured to stream raw audio to a pipe or to stdout.
+
+Settings can be made using the configuration file (recommended for all new installations) or by using command-line options.
.SH CONFIGURATION FILE SETTINGS
You should use the configuration file for setting up shairport-sync. This file is normally \fI/etc/shairport-sync.conf\f1. You may need to have root privileges to modify it.
@@ -43,13 +45,11 @@ Settings are organised into groups, for example, there is a "general" group of s
\fBoutput_device = "hw:0";\f1
-\fBmixer_type = "hardware";\f1
-
\fBmixer_control_name = "PCM";\f1
\fB};\f1
-Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
+Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and (3) the output device. If the output device has a mixer that can be used for volume control, then (4) the volume control's name should be specificed. It is highly desirable to use the output device's mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
A sample configuration file with all possible settings, but with all of them commented out, is installed at \fI/etc/shairport-sync.conf.sample\f1.
@@ -73,25 +73,25 @@ Interpolate, or "stuff", the audio stream using the \fImode\f1. Interpolation he
Use this \fIsetting\f1 to enable ("yes") or disable ("no") the output of some statistical information on the console or in the log. The default is to disable statistics.
.TP
\fBmdns_backend=\f1\fI"backend"\f1\fB;\f1
-Shairport Sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS \fIbackend\f1. The default is "avahi". Perform the command \fBshairport-sync -h\f1 to get a list of available mDNS modules.
+shairport-sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS \fIbackend\f1. The default is "avahi". Perform the command \fBshairport-sync -h\f1 to get a list of available mDNS modules.
.TP
\fBoutput_backend=\f1\fI"backend"\f1\fB;\f1
-Shairport Sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio \fIbackend\f1. The default is "alsa". Perform the command \fBshairport-sync -h\f1 to get a list of available audio backends. Only the alsa backend supports synchronisation.
+shairport-sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio \fIbackend\f1. The default is "alsa". Perform the command \fBshairport-sync -h\f1 to get a list of available audio backends. Only the alsa backend supports synchronisation.
.TP
\fBport=\f1\fIportnumber\f1\fB;\f1
-Use this to specify the \fIportnumber\f1 Shairport Sync uses to listen for service requests from iTunes, etc. The default is port 5000.
+Use this to specify the \fIportnumber\f1 shairport-sync uses to listen for service requests from iTunes, etc. The default is port 5000.
.TP
-\fBudp_port_base=\f1\fI6001\f1\fB;\f1
-When Shairport Sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting \fIportnumber\f1 for these three ports. It will pick the first three unused ports starting from \fIportnumber\f1. The default is port 6001.
+\fBudp_port_base=\f1\fIportnumber\f1\fB;\f1
+When shairport-sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting \fIportnumber\f1 for these three ports. It will pick the first three unused ports starting from \fIportnumber\f1. The default is port 6001.
.TP
-\fBudp_port_range=\f1\fI100\f1\fB;\f1
-Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
+\fBudp_port_range=\f1\fIrange\f1\fB;\f1
+Use this in conjunction with the prevous setting to specify the \fIrange\f1 of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
.TP
\fBdrift=\f1\fIframes\f1\fB;\f1
Allow playback to drift up to \fIframes\f1 out of exact synchronization before attempting to correct it. The default is 88 frames, i.e. 2 ms. The smaller the tolerance, the more likely it is that overcorrection will occur. Overcorrection is when more corrections (insertions and deletions) are made than are strictly necessary to keep the stream in sync. Use the \fBstatistics\f1 setting to monitor correction levels. Corrections should not greatly exceed net corrections.
.TP
\fBresync_threshold=\f1\fIthreshold\f1\fB;\f1
-Resynchronise if timings differ by more than \fBthreshold\f1 frames. If the output timing differs from the source timing by more than the threshold, output will be muted and a full resynchronisation will occur. The default threshold is 2,205 frames, i.e. 50 milliseconds. Specify 0 to disable resynchronisation.
+Resynchronise if timings differ by more than \fIthreshold\f1 frames. If the output timing differs from the source timing by more than the threshold, output will be muted and a full resynchronisation will occur. The default threshold is 2,205 frames, i.e. 50 milliseconds. Specify 0 to disable resynchronisation.
.TP
\fBlog_verbosity=\f1\fI0\f1\fB;\f1
Use this to specify how much debugging information should be output or logged. "0" means no debug information, "3" means most debug information. The default is "0".
@@ -117,21 +117,21 @@ This is the \fIlatency\f1, in frames, used for forkedDaapd sources. Default is 9
This is the \fIlatency\f1, in frames, used when the source is unrecognised. Default is 88,200.
.TP
\fB"METADATA" SETTINGS\f1
-Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default \fI/tmp/shairport-sync-metadata\f1. To process metadata, Shairport Sync must have been compiled with metadata support included. You can check tht this is so by running \fBshairport-sync -V\f1; the identification string will contain the word \fBmetadata\f1.
+shairport-sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level, pause/resume, etc. It provides the metadata to a pipe, by default \fI/tmp/shairport-sync-metadata\f1. To process metadata, shairport-sync must have been compiled with metadata support included. You can check that this is so by running \fBshairport-sync -V\f1; the identification string will contain the word \fBmetadata\f1.
The \fBmetadata\f1 group of settings allow you to enable metadata handling and to control certain aspects of it:
.TP
\fBenabled=\f1\fI"choice"\f1\fB;\f1
-Set the \fIchoice\f1 to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it, along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
+Set the \fIchoice\f1 to "yes" to enable shairport-sync to look for metadata from the audio source and to forward it, along with metadata generated by shairport-sync itself, to the metadata pipe. The default is "no".
.TP
\fBinclude_cover_art=\f1\fI"choice"\f1\fB;\f1
-Set the \fIchoice\f1 to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe. A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe. The default is "no".
+Set the \fIchoice\f1 to "yes" to enable shairport-sync to look for cover art from the audio source and to include it in the feed to the metadata pipe. You must also enable metadata (see above). One reason for not including cover art is that the images can sometimes be very large and may delay transmission of subsequent metadata through the pipe. The default is "no".
.TP
\fBpipe_name=\f1\fI"filepathname"\f1\fB;\f1
Specify the absolute path name of the pipe through which metadata should be sent The default is \fI/tmp/shairport-sync-metadata\f1".
.TP
\fB"SESSIONCONTROL" SETTINGS\f1
-Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
+shairport-sync can run programs just before it starts to play an audio stream and just after it finishes. You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
.TP
\fBrun_this_before_play_begins=\f1\fI"/path/to/application and args"\f1\fB;\f1
Here you can specify a program and its arguments that will be run just before a play session begins. Be careful to include the full path to the application. The application must be marked as executable and, if it is a script, its first line must begin with the standard \fI#!/bin/...\f1 as appropriate.
@@ -140,7 +140,7 @@ Here you can specify a program and its arguments that will be run just before a
Here you can specify a program and its arguments that will be run just after a play session ends. Be careful to include the full path to the application. The application must be marked as executable and, if it is a script, its first line must begin with the standard \fI#!/bin/...\f1 as appropriate.
.TP
\fBwait_for_completion=\f1\fI"choice"\f1\fB;\f1
-Set \fIchoice\f1 to "yes" to make Shairport Sync wait until the programs specified in the \fBrun_this_before_play_begins\f1 and \fBrun_this_after_play_ends\f1 have completed execution before continuing. The default is "no".
+Set \fIchoice\f1 to "yes" to make shairport-sync wait until the programs specified in the \fBrun_this_before_play_begins\f1 and \fBrun_this_after_play_ends\f1 have completed execution before continuing. The default is "no".
.TP
\fBallow_session_interruption=\f1\fI"choice"\f1\fB;\f1
If \fBchoice\f1 is set to "yes", then another source will be able to interrupt an existing play session and start a new one. When set to "no" (the default), other devices attempting to interrupt a session will fail, receiving a busy signal.
@@ -149,24 +149,24 @@ If \fBchoice\f1 is set to "yes", then another source will be able to interrupt a
If a play session has been established and the source disappears without warning (such as a device going out of range of a network) then wait for \fIseconds\f1 seconds before ending the session. Once the session has terminated, other devices can use it. The default is 120 seconds.
.TP
\fB"ALSA" SETTINGS\f1
-These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system. (By the way, you can use tools such as \fBalsamixer\f1 or \fBaplay\f1 to discover what devices are available.) Use these settings to select the output device and the mixer control to be used to control the output volume. You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the \fBalsa\f1 group settings:
+These settings are for the ALSA back end, used to communicate with audio output devices in the ALSA system. (By the way, you can use tools such as \fBalsamixer\f1 or \fBaplay\f1 to discover what devices are available.) Use these settings to select the output device and the mixer control to be used to control the output volume. You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the \fBalsa\f1 group settings:
.TP
\fBoutput_device=\f1\fI"output_device"\f1\fB;\f1
Use the output device called \fIoutput_device\f1. The default is the device called "default".
.TP
.TP
\fBmixer_control_name=\f1\fI"name"\f1\fB;\f1
-Specify the \fIname\f1 of the mixer control to be used by shairport-sync to control the volume. The mixer control must be on the mixer device, which by default is the output device. If you do not specify a mixer control name, shaiport-sync will control the volume in software. \fBmixer_type=\f1\fI"mixer_type"\f1\fB;\f1
+Specify the \fIname\f1 of the mixer control to be used by shairport-sync to control the volume. The mixer control must be on the mixer device, which by default is the output device. If you do not specify a mixer control name, shairport-sync will adjust the volume in software. \fBmixer_type=\f1\fI"mixer_type"\f1\fB;\f1
This setting is deprecated and will be removed soon. If you wish to use a mixer control to control the volume, then set \fImixer_type\f1 to "hardware". The default is "software".
.TP
\fBmixer_device=\f1\fI"mixer_device"\f1\fB;\f1
-By default, the mixer is assumed to be output_device is. Use this setting to specify a device other than the output device.
+By default, the mixer is assumed to be output_device. Use this setting to specify a device other than the output device.
.TP
\fBaudio_backend_latency_offset=\f1\fIoffset\f1\fB;\f1
Set this \fIoffset\f1, in frames, to compensate for a fixed delay in the audio back end. For example, if the output device delays by 100 ms, set this to -4410.
.TP
\fBaudio_backend_buffer_desired_length=\f1\fIlength\f1\fB;\f1
-Use this to set the desired number frames to be in the output device's hardware output buffer. The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines. If too large, the response times when using a software mixer become annoying, or it may exceed the hardware buffer size. It may need to be larger on low-powered machines performing other tasks, such as processing metadata.
+Use this to set the desired number frames to be in the output device's hardware output buffer. The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines. If too large, the response times when using software volume control (i.e. when not using a mixer control to control volume) become annoying, or it may exceed the hardware buffer size. It may need to be larger on low-powered machines that are also performing other tasks, such as processing metadata.
.TP
\fB"PIPE" SETTINGS\f1
These settings are for the PIPE backend, used to route audio to a named unix pipe. The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
@@ -178,13 +178,13 @@ There are two further settings affecting timing that might be useful if the pipe
These are the settings available within the \fBpipe\f1 group:
.TP
\fBname=\f1\fI"/path/to/pipe"\f1\fB;\f1
-Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown. Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached. The sender will wait for up to five seconds for a packet to be written before discarding it.
+Use this to specify the name and location of the pipe. The pipe will be created and opened when shairport-sync starts up and will be closed upon shutdown. Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached. The sender will wait for up to five seconds for a packet to be written before discarding it.
.TP
\fBaudio_backend_latency_offset=\f1\fIoffset_in_frames\f1\fB;\f1
Packets of audio frames are written to the pipe synchronously -- that is, they are written to at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to the pipe 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
.TP
\fBaudio_backend_buffer_desired_length=\f1\fIbuffer_length_in_frames\f1\fB;\f1
-Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100.
+Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the pipe reader consumes audio packets faster or slower than they are supplied, the buffer will eventually empty or overflow -- shairport-sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100 frames.
.TP
\fB"STDOUT" SETTINGS\f1
These settings are for the STDOUT backend, used to route audio to standard output ("stdout"). The audio is in raw CD audio format: PCM 16 bit little endian, 44,100 samples per second, stereo.
@@ -197,8 +197,10 @@ These are the settings available within the \fBstdout\f1 group:
Packets of audio frames are written to stdout synchronously -- that is, they are written at exactly the time they should be played. You can offset the time of initial audio output relative to its nominal time using this setting. For example to send an audio stream to stdout 100 milliseconds before it is due to be played, set this to -4410. Default setting is 0.
.TP
\fBaudio_backend_buffer_desired_length=\f1\fIbuffer_length_in_frames\f1\fB;\f1
-Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually -- Shairport Sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100.
+Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout. For example, if you send the first packet of audio exactly when it is due and, using a \fIaudio_backend_buffer_desired_length\f1 setting of 44100, send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames. Note that if the stdout reader consumes audio packets faster or slower than they are supplied, the buffer will eventually empty or overflow -- shairport-sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100 frames.
.SH OPTIONS
+Note: if you are setting up shairport-sync for the first time or are updating an existing installation, you are encouraged to use the configuration file settings described above. Most of the options described below simply replicate the configuration settings and are retained to provide backward compatability with older installations of shairport-sync.
+
Many of the options take sensible default values, so you can normally ignore most of them. See the EXAMPLES section for typical usages.
The command line for shairport-sync can take two kinds of options: regular \fBprogram options\f1 and \fBaudio backend options\f1. Program options are always listed first, followed by any audio backend options, preceded by a \fB--\f1 symbol.
@@ -308,17 +310,17 @@ Use the specified output \fIdevice\f1. You may specify a card, e.g. \fBhw:0\f1,
Use the specified hardware \fImixer\f1 for volume control. Use this to specify where the mixer is to be found. For example, if the mixer is associated with a card, as is often the case, specify the card, e.g. \fBhw:0\f1. If (unusually) the mixer is associated with a specific device on a card, specify the device, e.g. \fBhw:0,1\f1. The default is the device named in the \fB-d\f1 option, if given, or the device named \fBdefault\f1.
.TP
\fB-t \f1\fIdevicetype\f1
-The type of the output device is \fIdevicetype\f1 which must be \fBhardware\f1 or \fBsoftware\f1. The default is \fBsoftware\f1. If you specify \fBhardware\f1 you must also specify the output device using the \fB-d\f1 option and the name of the volume control using the \fB-c\f1 option. You may also need to specify the mixer using the \fB-m\f1 option.
+This option is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the -c option -- if you specify a mixer name with the -c option, it is assumed that the mixer is implemented in hardware.
.SH EXAMPLES
Here is a slightly contrived but typical example:
-shairport-sync \fB-d\f1 \fB-a "Joe's Stereo"\f1 \fB-S soxr\f1 \fB--\f1 \fB-d hw:1,0\f1 \fB-m hw:1\f1 \fB-t hardware\f1 \fB-c PCM\f1
+shairport-sync \fB-d\f1 \fB-a "Joe's Stereo"\f1 \fB-S soxr\f1 \fB--\f1 \fB-d hw:1,0\f1 \fB-m hw:1\f1 \fB-c PCM\f1
-The program will run in daemon mode ( \fB-d\f1 ), will be visible as "Joe's Stereo" ( \fB-a "Joe's Stereo"\f1 ) and will use the SoX Resampler Library-based stuffing ( \fB-S soxr\f1 ). The audio backend options following the \fB--\f1 separator specify that the audio will be output on output 0 of soundcard 1 ( \fB-d hw:1,0\f1 ) and will take advantage of the same sound card's hardware (\fB-t hardware\f1) mixer ( \fB-m hw:1\f1 ) using the level control named "PCM" ( \fB-c "PCM"\f1 ).
+The program will run in daemon mode ( \fB-d\f1 ), will be visible as "Joe's Stereo" ( \fB-a "Joe's Stereo"\f1 ) and will use the SoX Resampler Library-based stuffing ( \fB-S soxr\f1 ). The audio backend options following the \fB--\f1 separator specify that the audio will be output on output 0 of soundcard 1 ( \fB-d hw:1,0\f1 ) and will take advantage of the same sound card's mixer ( \fB-m hw:1\f1 ) using the level control named "PCM" ( \fB-c "PCM"\f1 ).
The example above is slightly contrived in order to show the use of the \fB-m\f1 option. Typically, output 0 is the default output of a card, so the output device could be written \fB-d hw:1\f1 and then the mixer option would be unnecessary, giving the following, simpler, command:
-shairport-sync \fB-d\f1 \fB-a "Joe's Stereo"\f1 \fB-S soxr\f1 \fB--\f1 \fB-d hw:1\f1 \fB-t hardware\f1 \fB-c PCM\f1
+shairport-sync \fB-d\f1 \fB-a "Joe's Stereo"\f1 \fB-S soxr\f1 \fB--\f1 \fB-d hw:1\f1 \fB-c PCM\f1
.SH CREDITS
Mike Brady developed shairport-sync from the original shairport by James Laird.
diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml
index 79023243..14c8be65 100644
--- a/man/shairport-sync.7.xml
+++ b/man/shairport-sync.7.xml
@@ -66,8 +66,7 @@
shairport-sync plays audio streamed from iTunes or from an AirPlay
- device to an audio device connected via an audio back end. At present,
- the only fully-implemented back end is for ALSA.
+ device to an ALSA-compatible audio output device.
A feature of shairport-sync is that the audio is played synchronously.
This means that if many devices are playing the same stream at the same
@@ -76,7 +75,9 @@
enabling, for example, simultaneous multi-room operation.
-
Settings can be made using the configuration file (recommended for all new installations) or the by using command-line options.
+
shairport-sync can additionally be compiled and configured to stream raw audio to a pipe or to stdout.
+
+
Settings can be made using the configuration file (recommended for all new installations) or by using command-line options.
@@ -97,12 +98,11 @@
alsa = {
output_device = "hw:0";
-
mixer_type = "hardware";
mixer_control_name = "PCM";
};
Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and
- (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
+ (3) the output device. If the output device has a mixer that can be used for volume control, then (4) the volume control's name should be specificed. It is highly desirable to use the output device's mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
A sample configuration file with all possible settings, but with all of them commented out, is installed at /etc/shairport-sync.conf.sample.
@@ -149,23 +149,23 @@
mdns_backend="backend";
- Shairport Sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS backend. The default is "avahi". Perform the command shairport-sync -h to get a list of available mDNS modules.
+ shairport-sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS backend. The default is "avahi". Perform the command shairport-sync -h to get a list of available mDNS modules.
output_backend="backend";
- Shairport Sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio backend. The default is "alsa". Perform the command shairport-sync -h to get a list of available audio backends. Only the alsa backend supports synchronisation.
+ shairport-sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio backend. The default is "alsa". Perform the command shairport-sync -h to get a list of available audio backends. Only the alsa backend supports synchronisation.
port=portnumber;
- Use this to specify the portnumber Shairport Sync uses to listen for service requests from iTunes, etc. The default is port 5000.
+ Use this to specify the portnumber shairport-sync uses to listen for service requests from iTunes, etc. The default is port 5000.
-
udp_port_base=6001;
- When Shairport Sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting portnumber for these three ports. It will pick the first three unused ports starting from portnumber. The default is port 6001.
+
udp_port_base=portnumber;
+ When shairport-sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting portnumber for these three ports. It will pick the first three unused ports starting from portnumber. The default is port 6001.
-
udp_port_range=100;
- Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
+
udp_port_range=range;
+ Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
drift=frames;
@@ -177,7 +177,7 @@
resync_threshold=threshold;
- Resynchronise if timings differ by more than threshold frames.
+ Resynchronise if timings differ by more than threshold frames.
If the output timing differs from the source timing by more than
the threshold, output will be muted and a full resynchronisation
will occur. The default threshold is 2,205 frames, i.e. 50
@@ -215,22 +215,23 @@
"METADATA" SETTINGS
-
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level,
+
shairport-sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level,
pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata.
- To process metadata, Shairport Sync must have been compiled with metadata support included.
- You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
+ To process metadata, shairport-sync must have been compiled with metadata support included.
+ You can check that this is so by running shairport-sync -V; the identification string will contain the word metadata.
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
enabled="choice";
- Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it,
- along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
+ Set the choice to "yes" to enable shairport-sync to look for metadata from the audio source and to forward it,
+ along with metadata generated by shairport-sync itself, to the metadata pipe. The default is "no".
include_cover_art="choice";
- Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe.
- A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe.
+ Set the choice to "yes" to enable shairport-sync to look for cover art from the audio source and to include it in the feed to the metadata pipe.
+ You must also enable metadata (see above).
+ One reason for not including cover art is that the images can sometimes be very large and may delay transmission of subsequent metadata through the pipe.
The default is "no".
@@ -239,7 +240,7 @@
"SESSIONCONTROL" SETTINGS
-
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes.
+
shairport-sync can run programs just before it starts to play an audio stream and just after it finishes.
You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
@@ -255,7 +256,7 @@
wait_for_completion="choice";
- Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins
+ Set choice to "yes" to make shairport-sync wait until the programs specified in the run_this_before_play_begins
and run_this_after_play_ends have completed execution before continuing. The default is "no".
@@ -271,7 +272,7 @@
"ALSA" SETTINGS
-
These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system.
+
These settings are for the ALSA back end, used to communicate with audio output devices in the ALSA system.
(By the way, you can use tools such as alsamixer or aplay to discover what devices are available.)
Use these settings to select the output device and the mixer control to be used to control the output volume.
You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the alsa group settings:
@@ -285,7 +286,7 @@
mixer_control_name="name";
Specify the name of the mixer control to be used by shairport-sync to control the volume.
The mixer control must be on the mixer device, which by default is the output device.
- If you do not specify a mixer control name, shaiport-sync will control the volume in software.
+ If you do not specify a mixer control name, shairport-sync will adjust the volume in software.
mixer_type="mixer_type";
This setting is deprecated and will be removed soon. If you wish to use a mixer control to control the volume, then set mixer_type to "hardware".
@@ -293,7 +294,7 @@
mixer_device="mixer_device";
- By default, the mixer is assumed to be output_device is. Use this setting to specify a device other than the output device.
+ By default, the mixer is assumed to be output_device. Use this setting to specify a device other than the output device.
audio_backend_latency_offset=offset;
@@ -304,8 +305,9 @@
audio_backend_buffer_desired_length=length;
Use this to set the desired number frames to be in the output device's hardware output buffer.
The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines.
- If too large, the response times when using a software mixer become annoying, or it may exceed the hardware buffer size.
- It may need to be larger on low-powered machines performing other tasks, such as processing metadata.
+ If too large, the response times when using software volume control (i.e. when not using a mixer control to control volume) become annoying,
+ or it may exceed the hardware buffer size.
+ It may need to be larger on low-powered machines that are also performing other tasks, such as processing metadata.
"PIPE" SETTINGS
@@ -319,7 +321,7 @@
name="/path/to/pipe";
- Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown.
+ Use this to specify the name and location of the pipe. The pipe will be created and opened when shairport-sync starts up and will be closed upon shutdown.
Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached.
The sender will wait for up to five seconds for a packet to be written before discarding it.
@@ -338,8 +340,8 @@
Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe.
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames.
- Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100.
+ Note that if the pipe reader consumes audio packets faster or slower than they are supplied, the buffer will eventually empty or overflow --
+ shairport-sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100 frames.
@@ -365,8 +367,8 @@
Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout.
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames.
- Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100.
+ Note that if the stdout reader consumes audio packets faster or slower than they are supplied, the buffer will eventually empty or overflow --
+ shairport-sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100 frames.
@@ -374,6 +376,10 @@
+
Note: if you are setting up shairport-sync for the first time or are updating an existing installation,
+ you are encouraged to use the configuration file settings described above. Most of the options described below
+ simply replicate the configuration settings and are retained to provide backward compatability with older installations of shairport-sync.
+
Many of the options take sensible default values, so you can normally
ignore most of them. See the EXAMPLES section for typical usages.
@@ -700,11 +706,8 @@
-t devicetype
- The type of the output device is devicetype which must be
- hardware or software. The default is software.
- If you specify hardware you must also specify the output device using the
- -d option and the name of the volume control using the -c option.
- You may also need to specify the mixer using the -m option.
+ This option is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the -c option
+ -- if you specify a mixer name with the -c option, it is assumed that the mixer is implemented in hardware.
The program will run in daemon mode ( -d ), will be visible as
@@ -725,8 +727,7 @@
Library-based stuffing ( -S soxr ).
The audio backend options following the -- separator specify
that the audio will be output on output 0 of soundcard 1 (
- -d hw:1,0 ) and will take advantage of the same sound card's hardware
- (-t hardware) mixer ( -m hw:1 )
+ -d hw:1,0 ) and will take advantage of the same sound card's mixer ( -m hw:1 )
using the level control named "PCM" ( -c "PCM" ).
The example above is slightly contrived in order to show the use of the -m option.
@@ -738,7 +739,6 @@
-S soxr---d hw:1
- -t hardware-c PCM
diff --git a/man/shairport-sync.html b/man/shairport-sync.html
index a936dd53..c587b03e 100644
--- a/man/shairport-sync.html
+++ b/man/shairport-sync.html
@@ -46,8 +46,7 @@
Description
shairport-sync plays audio streamed from iTunes or from an AirPlay
- device to an audio device connected via an audio back end. At present,
- the only fully-implemented back end is for ALSA.
+ device to an ALSA-compatible audio output device.
A feature of shairport-sync is that the audio is played synchronously.
This means that if many devices are playing the same stream at the same
@@ -56,7 +55,9 @@
enabling, for example, simultaneous multi-room operation.
-
Settings can be made using the configuration file (recommended for all new installations) or the by using command-line options.
+
shairport-sync can additionally be compiled and configured to stream raw audio to a pipe or to stdout.
+
+
Settings can be made using the configuration file (recommended for all new installations) or by using command-line options.
@@ -79,12 +80,11 @@
alsa = {
output_device = "hw:0";
-
mixer_type = "hardware";
mixer_control_name = "PCM";
};
Most settings have sensible default values, so -- as in the example above -- users generally only need to set (1) the service name, (2) a password (if desired) and
- (3) the output device. If the output device has a hardware mixer that can be used for volume control, then (4) the fact that the output mixer is hardware and (5) the output device mixer's volume-control name should be specificed. It is highly desirable to use the hardware mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
+ (3) the output device. If the output device has a mixer that can be used for volume control, then (4) the volume control's name should be specificed. It is highly desirable to use the output device's mixer for volume control, if available -- response time is reduced to zero and the processor load is reduced. In the example above, "soxr" interpolation was also enabled.
A sample configuration file with all possible settings, but with all of them commented out, is installed at /etc/shairport-sync.conf.sample.
@@ -131,23 +131,23 @@
mdns_backend="backend";
- Shairport Sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS backend. The default is "avahi". Perform the command shairport-sync -h to get a list of available mDNS modules.
+ shairport-sync has a number of modules of code ("backends") for interacting with the mDNS service to be used to advertise itself. Normally, the first mDNS backend that works is selected. This setting forces the selection of the specific mDNS backend. The default is "avahi". Perform the command shairport-sync -h to get a list of available mDNS modules.
output_backend="backend";
- Shairport Sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio backend. The default is "alsa". Perform the command shairport-sync -h to get a list of available audio backends. Only the alsa backend supports synchronisation.
+ shairport-sync has a number of modules of code ("backends") through which audio is output. Normally, the first audio backend that works is selected. This setting forces the selection of the specific audio backend. The default is "alsa". Perform the command shairport-sync -h to get a list of available audio backends. Only the alsa backend supports synchronisation.
port=portnumber;
- Use this to specify the portnumber Shairport Sync uses to listen for service requests from iTunes, etc. The default is port 5000.
+ Use this to specify the portnumber shairport-sync uses to listen for service requests from iTunes, etc. The default is port 5000.
-
udp_port_base=6001;
- When Shairport Sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting portnumber for these three ports. It will pick the first three unused ports starting from portnumber. The default is port 6001.
+
udp_port_base=portnumber;
+ When shairport-sync starts to play audio, it establises three UDP connections to the audio source. Use this setting to specify the starting portnumber for these three ports. It will pick the first three unused ports starting from portnumber. The default is port 6001.
-
udp_port_range=100;
- Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
+
udp_port_range=range;
+ Use this in conjunction with the prevous setting to specify the range of ports that can be checked for availability. Only three ports are needed. The default is 100, thus 100 ports will be checked from port 6001 upwards until three are found.
drift=frames;
@@ -159,7 +159,7 @@
resync_threshold=threshold;
- Resynchronise if timings differ by more than threshold frames.
+ Resynchronise if timings differ by more than threshold frames.
If the output timing differs from the source timing by more than
the threshold, output will be muted and a full resynchronisation
will occur. The default threshold is 2,205 frames, i.e. 50
@@ -197,22 +197,23 @@
"METADATA" SETTINGS
-
Shairport Sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level,
+
shairport-sync can process metadata provided by the source, such as Track Number, Album Name, cover art, etc. and can provide additional metadata such as volume level,
pause/resume, etc. It provides the metadata to a pipe, by default /tmp/shairport-sync-metadata.
- To process metadata, Shairport Sync must have been compiled with metadata support included.
- You can check tht this is so by running shairport-sync -V; the identification string will contain the word metadata.
+ To process metadata, shairport-sync must have been compiled with metadata support included.
+ You can check that this is so by running shairport-sync -V; the identification string will contain the word metadata.
The metadata group of settings allow you to enable metadata handling and to control certain aspects of it:
enabled="choice";
- Set the choice to "yes" to enable Shairport Sync to look for metadata from the audio source and to forward it,
- along with metadata generated by Shairport Sync itself, to the metadata pipe. The default is "no".
+ Set the choice to "yes" to enable shairport-sync to look for metadata from the audio source and to forward it,
+ along with metadata generated by shairport-sync itself, to the metadata pipe. The default is "no".
include_cover_art="choice";
- Set the choice to "yes" to enable Shairport Sync to look for cover art from the audio source and to forward it to the metadata pipe.
- A reason for not enabling cover art is that the images can sometimes be very large and mey delay transmission of subsequent metadata through the pipe.
+ Set the choice to "yes" to enable shairport-sync to look for cover art from the audio source and to include it in the feed to the metadata pipe.
+ You must also enable metadata (see above).
+ One reason for not including cover art is that the images can sometimes be very large and may delay transmission of subsequent metadata through the pipe.
The default is "no".
@@ -221,7 +222,7 @@
"SESSIONCONTROL" SETTINGS
-
Shairport Sync can run programs just before it starts to play an audio stream and just after it finishes.
+
shairport-sync can run programs just before it starts to play an audio stream and just after it finishes.
You specify them using the sessioncontrol group settings run_this_before_play_begins and run_this_after_play_ends.
@@ -237,7 +238,7 @@
wait_for_completion="choice";
- Set choice to "yes" to make Shairport Sync wait until the programs specified in the run_this_before_play_begins
+ Set choice to "yes" to make shairport-sync wait until the programs specified in the run_this_before_play_begins
and run_this_after_play_ends have completed execution before continuing. The default is "no".
@@ -253,7 +254,7 @@
"ALSA" SETTINGS
-
These settings are for the ALSA back end, used used to communicate with audio output devices in the ALSA system.
+
These settings are for the ALSA back end, used to communicate with audio output devices in the ALSA system.
(By the way, you can use tools such as alsamixer or aplay to discover what devices are available.)
Use these settings to select the output device and the mixer control to be used to control the output volume.
You can additionally set the desired size of the output buffer and you can adjust overall latency. Here are the alsa group settings:
@@ -267,7 +268,7 @@
mixer_control_name="name";
Specify the name of the mixer control to be used by shairport-sync to control the volume.
The mixer control must be on the mixer device, which by default is the output device.
- If you do not specify a mixer control name, shaiport-sync will control the volume in software.
+ If you do not specify a mixer control name, shairport-sync will adjust the volume in software.
mixer_type="mixer_type";
This setting is deprecated and will be removed soon. If you wish to use a mixer control to control the volume, then set mixer_type to "hardware".
@@ -275,7 +276,7 @@
mixer_device="mixer_device";
- By default, the mixer is assumed to be output_device is. Use this setting to specify a device other than the output device.
+ By default, the mixer is assumed to be output_device. Use this setting to specify a device other than the output device.
audio_backend_latency_offset=offset;
@@ -286,8 +287,9 @@
audio_backend_buffer_desired_length=length;
Use this to set the desired number frames to be in the output device's hardware output buffer.
The default is 6,615 frames, or 0.15 seconds. If set too small, buffer underflow may occur on low-powered machines.
- If too large, the response times when using a software mixer become annoying, or it may exceed the hardware buffer size.
- It may need to be larger on low-powered machines performing other tasks, such as processing metadata.
+ If too large, the response times when using software volume control (i.e. when not using a mixer control to control volume) become annoying,
+ or it may exceed the hardware buffer size.
+ It may need to be larger on low-powered machines that are also performing other tasks, such as processing metadata.
"PIPE" SETTINGS
@@ -301,7 +303,7 @@
name="/path/to/pipe";
- Use this to specify the name and location of the pipe. The pipe will be created and opened when Shairport Sync starts up and will be closed upon shutdown.
+ Use this to specify the name and location of the pipe. The pipe will be created and opened when shairport-sync starts up and will be closed upon shutdown.
Frames of audio will be sent to the pipe in packets of 352 frames and will be discarded if the pipe has not have a reader attached.
The sender will wait for up to five seconds for a packet to be written before discarding it.
@@ -320,8 +322,8 @@
Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to the pipe.
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the pipe reader's buffer, giving it a nominal buffer size of 44,100 frames.
- Note that if the pipe reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100.
+ Note that if the pipe reader consumes audio packets faster or slower than they are supplied, the buffer will eventually empty or overflow --
+ shairport-sync performs no stuffing or interpolation when writing to a pipe. Default setting is 44,100 frames.
@@ -347,8 +349,8 @@
Use this setting, in frames, to set the size of the output buffer. It works by determining how soon the second and subsequent packets of audio frames are sent to stdout.
For example, if you send the first packet of audio exactly when it is due and, using a audio_backend_buffer_desired_length setting of 44100,
send subsequent packets of audio a second before they are due to be played, they will be buffered in the stdout reader's buffer, giving it a nominal buffer size of 44,100 frames.
- Note that if the stdout reader consumes audio faster or slower than they are supplied, the buffer will empty or overflow eventually --
- Shairport Sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100.
+ Note that if the stdout reader consumes audio packets faster or slower than they are supplied, the buffer will eventually empty or overflow --
+ shairport-sync performs no stuffing or interpolation when writing to stdout. Default setting is 44,100 frames.
@@ -358,6 +360,10 @@
Options
+
Note: if you are setting up shairport-sync for the first time or are updating an existing installation,
+ you are encouraged to use the configuration file settings described above. Most of the options described below
+ simply replicate the configuration settings and are retained to provide backward compatability with older installations of shairport-sync.
+
Many of the options take sensible default values, so you can normally
ignore most of them. See the EXAMPLES section for typical usages.
@@ -688,11 +694,8 @@
-t devicetype
- The type of the output device is devicetype which must be
- hardware or software. The default is software.
- If you specify hardware you must also specify the output device using the
- -d option and the name of the volume control using the -c option.
- You may also need to specify the mixer using the -m option.
+ This option is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the -c option
+ -- if you specify a mixer name with the -c option, it is assumed that the mixer is implemented in hardware.
@@ -706,7 +709,6 @@
---d hw:1,0-m hw:1
- -t hardware-c PCM
@@ -715,8 +717,7 @@
Library-based stuffing ( -S soxr ).
The audio backend options following the -- separator specify
that the audio will be output on output 0 of soundcard 1 (
- -d hw:1,0 ) and will take advantage of the same sound card's hardware
- (-t hardware) mixer ( -m hw:1 )
+ -d hw:1,0 ) and will take advantage of the same sound card's mixer ( -m hw:1 )
using the level control named "PCM" ( -c "PCM" ).
The example above is slightly contrived in order to show the use of the -m option.
@@ -728,7 +729,6 @@
-S soxr---d hw:1
- -t hardware-c PCM
From 49c93576811f611ce45c66648866fda9ad674676 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 10:14:28 -0400
Subject: [PATCH 40/44] Update to ask users to run update-rc.d manually plus
miscellaneous small edits
---
README.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c1aba237..acdb41b0 100644
--- a/README.md
+++ b/README.md
@@ -109,7 +109,16 @@ Omit the `--with-soxr` if the libsoxr library is not available. For installation
`$ make`
-Run `$sudo make install` to install `shairport-sync` along with a default configuration file and a System V startup script, if chosen, to launch it automatically at system startup. The settings are the most basic defaults, so you will want to edit the configuration — the file is `/etc/shairport-sync.conf` — to give the service a name, use a specific sound card, use the hardware mixer and volume control, etc. — there are some examples in the sample configuration file.
+will build the application. Next, run:
+
+```
+`$sudo make install`
+`$sudo update-rc.d shairport-sync defaults 90 10`
+```
+
+to install `shairport-sync` along with a `man` page, a default configuration file and a System V startup script to launch it automatically at system startup.
+The settings are the most basic defaults, so you will want to edit the configuration — the file is `/etc/shairport-sync.conf` — to give the service a name,
+use a specific sound card and mixer control, etc. — there are some examples in the sample configuration file.
*Man Page*
From 312bcd03ba3cff7e7104d2c5d2089c6efcbe4ebe Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 10:15:12 -0400
Subject: [PATCH 41/44] Remove mixer_type or -t stuff, add messages about
deprecation
---
audio_alsa.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/audio_alsa.c b/audio_alsa.c
index b3335d7e..9b423f9e 100644
--- a/audio_alsa.c
+++ b/audio_alsa.c
@@ -85,7 +85,6 @@ static int64_t accumulated_delay, accumulated_da_delay;
static void help(void) {
printf(" -d output-device set the output device [default*|...]\n"
- " -t mixer-type set the mixer type [software*|hardware]\n"
" -m mixer-device set the mixer device ['output-device'*|...]\n"
" -c mixer-control set the mixer control [Master*|...]\n"
" -i mixer-index set the mixer index [0*|...]\n"
@@ -103,7 +102,7 @@ static int init(int argc, char **argv) {
- // get settings from settings file first, allow them to be over-ridden by command line options
+ // get settings from settings file first, allow them to be overridden by command line options
if (config.cfg != NULL) {
/* Get the desired buffer size setting. */
@@ -131,15 +130,13 @@ static int init(int argc, char **argv) {
alsa_out_dev = (char *)str;
}
+
/* Get the Mixer Type setting. */
+
if (config_lookup_string(config.cfg, "alsa.mixer_type", &str)) {
- if (strcasecmp(str, "software") == 0)
- hardware_mixer = 0;
- else if (strcasecmp(str, "hardware") == 0)
- hardware_mixer = 1;
- else
- die("Invalid alsa mixer option choice \"%s\". It should be \"software\" or \"hardware\"");
+ inform("The alsa mixer_type setting is deprecated and has been ignored. FYI, using the \"mixer_control_name\" setting automatically chooses a hardware mixer.");
}
+
/* Get the Mixer Device Name. */
if (config_lookup_string(config.cfg, "alsa.mixer_device", &str)) {
@@ -149,6 +146,7 @@ static int init(int argc, char **argv) {
/* Get the Mixer Control Name. */
if (config_lookup_string(config.cfg, "alsa.mixer_control_name", &str)) {
alsa_mix_ctrl = (char *)str;
+ hardware_mixer = 1;
}
}
@@ -162,15 +160,17 @@ static int init(int argc, char **argv) {
case 'd':
alsa_out_dev = optarg;
break;
+
case 't':
- if (strcmp(optarg, "hardware") == 0)
- hardware_mixer = 1;
+ inform("The alsa backend -t option is deprecated and has been ignored. FYI, using the -c option automatically chooses a hardware mixer.");
break;
+
case 'm':
alsa_mix_dev = optarg;
break;
case 'c':
alsa_mix_ctrl = optarg;
+ hardware_mixer = 1;
break;
case 'i':
alsa_mix_index = strtol(optarg, NULL, 10);
From 8f41c048b465c47010665edcedc14e0a1781cfad Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 14:49:16 -0400
Subject: [PATCH 42/44] Update README.md
---
README.md | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index acdb41b0..5e3cacd4 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ This branch — "development" — is unstable. To access the stable branch, plea
More Information
----------
-Shairport Sync works by using timing information and timestamps present in data coming from the audio source (e.g. an iPhone) to "play" audio at exactly the right time. It does this by monitoring and controlling the "latency" — the time between a sound frame is supposed to be played, as specified by its `timestamp`, and the time when it is actually played by the audio output device, usually a Digital to Audio Converter (DAC). Timestamps are measured relative to the source computer's clocks, the `source clock`, but timing must be done relative to the clock of the computer running Shairport Sync, the `local clock`. The source and local clocks are synchronised, usually to within a fraction of a millisecond, using a variant of NTP synchronisation protocols.
+Shairport Sync works by using timing information and timestamps present in data coming from the audio source (e.g. an iPhone) to "play" audio at exactly the right time. It does this by monitoring and controlling the *latency* — the time between a sound frame is supposed to be played, as specified by its `timestamp`, and the time when it is actually played by the audio output device, usually a Digital to Audio Converter (DAC). Timestamps are measured relative to the source computer's clocks, the `source clock`, but timing must be done relative to the clock of the computer running Shairport Sync, the `local clock`. The source and local clocks are synchronised, usually to within a fraction of a millisecond, using a variant of NTP synchronisation protocols.
To maintain the exact latency required, if an output device is running slow relative to the source, Shairport Sync will delete frames of audio to allow the device to keep up. If the output device is running fast, Shairport Sync will insert frames to keep time. The number of frames inserted or deleted is so small as to be almost inaudible on normal audio material. Frames are inserted or deleted as necessary at pseudorandom intervals. Alternatively, with `libsoxr` support, Shairport Sync can resample the audio feed to ensure the output device can keep up. This is less obtrusive than insertion and deletion but requires a good deal of processing power — most embedded devices probably can't support it. The process of insertion/deletion or resampling is rather inelegantly called “stuffing”.
@@ -107,13 +107,15 @@ Here is an example, suitable for installations such as Ubuntu and Raspbian:
Omit the `--with-soxr` if the libsoxr library is not available. For installation into a `systemd` system, replace the `--with-systemv` with `--with-systemd`.
+Enter:
+
`$ make`
-will build the application. Next, run:
+to build the application. Next, run:
```
-`$sudo make install`
-`$sudo update-rc.d shairport-sync defaults 90 10`
+$sudo make install
+$sudo update-rc.d shairport-sync defaults 90 10
```
to install `shairport-sync` along with a `man` page, a default configuration file and a System V startup script to launch it automatically at system startup.
@@ -150,16 +152,14 @@ general =
```
The `alsa` group is used to specify properties of the output device. The most obvious setting is the name of the output device which you can set using the `output_device` tag.
-The following `alsa` group settings are very important for maximum performance. If your audio device has a hardware mixer and volume control, then Shairport Sync can use them to give instant response to volume and mute commands and it can offload some work from the processor.
-* The `mixer_type` tag allows you to specify the type of audio mixer -- `software` (default) or `hardware`.
-* The `mixer_control_name` tag allows you to specify the name of the volume control on the hardware mixer.
-* The `mixer_device` tag allows you specify where the mixer is. By default, the mixer is to be found where you specify with the `output_device` tag, so you only need to use the `mixer_device` tag if the mixer is elsewhere. This can happen if you specify a *device* rather than a *card* with the `output_device` tag, because normally a mixer is associated with a *card* rather than a device. Suppose you wish to use the output device `5` of card `hw:0` and the mixer volume-control named `PCM`:
+The following `alsa` group settings are very important for maximum performance. If your audio device has a mixer that can be use to control the volume, then Shairport Sync can use it to give instant response to volume and mute commands and it can offload some work from the processor.
+* The `mixer_control_name` tag allows you to specify the name of the mixer volume control.
+* The `mixer_device` tag allows you specify where the mixer is. By default, the mixer is on the `output_device`, so you only need to use the `mixer_device` tag if the mixer is elsewhere. This can happen if you specify a *device* rather than a *card* with the `output_device` tag, because normally a mixer is associated with a *card* rather than a device. Suppose you wish to use the output device `5` of card `hw:0` and the mixer volume-control named `PCM`:
```
alsa =
{
output_device = "hw:0,5";
- mixer_type = "hardware";
mixer_device = "hw:0";
mixer_control_name = "PCM";
// ... other alsa settings
@@ -211,7 +211,6 @@ general = {
alsa = {
output_device = "hw:0";
- mixer_type = "hardware";
mixer_control_name = "PCM";
};
```
@@ -225,7 +224,6 @@ general = {
alsa = {
output_device = "hw:1";
- mixer_type = "hardware";
mixer_control_name = "PCM";
};
```
@@ -238,7 +236,6 @@ general = {
alsa = {
output_device = "hw:1";
- mixer_type = "hardware";
mixer_control_name = "Speaker";
};
```
@@ -251,7 +248,6 @@ general = {
alsa = {
output_device = "hw:1";
- mixer_type = "hardware";
mixer_control_name = "PCM";
};
```
@@ -265,7 +261,6 @@ general = {
};
alsa = {
- mixer_type = "hardware";
mixer_control_name = "PCM";
};
```
@@ -277,7 +272,6 @@ general = {
};
alsa = {
- mixer_type = "hardware";
mixer_control_name = "Speaker";
};
```
From 8488f974e9266c744038a38b2583349c82e9ec94 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 15:13:18 -0400
Subject: [PATCH 43/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index f1251ade..6857b77e 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,3 +1,20 @@
+Version 2.3.12
+----
+Annoying changes you probably need to do something about
+* The `alsa` group `mixer_type` setting is deprecated and you should stop using it. Its functionality has been subsumed into `mixer_name` – when you specify a `mixer_name` it automatically chooses the `hardware` mixer type.
+
+Changes
+* `update-rc.d` has been removed from the installation script for System V because it causes problems for package makers. It's now noted in the user installation instructions.
+
+Enhancements
+* Larger range of interpolation. Shairport Sync has previously constrained not to make interpolations ("corrections") of more than about 1 per 1000 real frames. This contraint has been relaxed, and it is now able to make corrections of up to 1 in 352 real frames. This might result in a faster and undesirably sudden correction early during a play session, so a number of further changes have been made. The full set of these changes is as follows:
+ * No corrections happen for the first five seconds.
+ * Corrections of up to about 1 in 1000 for the next 25 seconds.
+ * Corrections of up to 1 in 352 thereafter.
+
+Documentation Update
+* Nearly there with updates concerning the configuration file.
+
Version 2.3.11
----
Documentation Update
@@ -5,8 +22,8 @@ Documentation Update
Version 2.3.10
----
-* Bug fix
- * The "pipe" backend used output code that would block if the pipe didn't have a reader. This has been replaced by non-blocking code. Here are some implications:
+Bug fix
+* The "pipe" backend used output code that would block if the pipe didn't have a reader. This has been replaced by non-blocking code. Here are some implications:
* When the pipe is created, Shairport Sync will not block if a reader isn't present.
* If the pipe doesn't have a reader when Shairport Sync wants to output to it, the output will be discarded.
* If a reader disappears while writing is occuring, the write will time out after five seconds.
From 45b17a48dbe3963e3bc4d869d6b62325a04a5065 Mon Sep 17 00:00:00 2001
From: Mike Brady
Date: Thu, 20 Aug 2015 15:18:21 -0400
Subject: [PATCH 44/44] Update RELEASENOTES.md
---
RELEASENOTES.md | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 6857b77e..2065e991 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -1,18 +1,20 @@
Version 2.3.12
----
-Annoying changes you probably need to do something about
+**Note**
+* We're getting ready to release the development branch as the new, stable, master branch at 2.4. If you're packaging Shairport Sync, you might prefer to wait a short while as we add a little polish before the release.
+
+**Changes**
+* `update-rc.d` has been removed from the installation script for System V because it causes problems for package makers. It's now noted in the user installation instructions.
* The `alsa` group `mixer_type` setting is deprecated and you should stop using it. Its functionality has been subsumed into `mixer_name` – when you specify a `mixer_name` it automatically chooses the `hardware` mixer type.
-Changes
-* `update-rc.d` has been removed from the installation script for System V because it causes problems for package makers. It's now noted in the user installation instructions.
-Enhancements
+**Enhancements**
* Larger range of interpolation. Shairport Sync has previously constrained not to make interpolations ("corrections") of more than about 1 per 1000 real frames. This contraint has been relaxed, and it is now able to make corrections of up to 1 in 352 real frames. This might result in a faster and undesirably sudden correction early during a play session, so a number of further changes have been made. The full set of these changes is as follows:
* No corrections happen for the first five seconds.
* Corrections of up to about 1 in 1000 for the next 25 seconds.
* Corrections of up to 1 in 352 thereafter.
-Documentation Update
+**Documentation Update**
* Nearly there with updates concerning the configuration file.
Version 2.3.11