From 479a6fb0b69154063eb9fa9fe716367d642d9c2e Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 2 May 2016 17:40:28 +0100 Subject: [PATCH 01/39] Update UPDATING.md --- UPDATING.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index 1cf40049..d75d348f 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -15,11 +15,38 @@ $sudo apt-get upgrade ``` Next, stop playing music to your device. -Now, to update and install Shairport Sync, if you still have the directory in which you previously built Shairport Sync, navigate your way to it and execute the command: +Now, to update and install Shairport Sync, if you still have the directory in which you previously built Shairport Sync, it will contain the repository you originally downloaded. Navigate your way to it and check its status as follows: +``` +$git status +``` +You might get something like this +``` +On branch master +Your branch is up-to-date with 'origin/master'. +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git checkout -- ..." to discard changes in working directory) + + modified: INSTALL +``` + +If you get this, it means that the file `INSTALL` is different from what it was when you downloaded the repository the first time. In this case, it's not important, so discard the changes by checking out the repository's version using the following command: + +``` +$git checkout INSTALL +``` +Eventually, having checked out all the modified files, you should get something like this: +``` +On branch master +Your branch is up-to-date with 'origin/master'. +nothing to commit, working directory clean +``` +(What this measn is that the files used to compile Shairport Sync are the same as they were when originally downloaded. They are up to date with what was downloaded, not with repository at GitHub. Now pull the changes from GitHub: + ``` $git pull ``` -Otherwise, just pull Shairport Sync from `github` again and move into the new directory: +Otherwise – say if you deleted the repository – just pull Shairport Sync from GitHub again and move into the new directory: ``` $git clone https://github.com/mikebrady/shairport-sync.git $cd shairport-sync From 6d70a738741b366c9e1644cc74ddaaa78c524865 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Wed, 4 May 2016 09:40:43 +0100 Subject: [PATCH 02/39] Update UPDATING.md --- UPDATING.md | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index d75d348f..03069292 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -15,33 +15,7 @@ $sudo apt-get upgrade ``` Next, stop playing music to your device. -Now, to update and install Shairport Sync, if you still have the directory in which you previously built Shairport Sync, it will contain the repository you originally downloaded. Navigate your way to it and check its status as follows: -``` -$git status -``` -You might get something like this -``` -On branch master -Your branch is up-to-date with 'origin/master'. -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git checkout -- ..." to discard changes in working directory) - - modified: INSTALL -``` - -If you get this, it means that the file `INSTALL` is different from what it was when you downloaded the repository the first time. In this case, it's not important, so discard the changes by checking out the repository's version using the following command: - -``` -$git checkout INSTALL -``` -Eventually, having checked out all the modified files, you should get something like this: -``` -On branch master -Your branch is up-to-date with 'origin/master'. -nothing to commit, working directory clean -``` -(What this measn is that the files used to compile Shairport Sync are the same as they were when originally downloaded. They are up to date with what was downloaded, not with repository at GitHub. Now pull the changes from GitHub: +Now, to update and install Shairport Sync, if you still have the directory in which you previously built Shairport Sync, it will contain the repository you originally downloaded. Navigate your way to it and 'pull' the changes from GitHub: ``` $git pull From 995f6d03c38fcc1e0d43bac588b41b402e62bfb4 Mon Sep 17 00:00:00 2001 From: Soltan Tekeev Date: Sat, 28 May 2016 09:50:18 +0400 Subject: [PATCH 03/39] Add spaces after `$` --- UPDATING.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index 03069292..15ed3427 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -10,44 +10,44 @@ But before you begin, you should update and upgrade any packages. Here is the sequence for Raspbian Jessie, which is based on Debian Jessie. The same commands work for Ubuntu, and maybe more. Here, a non-`root` user with `sudo` privileges is assumed. ``` -$sudo apt-get update -$sudo apt-get upgrade +$ sudo apt-get update +$ sudo apt-get upgrade ``` Next, stop playing music to your device. Now, to update and install Shairport Sync, if you still have the directory in which you previously built Shairport Sync, it will contain the repository you originally downloaded. Navigate your way to it and 'pull' the changes from GitHub: ``` -$git pull +$ git pull ``` Otherwise – say if you deleted the repository – just pull Shairport Sync from GitHub again and move into the new directory: ``` -$git clone https://github.com/mikebrady/shairport-sync.git -$cd shairport-sync +$ git clone https://github.com/mikebrady/shairport-sync.git +$ cd shairport-sync ``` Now, while in the `shairport-sync` directory, perform the following commands (note that there is a choice you must make in there): ``` -$autoreconf -fi +$ autoreconf -fi #The following is the standard configuration for a Linux that uses the systemd initialisation system: -$./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd +$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd #OR #The following is the standard configuration for a Linux that uses the older System V initialisation system: -$./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemv +$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemv -$make -$sudo make install +$ make +$ sudo make install ``` At this point you have downloaded, compiled and installed the updated Shairport Sync. However, the older version is still running. So, you need to do a little more: If you are on a `systemd`-based system such as Raspbian Jessie or recent versions of Ubuntu and Debian, execute the following commands: ``` -$sudo systemctl daemon-reload -$sudo systemctl restart shairport-sync +$ sudo systemctl daemon-reload +$ sudo systemctl restart shairport-sync ``` Otherwise execute the following command: ``` -$sudo service shairport-sync restart +$ sudo service shairport-sync restart ``` That's it. Your Shairport Sync should be upgraded now. From 315e806890854130716fe2af5f59e1972070f346 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:31:11 +0100 Subject: [PATCH 04/39] Revert to master's README contents after pull from development branch --- README.md | 56 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 08d3edf1..f2066ae8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Audio played by a Shairport Sync-powered device stays synchronised with the sour Shairport Sync does not support AirPlay video or photo streaming. -This is the unstable "development" branch. Changes and updates are incorporated into this branch quickly. To access the stable version, where changes are made after due time, please switch to the "master" branch. +This is the stable "master" branch. Changes and updates are incorporated into this branch relatively slowly. To access the development version, where all the latest changes are made first, please switch to the "development" branch. More Information ---------- @@ -29,7 +29,7 @@ What else? * Hardware Mute — Shairport Sync will mute properly if the hardware supports it. * Fast Response — With hardware volume control, response is instantaneous; otherwise the response time is 0.15 seconds. * Non-Interruptible — Shairport Sync sends back a "busy" signal if it's already playing audio from another source, so other sources can't disrupt an existing Shairport Sync session. (If a source disappears without warning, the session automatically terminates after two minutes and the device becomes available again.) -* Metadata — Shairport Sync can deliver metadata supplied by the source, such as Album Name, Artist Name, Cover Art, etc. through a pipe or UDP socket to a recipient application program — see https://github.com/mikebrady/shairport-sync-metadata-reader for a sample recipient. Sources that supply metadata include iTunes and the Music app in iOS. +* Metadata — Shairport Sync can deliver metadata supplied by the source, such as Album Name, Artist Name, Cover Art, etc. through a pipe to a recipient application program — see https://github.com/mikebrady/shairport-sync-metadata-reader for a sample recipient. Sources that supply metadata include iTunes and the Music app in iOS. * Raw Audio — Shairport Sync can deliver raw PCM audio to standard output or to a pipe. This output is delivered synchronously with the source after the appropriate latency and is not interpolated or "stuffed" on its way through Shairport Sync. * Autotools and Libtool Support — the Shairport Sync build process uses GNU `autotools` and `libtool` to examine and configure the build environment — important for portability and for cross compilation. Previous versions of Shairport looked at the current system to determine which packages were available, instead of looking at the target system for what packages were available. @@ -49,11 +49,42 @@ For information about changes and updates, please refer to the RELEASENOTES.md f Note: Historically, Shairport Sync has taken its settings from command line arguments. While this is still the case, it does not always work well across distributions. Accordingly, from version 2.4 onwards, Shairport Sync reads settings from the file `/etc/shairport-sync.conf`. Access to new features will only be provided via the settings file. -Building And Installing the Development Version +Building And Installing --------------------- +If you wish to install Shairport Sync on OpenWrt, Arch or Fedora platforms, please follow the appropriate instructions below. Limited support is also available for Mac OS X. Otherwise follow the General Build Instructions. Then, when the program has been installed, refer to the section on Configuring Shairport Sync that follows. + +**Note** + The following procedures will install the shairport-sync application into your system. Before continuing, you should check to see if shairport-sync is already installed – you can use `which shairport-sync` to find where it is located, if installed. If it is installed you should delete it – you may need superuser privileges. After deleting, check again in case further copies are installed elsewhere. (If the existing installation of shairport-sync is where the new copy will be installed into, it will be overwritten; sometimes, however, the installation is to another location, so it is safer, initially, to delete previous versions manually.) +**Ubuntu:** +Personal Package Archives for Shairport Sync master and development branches are available at https://launchpad.net/~dantheperson. A `shairport-sync` installer package is available in Ubuntu 16.04, currently in its late beta phase. + +**Debian:** +`shairport-sync` is in the Debian archive and is scheduled for release with Debian Stretch (9): https://tracker.debian.org/shairport-sync. A backport for Debian Jessie (8) may be provided given enough demand. + +**OpenWrt:** +There is a Shairport Sync package in OpenWrt `trunk`. Also, there's an OpenWrt package at https://github.com/mikebrady/shairport-sync-for-openwrt, including one that builds back to `Barrier Breaker`. + +**Arch Linux:** +Shairport Sync is available for `x86_64` and `i686` platforms in the Arch Linux Community Repository -- search for `shairport-sync`. See also https://www.archlinux.org/packages/. + +An Arch Linux installation package, suitable for compilation on any platform, is available at [EliaCereda/shairport-sync-PKGBUILD](https://github.com/EliaCereda/shairport-sync-PKGBUILD). + +**Mac OS X:** +A [HomeBrew](http://brew.sh) package exists for Shairport Sync. With HomeBrew installed, Shairport Sync can be installed using the command `$brew install shairport-sync`. Note that the installation uses the `libao` library and so synchronisation is not available — playback glitches will occur occasionally, when the `ao` system's buffers overflow or underflow. + +**Fedora:** +Please see the guide at [FEDORA.md](https://github.com/mikebrady/shairport-sync/blob/master/FEDORA.md). + +**Cygwin:** +Please see the guide at [CYGWIN.md](https://github.com/mikebrady/shairport-sync/blob/master/CYGWIN.md). + +Sincere thanks to all package contributors! + +**General Build Instructions** + To build Shairport Sync from sources on Debian, Ubuntu, Raspbian, etc. follow these instructions. The following libraries are required: @@ -74,12 +105,12 @@ Many Linux distributions have Avahi and OpenSSL already in place, so normally it Debian, Ubuntu and Raspbian users can get the basics with: -- `apt-get install build-essential git xmltoman` – these may already be installed. +- `apt-get install build-essential git` – these may already be installed. - `apt-get install autoconf automake libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev` - `apt-get install avahi-daemon libavahi-client-dev` if you want to use Avahi (recommended). - `apt-get install libssl-dev` if you want to use OpenSSL and libcrypto, or use PolarSSL otherwise. - `apt-get install libpolarssl-dev` if you want to use PolarSSL, or use OpenSSL/libcrypto otherwise. -- `apt-get install libsoxr-dev` if you want support for libsoxr-based resampling. This library is in many recent distributions, including Jessie and Raspbian Jessie; if not, instructions for how to build it from source for Rasbpian/Debian Wheezy are available at [LIBSOXR.md](https://github.com/mikebrady/shairport-sync/blob/development/LIBSOXR.md). +- `apt-get install libsoxr-dev` if you want support for libsoxr-based resampling. This library is in many recent distributions, including Jessie and Raspioan Jessie; if not, instructions for how to build it from source for Raspian/Debian Wheezy are available at [LIBSOXR.md](https://github.com/mikebrady/shairport-sync/blob/master/LIBSOXR.md). Download Shairport Sync: @@ -88,7 +119,6 @@ Download Shairport Sync: Next, `cd` into the shairport-sync directory and execute the following command: ``` -$ git checkout development $ autoreconf -i -f ``` (Note that the `autoreconf...` step may take some time on less powerful machines.) @@ -180,7 +210,7 @@ $sudo update-rc.d shairport-sync defaults 90 10 **Man Page** -You can view the man page here: http://htmlpreview.github.io/?https://github.com/mikebrady/shairport-sync/blob/development/man/shairport-sync.html +You can view the man page here: http://htmlpreview.github.io/?https://github.com/mikebrady/shairport-sync/blob/master/man/shairport-sync.html Configuring Shairport Sync -------- @@ -238,7 +268,7 @@ Another setting to consider is the `general` `drift` setting: you should set it *Command Line Arguments* -As previously mentioned, you can use command line arguments to provide settings to Shairport Sync as before, though newer settings will only be available via the configuration file. For full information, please read the Shairport Sync `man` page, also available at http://htmlpreview.github.io/?https://github.com/mikebrady/shairport-sync/blob/development/man/shairport-sync.html. +As previously mentioned, you can use command line arguments to provide settings to Shairport Sync as before, though newer settings will only be available via the configuration file. For full information, please read the Shairport Sync `man` page, also available at http://htmlpreview.github.io/?https://github.com/mikebrady/shairport-sync/blob/master/man/shairport-sync.html. Apart from the following options, all command line options can be replaced by settings in the configuration file. Here is a brief description of command line options that are not replicated by settings in the settings file. @@ -342,14 +372,6 @@ alsa = { }; ``` -Metadata broadcasting over UDP ------------------------------- -As an alternative to sending metadata to a pipe, the `socket_address` and `socket_port` tags may be set in the metadata group to cause Shairport Sync to broadcast UDP packets containing the track metadata. - -The advantage of UDP is that packets can be sent to a single listener or, if a multicast address is used, to multiple listeners. It also allows metadata to be routed to a different host. However UDP has a maximum packet size of about 65000 bytes; while large enough for most data, Cover Art will often exceed this value. Any metadata exceeding this limit will not be sent over the socket interface. The maximum packet size may be set with the `socket_msglength` tag to any value between 500 and 65000 to control this - lower values may be used to ensure that each UDP packet is sent in a single network frame. The default is 500. Other than this restriction, metadata sent over the socket interface is identical to metadata sent over the pipe interface. - -The UDP metadata format is very simple - the first four bytes are the metadata *type*, and the next four bytes are the metadata *code* (both are sent in network byte order - see https://github.com/mikebrady/shairport-sync-metadata-reader for a definition of those terms). The remaining bytes of the packet, if any, make up the raw value of the metadata. - Latency ------- Latency is the exact time from a sound signal's original timestamp until that signal actually "appears" on the output of the audio output device, usually a Digital to Audio Converter (DAC), irrespective of any internal delays, processing times, etc. in the computer. @@ -389,5 +411,5 @@ It's not unusual to have resend requests, late packets and even missing packets Troubleshooting --------------- -Please refer to [TROUBLESHOOTING](https://github.com/mikebrady/shairport-sync/blob/development/TROUBLESHOOTING.md) for a few hints, contributed by users. +Please refer to [TROUBLESHOOTING](https://github.com/mikebrady/shairport-sync/blob/master/TROUBLESHOOTING.md) for a few hints, contributed by users. From bdcd9f10428abbcae0920002326c4414e59c8264 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:34:14 +0100 Subject: [PATCH 05/39] Bump version number to 2.8.4 --- shairport-sync.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shairport-sync.spec b/shairport-sync.spec index b1d30575..0cb202e0 100644 --- a/shairport-sync.spec +++ b/shairport-sync.spec @@ -1,5 +1,5 @@ Name: shairport-sync -Version: 2.8.3 +Version: 2.8.4 Release: 1 Summary: AirTunes emulator. Shairport Sync adds multi-room capability with Audio Synchronisation. @@ -56,6 +56,8 @@ getent passwd %{name} &> /dev/null || useradd --system -c "%{name} User" \ %doc AUTHORS LICENSES README.md %changelog +* Sat May 28 2016 Mike Brady 2.8.4 +- Bug fixes and a few small enhancements 2.8.4 * Fri Apr 15 2016 Mike Brady 2.8.2 - Stability improvements, bug fixes and a few special-purpose settings 2.8.2 * Wed Mar 02 2016 Mike Brady 2.8.1 From 7eb7dbf8275083a7ee86fccb07efbda0822641ac Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:34:58 +0100 Subject: [PATCH 06/39] Update RELEASENOTES.md --- RELEASENOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 8759c567..9f3848ef 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,4 +1,4 @@ -Version 2.8.4 – Stable Version (Candidate Release) +Version 2.8.4 – Stable Version ---- This release includes important bug fixes and minor enhancements and is recommended for all users. No settings need to be changed. For advice on updating an installation you built yourself, please visit the [UPDATING](https://github.com/mikebrady/shairport-sync/blob/master/UPDATING.md) page. From 4d03650c501fe0c1f80acaadb58829b0fe806ccb Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:40:20 +0100 Subject: [PATCH 07/39] Update shairport-sync.conf --- scripts/shairport-sync.conf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index ec0ce541..572893a6 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -4,12 +4,13 @@ // General Settings general = { -// name = "Shairport Sync on %H"; // This is the name the service will advertise to iTunes. -// The default is "" -- the first letter is capitalised (ASCII only.) -// You can use %h for the hostname, +// name = "%H"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes. +// The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.) +// You can use the following substitutions: +// %h for the hostname, // %H for the Hostname (i.e. with first letter capitalised (ASCII only)), // %v for the version number, e.g. 2.8.4 and -// %V for the full version string, e.g. 2.8.4-OpenSSL-Avahi-ALSA-soxr-metadata +// %V for the full version string, e.g. 2.8.4-OpenSSL-Avahi-ALSA-soxr-metadata. // Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H". // password = "secret"; // leave this commented out if you don't want to require a password // interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor. From 1ddcd6d355716ed3a0d255840f21ae857976c6ee Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:40:49 +0100 Subject: [PATCH 08/39] Update shairport-sync.conf --- scripts/shairport-sync.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index 572893a6..3d502127 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -7,7 +7,7 @@ general = // name = "%H"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes. // The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.) // You can use the following substitutions: -// %h for the hostname, +// %h for the hostname, // %H for the Hostname (i.e. with first letter capitalised (ASCII only)), // %v for the version number, e.g. 2.8.4 and // %V for the full version string, e.g. 2.8.4-OpenSSL-Avahi-ALSA-soxr-metadata. @@ -23,8 +23,8 @@ general = // 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 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. -// volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range. +// 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. +// volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range. // regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp". // playback_mode = "stereo"; // This can be "stereo" or "mono". Default is "stereo". }; From 42a8e25ed7a2225d0688c70c0798272d5de99a3f Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:41:01 +0100 Subject: [PATCH 09/39] Update shairport-sync.conf --- scripts/shairport-sync.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index 3d502127..7d639f51 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -26,7 +26,7 @@ general = // 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. // volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range. // regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp". -// playback_mode = "stereo"; // This can be "stereo" or "mono". Default is "stereo". +// playback_mode = "stereo"; // This can be "stereo" or "mono". Default is "stereo". }; // How to deal with metadata, including artwork From 8d821b7d85ba0465c14050cb9393785342c03229 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 28 May 2016 10:49:53 +0100 Subject: [PATCH 10/39] Update README.md --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f2066ae8..b5e8b007 100644 --- a/README.md +++ b/README.md @@ -51,15 +51,15 @@ Note: Historically, Shairport Sync has taken its settings from command line argu Building And Installing --------------------- -If you wish to install Shairport Sync on OpenWrt, Arch or Fedora platforms, please follow the appropriate instructions below. Limited support is also available for Mac OS X. Otherwise follow the General Build Instructions. Then, when the program has been installed, refer to the section on Configuring Shairport Sync that follows. +Shairport Sync may already be available as a package in your Linux distribution (search for `shairport-sync` – the package named `shairport` is a different program). Packages are available on recent versions of Debian, Ubuntu, Arch, OpenWrt and possibly more. If you wish to build and install the latest version of Shairport Sync on OpenWrt, Arch or Fedora platforms, please follow the appropriate instructions below. Limited support is also available for Mac OS X. Otherwise follow the General Build Instructions. Then, when the program has been installed, refer to the section on Configuring Shairport Sync that follows. **Note** -The following procedures will install the shairport-sync application into your system. Before continuing, you should check to see if shairport-sync is already installed – you can use `which shairport-sync` to find where it is located, if installed. If it is installed you should delete it – you may need superuser privileges. After deleting, check again in case further copies are installed elsewhere. -(If the existing installation of shairport-sync is where the new copy will be installed into, it will be overwritten; sometimes, however, the installation is to another location, so it is safer, initially, to delete previous versions manually.) +The following procedures will install the `shairport-sync` application into your system. Before continuing, you should check to see if `shairport-sync` is already installed – you can use `which shairport-sync` to find where it is located, if installed. If it is installed you should delete it – you may need superuser privileges. After deleting, check again in case further copies are installed elsewhere. +(If the existing installation of `shairport-sync` is where the new copy will be installed into, it will be overwritten; sometimes, however, the installation is to another location, so it is safer, initially, to delete previous versions manually.) **Ubuntu:** -Personal Package Archives for Shairport Sync master and development branches are available at https://launchpad.net/~dantheperson. A `shairport-sync` installer package is available in Ubuntu 16.04, currently in its late beta phase. +Personal Package Archives for Shairport Sync master and development branches are available at https://launchpad.net/~dantheperson. A `shairport-sync` installer package is available in Ubuntu 16.04. **Debian:** `shairport-sync` is in the Debian archive and is scheduled for release with Debian Stretch (9): https://tracker.debian.org/shairport-sync. A backport for Debian Jessie (8) may be provided given enough demand. @@ -114,7 +114,7 @@ Debian, Ubuntu and Raspbian users can get the basics with: Download Shairport Sync: -`git clone https://github.com/mikebrady/shairport-sync.git` +`$ git clone https://github.com/mikebrady/shairport-sync.git` Next, `cd` into the shairport-sync directory and execute the following command: @@ -142,7 +142,7 @@ Choose the appropriate `--with-*` options: At the time of writing, there are two widely-used systems for starting programs automatically at startup: `systemd` and "System V" . (There are others, but they are not considered here.) To see if the `systemd` process is running on your system, enter the following command: -`ps aux | grep systemd | grep -v grep` +`$ ps aux | grep systemd | grep -v grep` On a system using `systemd` (this is from a Raspberry Pi running Raspbian Jessie) you'll get many lines containing `systemd`, for example: ``` @@ -178,34 +178,34 @@ to build the application. To complete the installation, you need to define a `shairport-sync` group and user. This is a security measure – the user and group are relatively unprivileged, and the user does not have login priviliges. The user must be a member of the `audio` group to be able to access the audio hardware. The following commands define the group and user correctly if they do not already exist (note the use of `sudo` – omit this if you already have superuser privileges: ``` -$getent group shairport-sync &>/dev/null || sudo groupadd -r shairport-sync >/dev/null -$getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null +$ getent group shairport-sync &>/dev/null || sudo groupadd -r shairport-sync >/dev/null +$ getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null ``` Next, enter: ``` -$sudo make install +$ sudo make install ``` to install `shairport-sync` along with a `man` page, a default configuration file and a `systemd` configuration file called `shairport-sync.service` to launch it automatically at system startup. To enable Shairport Sync to start automatically at system startup, enter: -`$sudo systemctl enable shairport-sync` +`$ sudo systemctl enable shairport-sync` **Installation to a System V system** If you are installing onto a System V system: ``` -$sudo make install +$ sudo make install ``` 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. To complete the installation, enter: ``` -$sudo update-rc.d shairport-sync defaults 90 10 +$ sudo update-rc.d shairport-sync defaults 90 10 ``` **Man Page** From 80f1f528facfaf8db5bc27ff06234516b4af8efb Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 29 May 2016 12:08:53 +0100 Subject: [PATCH 11/39] Change sample values to numbers Change `socket_port` and `socket_msglength` sample values to numbers, not strings --- scripts/shairport-sync.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index 7d639f51..647abf16 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -37,8 +37,8 @@ metadata = // pipe_name = "/tmp/shairport-sync-metadata"; // pipe_timeout = 5000; // wait for this number of milliseconds for a blocked pipe to unblock before giving up // socket_address = "226.0.0.1"; // if set to a host name or IP address, UDP packets containing metadata will be sent to this address. May be a multicast address. "socket-port" must be non-zero and "enabled" must be set to yes" -// socket_port = "5555"; // if socket_address is set, the port to send UDP packets to -// socket_msglength = "65000"; // the maximum packet size for any UDP metadata. This will be clipped to be between 500 or 65000. The default is 500. +// socket_port = 5555; // if socket_address is set, the port to send UDP packets to +// socket_msglength = 65000; // the maximum packet size for any UDP metadata. This will be clipped to be between 500 or 65000. The default is 500. }; // Advanced parameters for controlling how a Shairport Sync runs From d6ff959658af05c524ee2e2ad3a7c1a3e8d3af8c Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 13 Jun 2016 10:11:53 +0100 Subject: [PATCH 12/39] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5e8b007..74aee0a6 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Shairport Sync may already be available as a package in your Linux distribution **Note** -The following procedures will install the `shairport-sync` application into your system. Before continuing, you should check to see if `shairport-sync` is already installed – you can use `which shairport-sync` to find where it is located, if installed. If it is installed you should delete it – you may need superuser privileges. After deleting, check again in case further copies are installed elsewhere. +The following procedures will install the `shairport-sync` application into your system. Before continuing, you should check to see if `shairport-sync` is already installed – you can use the command `$ which shairport-sync` to find where it is located, if installed. If it is installed you should delete it – you may need superuser privileges. After deleting, check again in case further copies are installed elsewhere. (If the existing installation of `shairport-sync` is where the new copy will be installed into, it will be overwritten; sometimes, however, the installation is to another location, so it is safer, initially, to delete previous versions manually.) **Ubuntu:** From e9fba02cf39b566442555743e7dc4cc2b6d7e283 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 26 Jun 2016 15:16:11 +0100 Subject: [PATCH 13/39] Create INSTALL.md --- INSTALL.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 INSTALL.md diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1 @@ + From 656bf81400342d2ede8fa7a8f2f1d532530ae9b4 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 26 Jun 2016 15:17:08 +0100 Subject: [PATCH 14/39] Update INSTALL.md --- INSTALL.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 8b137891..cf3978ca 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1 +1,4 @@ +Installation Instructions +== +Please refer to README.md for installation instructions. From f2c784c74d2f16329a27ca1263afd3f8c459793d Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Sat, 9 Jul 2016 18:38:36 +0200 Subject: [PATCH 15/39] Ensure scope_id is set correctly for ipv6 timing and control sockets --- rtp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rtp.c b/rtp.c index 0f8dae93..a8d330b9 100644 --- a/rtp.c +++ b/rtp.c @@ -666,9 +666,12 @@ void rtp_setup(SOCKADDR *local, SOCKADDR *remote, int cport, int tport, uint32_t die("Can't get address of client's control port"); #ifdef AF_INET6 - if (servinfo->ai_family == AF_INET6) + if (servinfo->ai_family == AF_INET6) { memcpy(&rtp_client_control_socket, servinfo->ai_addr, sizeof(struct sockaddr_in6)); - else + // ensure the scope id matches that of remote. this is needed for link-local addresses. + struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)&rtp_client_control_socket; + sa6->sin6_scope_id = self_scope_id; + } else #endif memcpy(&rtp_client_control_socket, servinfo->ai_addr, sizeof(struct sockaddr_in)); freeaddrinfo(servinfo); @@ -682,9 +685,12 @@ void rtp_setup(SOCKADDR *local, SOCKADDR *remote, int cport, int tport, uint32_t if (getaddrinfo(client_ip_string, portstr, &hints, &servinfo) != 0) die("Can't get address of client's timing port"); #ifdef AF_INET6 - if (servinfo->ai_family == AF_INET6) + if (servinfo->ai_family == AF_INET6) { memcpy(&rtp_client_timing_socket, servinfo->ai_addr, sizeof(struct sockaddr_in6)); - else + // ensure the scope id matches that of remote. this is needed for link-local addresses. + struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)&rtp_client_timing_socket; + sa6->sin6_scope_id = self_scope_id; + } else #endif memcpy(&rtp_client_timing_socket, servinfo->ai_addr, sizeof(struct sockaddr_in)); freeaddrinfo(servinfo); From 1f71ec81026217a31f38b0c4d4e079dcd76b3da7 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 16:03:50 +0100 Subject: [PATCH 16/39] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 848b7ebc..14d6dc38 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Audio played by a Shairport Sync-powered device stays synchronised with the sour Shairport Sync does not support AirPlay video or photo streaming. This is the stable "master" branch. Changes and updates are incorporated into this branch relatively slowly. To access the development version, where all the latest changes are made first, please switch to the "development" branch. + **Please note that, between 2.8.4 and 2.8.5, there is a change in the standard ./configure arguments which you should not ignore!** @@ -170,7 +171,7 @@ A final consideration is the location of the configuration file `shairport-sync. **Sample `./configure` command with parameters for a typical Linux `systemd` installation:** -Here is an example, suitable for Linux installations that use `systemd`, such as Ubuntu 15.10 and Raspbian Jessie: +Here is an example, suitable for Linux installations that use `systemd`, such as Ubuntu 16.04 and Raspbian Jessie: `$ ./configure --sysconfdir=/etc --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd` From 02d9c9e2125678504605dd53f59ca24f691eb6a6 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 16:05:32 +0100 Subject: [PATCH 17/39] Update shairport-sync.spec --- shairport-sync.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shairport-sync.spec b/shairport-sync.spec index 0cb202e0..721a0a49 100644 --- a/shairport-sync.spec +++ b/shairport-sync.spec @@ -1,5 +1,5 @@ Name: shairport-sync -Version: 2.8.4 +Version: 2.8.5 Release: 1 Summary: AirTunes emulator. Shairport Sync adds multi-room capability with Audio Synchronisation. @@ -56,6 +56,8 @@ getent passwd %{name} &> /dev/null || useradd --system -c "%{name} User" \ %doc AUTHORS LICENSES README.md %changelog +* Sun Sep 25 2016 Mike Brady 2.8.5 +- Bug fixes and small enhancements 2.8.5 * Sat May 28 2016 Mike Brady 2.8.4 - Bug fixes and a few small enhancements 2.8.4 * Fri Apr 15 2016 Mike Brady 2.8.2 From 6e55a18aa3eef6a6f759df4a7d871efc65426c93 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 17:27:55 +0100 Subject: [PATCH 18/39] Update man pages a little --- man/shairport-sync.7 | 33 ++++++++++++++++------------- man/shairport-sync.7.xml | 45 +++++++++++++++++++++++++--------------- man/shairport-sync.html | 43 ++++++++++++++++++++++++-------------- 3 files changed, 74 insertions(+), 47 deletions(-) diff --git a/man/shairport-sync.7 b/man/shairport-sync.7 index ccbc9929..86ad20c5 100644 --- a/man/shairport-sync.7 +++ b/man/shairport-sync.7 @@ -23,7 +23,9 @@ shairport-sync can be compiled to stream audio, without synchronisation, to a pi 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. +You should use the configuration file for setting up shairport-sync. This file is usually \fIshairport-sync.conf\f1 and is generally located in the System Configuration Directory, which is normally the \fI/etc\f1 directory in Linux or the \fI/usr/local/etc\f1 directory in BSD unixes. You may need to have root privileges to modify it. + +(Note: Shairport Sync may have been compiled to use a different configuration directory. You can determine which by performing the command \fI$ shairport-sync -V\f1. One of the items in the output string is the value of the \fBsysconfdir\f1, i.e. the System Configuration Directory.) 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: @@ -49,7 +51,7 @@ Settings are organised into groups, for example, there is a "general" group of s 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 specified. 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. +A sample configuration file with all possible settings, but with all of them commented out, is installed at \fIshairport-sync.conf.sample\f1, within the System Configuration Directory -- \fI/etc\f1 in Linux, \fI/usr/local/etc\f1 in BSD unixes. To retain backwards compatibility 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,13 +95,13 @@ Use this in conjunction with the prevous setting to specify the \fIrange\f1 of p 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 \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. +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 \fI0\f1 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". +Use this to specify how much debugging information should be output or logged. The value \fI0\f1 means no debug information, \fI3\f1 means most debug information. The default is \fI0\f1. .TP \fBignore_volume_control=\f1\fI"choice"\f1\fB;\f1 -Set this \fIchoice\f1 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". +Set this \fIchoice\f1 to \fI"yes"\f1 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 \fI"no"\f1. .TP \fBvolume_range_db=\f1\fIdBvalue\f1\fB;\f1 Use this \fIdBvalue\f1 to reduce or increase the attenuation range, in decibels, between the minimum and maximum volume. @@ -110,36 +112,36 @@ Another potential use might be where the range specified by the mixer does not m As a third example, you can actually extend the range provided by a mixer. Many cheaper DACs have hardware mixers that offer a restricted attenuation range. If you specify a volume range greater than the range of the mixer, software attenuation and hardware attenuation will be combined to give the specified range. -If you omit this setting, the full "native" range of the mixer is used. +If you omit this setting, the native range of the mixer is used. .TP \fBregtype=\f1\fI"regTypeString"\f1\fB;\f1 -Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp". +Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is \fI"_raop._tcp"\f1. .TP \fBplayback_mode=\f1\fI"mode"\f1\fB;\f1 -The \fImode\f1 can be "stereo" or "mono". Default is "stereo". +The \fImode\f1 can be \fI"stereo"\f1 or \fI"mono"\f1. Default is \fI"stereo"\f1. .TP \fB"ALSA" SETTINGS\f1 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". +Use the output device called \fIoutput_device\f1. The default is the device called \fI"default"\f1. .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, shairport-sync will adjust the volume in software. \fBmixer_type=\f1\fI"mixer_type"\f1\fB;\f1 -This setting is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the mixer_control_name setting -- if you specify a mixer name with the mixer_control_name setting, it is assumed that the mixer is implemented in hardware. +This setting is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the \fBmixer_control_name\f1 setting -- if you specify a mixer name with the \fBmixer_control_name\f1 setting, it is assumed that the mixer is implemented in hardware. .TP \fBmixer_device=\f1\fI"mixer_device"\f1\fB;\f1 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. +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 \fI-4410\f1. Default is \fI0\f1. .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 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. +Use this to set the desired number frames to be in the output device's hardware output buffer. The default is \fI6,615\f1 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 \fBdisable_synchronization=\f1\fI"no"\f1\fB;\f1 -This is an advanced setting and is for debugging only. Set to "yes" to disable synchronization. Default is "no". If you use it to disable synchronisation, then sooner or later you'll experience audio glitches due to audio buffer overflow or underflow. +This is an advanced setting and is for debugging only. Set to \fI"yes"\f1 to disable synchronization. Default is \fI"no"\f1. If you use it to disable synchronisation, then sooner or later you'll experience audio glitches due to audio buffer overflow or underflow. .TP \fBperiod_size=\f1\fInumber\f1\fB;\f1 Use this optional advanced setting to set the alsa period size near to this value. @@ -147,6 +149,9 @@ Use this optional advanced setting to set the alsa period size near to this valu \fBbuffer_size=\f1\fInumber\f1\fB;\f1 Use this optional advanced setting to set the alsa buffer size near to this value. .TP +\fBuse_mmap_if_available=\f1\fI"yes"\f1\fB;\f1 +Use this optional advanced setting to control whether MMAP-based output is used to communicate with the DAC. Default is \fI"yes"\f1. +.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, interleaved stereo. @@ -283,7 +288,7 @@ 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. +Read configuration settings from \fIfilename\f1. The default is to read them from the \fIshairport-sync.conf\f1 in the System Configuration Directory -- \fI/etc\f1 in Linux, \fI/usr/local/etc\f1 in BSD unixes. 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). diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml index c4ff2d86..96885703 100644 --- a/man/shairport-sync.7.xml +++ b/man/shairport-sync.7.xml @@ -82,9 +82,13 @@

You should use the configuration file for setting up shairport-sync. - This file is normally /etc/shairport-sync.conf. + This file is usually shairport-sync.conf and is generally located in the System Configuration Directory, which is normally the /etc directory in Linux or the /usr/local/etc directory in BSD unixes. You may need to have root privileges to modify it.

+

(Note: Shairport Sync may have been compiled to use a different configuration directory. You can determine which by performing the command $ shairport-sync -V. One of the items in the output string is the value of the sysconfdir, + i.e. the System Configuration Directory.)

+ +

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:

@@ -103,7 +107,7 @@

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 specified. 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.

+

A sample configuration file with all possible settings, but with all of them commented out, is installed at shairport-sync.conf.sample, within the System Configuration Directory -- /etc in Linux, /usr/local/etc in BSD unixes.

To retain backwards compatibility with previous versions of shairport-sync you can use still use command line options, but any new features, etc. will @@ -169,7 +173,8 @@

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. + 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. @@ -235,7 +241,7 @@

mixer_type="mixer_type";

- This setting is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the mixer_control_name setting - -- if you specify a mixer name with the mixer_control_name setting, it is assumed that the mixer is implemented in hardware. + This setting is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the mixer_control_name setting + -- if you specify a mixer name with the mixer_control_name setting, it is assumed that the mixer is implemented in hardware. - + +

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, interleaved stereo.

@@ -540,7 +550,8 @@ diff --git a/man/shairport-sync.html b/man/shairport-sync.html index 41dfd64a..4b016748 100644 --- a/man/shairport-sync.html +++ b/man/shairport-sync.html @@ -63,9 +63,13 @@

Configuration File Settings

You should use the configuration file for setting up shairport-sync. - This file is normally /etc/shairport-sync.conf. + This file is usually shairport-sync.conf and is generally located in the System Configuration Directory, which is normally the /etc directory in Linux or the /usr/local/etc directory in BSD unixes. You may need to have root privileges to modify it.

+

(Note: Shairport Sync may have been compiled to use a different configuration directory. You can determine which by performing the command $ shairport-sync -V. One of the items in the output string is the value of the sysconfdir, + i.e. the System Configuration Directory.)

+ +

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:

@@ -84,7 +88,7 @@

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 specified. 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.

+

A sample configuration file with all possible settings, but with all of them commented out, is installed at shairport-sync.conf.sample, within the System Configuration Directory -- /etc in Linux, /usr/local/etc in BSD unixes.

To retain backwards compatibility with previous versions of shairport-sync you can use still use command line options, but any new features, etc. will @@ -150,7 +154,8 @@

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. + 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;

@@ -166,15 +171,16 @@ 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. + milliseconds. Specify 0 to disable resynchronisation.

log_verbosity=0;

- 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". + Use this to specify how much debugging information should be output or logged. The value 0 means no debug information, 3 means most debug information. The default is 0.

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". + 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". @@ -193,17 +199,17 @@ Many cheaper DACs have hardware mixers that offer a restricted attenuation range. If you specify a volume range greater than the range of the mixer, software attenuation and hardware attenuation will be combined to give the specified range.

-

If you omit this setting, the full "native" range of the mixer is used.

+

If you omit this setting, the native range of the mixer is used.

regtype="regTypeString";

- Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp". + Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp".

playback_mode="mode";

- The mode can be "stereo" or "mono". Default is "stereo". + The mode can be "stereo" or "mono". Default is "stereo". @@ -216,7 +222,7 @@

output_device="output_device";

- Use the output device called output_device. The default is the device called "default". + Use the output device called output_device. The default is the device called "default". @@ -226,8 +232,8 @@ 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 is ignored. For your information, its functionality has been automatically incorporated in the mixer_control_name setting - -- if you specify a mixer name with the mixer_control_name setting, it is assumed that the mixer is implemented in hardware. + This setting is deprecated and is ignored. For your information, its functionality has been automatically incorporated in the mixer_control_name setting + -- if you specify a mixer name with the mixer_control_name setting, it is assumed that the mixer is implemented in hardware.

mixer_device="mixer_device";

@@ -236,12 +242,12 @@

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. + For example, if the output device delays by 100 ms, set this to -4410. Default is 0.

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. + 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. @@ -249,7 +255,7 @@

disable_synchronization="no";

- This is an advanced setting and is for debugging only. Set to "yes" to disable synchronization. Default is "no". + This is an advanced setting and is for debugging only. Set to "yes" to disable synchronization. Default is "no". If you use it to disable synchronisation, then sooner or later you'll experience audio glitches due to audio buffer overflow or underflow. @@ -263,6 +269,10 @@ Use this optional advanced setting to set the alsa buffer size near to this value. +

use_mmap_if_available="yes";

+ Use this optional advanced setting to control whether MMAP-based output is used to communicate with the DAC. Default is "yes". + +

"PIPE" SETTINGS

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, interleaved stereo.

@@ -525,7 +535,8 @@

-c filename | --configfile=filename

- Read configuration settings from filename. The default is to read them from /etc/shairport-sync.conf. For information about configuration settings, see the "Configuration File Settings" section above. + Read configuration settings from filename. The default is to read them from the shairport-sync.conf in the System Configuration Directory -- /etc in Linux, /usr/local/etc in BSD unixes. + For information about configuration settings, see the "Configuration File Settings" section above.

From df764ca88fad7c95bde65e9d98c7b7cf22afb888 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 17:32:18 +0100 Subject: [PATCH 19/39] Update a few references to the version number. --- scripts/shairport-sync.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index 96a2301d..9bdbc790 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -9,8 +9,8 @@ general = // You can use the following substitutions: // %h for the hostname, // %H for the Hostname (i.e. with first letter capitalised (ASCII only)), -// %v for the version number, e.g. 2.8.4 and -// %V for the full version string, e.g. 2.8.4-OpenSSL-Avahi-ALSA-soxr-metadata. +// %v for the version number, e.g. 2.8.5 and +// %V for the full version string, e.g. 2.8.5-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc // Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H". // password = "secret"; // leave this commented out if you don't want to require a password // interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor. From 21dab9f91c947faf344de09a94d645aed664fe75 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 17:33:18 +0100 Subject: [PATCH 20/39] Version 2.8.5 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f91c9a11..f95c014b 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.8.4], [mikebrady@eircom.net]) +AC_INIT([shairport-sync], [2.8.5], [mikebrady@eircom.net]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([shairport.c]) AC_CONFIG_HEADERS([config.h]) @@ -202,8 +202,8 @@ AC_ARG_WITH(pulseaudio, [ --with-pulseaudio = choose PulseAudio API support. N. AC_MSG_RESULT(>>Including a PulseAudio back end. N.B. no synchronisation -- so underflow or overflow is inevitable!) HAS_PULSE=1 AC_DEFINE([CONFIG_PULSE], 1, [Needed by the compiler.]) - AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library, possibly in the package libpulse-dev!)) - AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library!))], ) + AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library -- possibly in the libpulse-dev package!)) + AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library.))], ) AM_CONDITIONAL([USE_PULSE], [test "x$HAS_PULSE" = "x1"]) # Look for dns_sd flag From 481f17003b373737b606ac518f9d645d61f2d1a3 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 17:42:38 +0100 Subject: [PATCH 21/39] Update RELEASENOTES.md --- RELEASENOTES.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 1c2a0e1e..3ca38151 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -2,21 +2,17 @@ Version 2.8.5 – Stable Version ---- This release includes bug fixes and minor enhancements and is recommended for all users. -There is once change you should not ignore: +Note: if you're upgrading, there is a new `./configure` option: ==== - -* The build process now uses the directory path `sysconfdir` to determine where to place the configuration file `shairport-sync.conf`. +The build process now uses the directory path `sysconfdir` to determine where to place the configuration file `shairport-sync.conf`. The default value for `sysconfdir` is `/usr/local/etc` which is used in the BSD family, whereas `/etc` is normally used in Linux. -So, to retain the present behaviour of Shairport Sync, *you must add an extra parameter to the `./configure... ` command.* The parameter you must add is `--sysconfdir=/etc`. (This has been added to the sample configuration command line in README.md.) -* Shairport Sync has been updated to use the value of `sysconfdir` to determine where to look for the configuration file. -If `sysconfdir` has been left with its default value of `/usr/local/etc`, then Shairport Sync will look for `/usr/local/etc/shairport-sync.conf`. -If, as recommended for Linux, `sysconfdir` has been set to `/etc`, then Shairport Sync will look, as before, for `/etc/shairport-sync.conf`. +To retain the present behaviour of Shairport Sync, *you must add an extra parameter to the `./configure... ` command.* The parameter you must add is `--sysconfdir=/etc`. (This has been added to the sample configuration command line in README.md.) + +The enhancements and bug fixes in 2.8.5 were made in versions 2.8.4.1 to 2.8.4.8 inclusive. Please read below for the full list. For advice on updating an installation you built yourself, please visit the [UPDATING](https://github.com/mikebrady/shairport-sync/blob/master/UPDATING.md) page. -The enhancements and bug fixes were made in versions 2.8.4.1 to 2.8.4.8 inclusive. Please read below for the full list. - ======= Version 2.8.4.8 – Development Version ---- From f012acb866fef3895f6313f46b0de71b36de1f95 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 17:44:29 +0100 Subject: [PATCH 22/39] 2.8.5 --- RELEASENOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3ca38151..cdc133ce 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -2,7 +2,7 @@ Version 2.8.5 – Stable Version ---- This release includes bug fixes and minor enhancements and is recommended for all users. -Note: if you're upgrading, there is a new `./configure` option: +Note: if you're upgrading, there is a new `./configure` option: ==== The build process now uses the directory path `sysconfdir` to determine where to place the configuration file `shairport-sync.conf`. The default value for `sysconfdir` is `/usr/local/etc` which is used in the BSD family, whereas `/etc` is normally used in Linux. From 6c55d89abf243582ff77f833f522dfa217f9988d Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 25 Sep 2016 17:52:32 +0100 Subject: [PATCH 23/39] 2.8.5 Add info about `sysconfdir` --- UPDATING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index 15ed3427..c7aee127 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -30,10 +30,10 @@ Now, while in the `shairport-sync` directory, perform the following commands (no $ autoreconf -fi #The following is the standard configuration for a Linux that uses the systemd initialisation system: -$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd +$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd --sysconfdir=/etc #OR #The following is the standard configuration for a Linux that uses the older System V initialisation system: -$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemv +$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemv --sysconfdir=/etc $ make $ sudo make install From 3bf900fdcd4732529f3f900b39f3cec451491888 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 10 Oct 2016 18:58:43 +0100 Subject: [PATCH 24/39] Change the 'am' identifier to 'ShairportSync' to help with Tuneblade's free usage --- mdns.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mdns.h b/mdns.h index 4c1cf247..f3d621b2 100644 --- a/mdns.h +++ b/mdns.h @@ -24,7 +24,7 @@ typedef struct { // "sr=44100", "vn=3", "txtvers=1", config.password ? "pw=true" : "pw=false" #define MDNS_RECORD_WITH_METADATA \ - "sf=0x4", "fv=76400.10", "am=AirPort4,107", "vs=105.1", "tp=TCP,UDP", "vn=65537", \ + "sf=0x4", "fv=76400.10", "am=ShairportSync", "vs=105.1", "tp=TCP,UDP", "vn=65537", \ METADATA_EXPRESSION, "ss=16", "sr=44100", "da=true", "sv=false", "et=0,1", "ek=1", "cn=0,1", "ch=2", "txtvers=1", config.password ? "pw=true" : "pw=false" #endif @@ -34,7 +34,7 @@ typedef struct { // "txtvers=1", config.password ? "pw=true" : "pw=false" #define MDNS_RECORD_WITHOUT_METADATA \ - "sf=0x4", "fv=76400.10", "am=AirPort4,107", "vs=105.1", "tp=TCP,UDP", "vn=65537", \ + "sf=0x4", "fv=76400.10", "am=ShairportSync", "vs=105.1", "tp=TCP,UDP", "vn=65537", \ "ss=16", "sr=44100", "da=true", "sv=false", "et=0,1", "ek=1", "cn=0,1", "ch=2", "txtvers=1", config.password ? "pw=true" : "pw=false" #endif // _MDNS_H From 2b63e723d4a459eef061cbecd146bdd4759a2af7 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 10 Oct 2016 18:59:26 +0100 Subject: [PATCH 25/39] Change the 'am' identifier to 'ShairportSync' to help with Tuneblade's free usage --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f95c014b..8d82da4a 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.8.5], [mikebrady@eircom.net]) +AC_INIT([shairport-sync], [2.8.6], [mikebrady@eircom.net]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([shairport.c]) AC_CONFIG_HEADERS([config.h]) From 8fc9df88640788ba52ea6a35618cc1ebb03591ba Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 10 Oct 2016 19:05:05 +0100 Subject: [PATCH 26/39] 2.8.6 --- RELEASENOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index cdc133ce..711b9644 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,3 +1,7 @@ +Version 2.8.6 – Stable Candidate +**Enhancements** +* This release contains a small change – it identifies itself as a ShairportSync device rather than an AirPort device. This should make it possible for Tuneblade, and possibly other players, to recognise it correctly. + Version 2.8.5 – Stable Version ---- This release includes bug fixes and minor enhancements and is recommended for all users. From 59c16806e4ecc2074ebfb72c921e3314a61a9d0f Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 10 Oct 2016 19:05:31 +0100 Subject: [PATCH 27/39] Update RELEASENOTES.md --- RELEASENOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 711b9644..7591d956 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,4 +1,6 @@ Version 2.8.6 – Stable Candidate +---- + **Enhancements** * This release contains a small change – it identifies itself as a ShairportSync device rather than an AirPort device. This should make it possible for Tuneblade, and possibly other players, to recognise it correctly. From 452613987a102fb9bcd42f48985ebd2a25480e3c Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Mon, 10 Oct 2016 19:06:57 +0100 Subject: [PATCH 28/39] 2.8.6 --- RELEASENOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 7591d956..5e14d9ed 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -2,7 +2,7 @@ Version 2.8.6 – Stable Candidate ---- **Enhancements** -* This release contains a small change – it identifies itself as a ShairportSync device rather than an AirPort device. This should make it possible for Tuneblade, and possibly other players, to recognise it correctly. +* This release contains a small change – it identifies itself as a ShairportSync device rather than an AirPort device. This should make it possible for Tuneblade, and possibly other players, to recognise it correctly. Version 2.8.5 – Stable Version ---- From f456e619422d989c28c9672e47477d893beb468a Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 21 Oct 2016 11:38:12 +0100 Subject: [PATCH 29/39] 2.8.6 --- shairport-sync.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shairport-sync.spec b/shairport-sync.spec index 721a0a49..ddce7f69 100644 --- a/shairport-sync.spec +++ b/shairport-sync.spec @@ -1,5 +1,5 @@ Name: shairport-sync -Version: 2.8.5 +Version: 2.8.6 Release: 1 Summary: AirTunes emulator. Shairport Sync adds multi-room capability with Audio Synchronisation. @@ -56,6 +56,8 @@ getent passwd %{name} &> /dev/null || useradd --system -c "%{name} User" \ %doc AUTHORS LICENSES README.md %changelog +* Fri Oct 21 2016 Mike Brady 2.8.6 +- Advertise self as ShairportSync rather than AirPort device 2.8.6 * Sun Sep 25 2016 Mike Brady 2.8.5 - Bug fixes and small enhancements 2.8.5 * Sat May 28 2016 Mike Brady 2.8.4 From d6f1b3574816f7e68b3489de8a7bfb3a950bfa93 Mon Sep 17 00:00:00 2001 From: Jief Date: Tue, 1 Nov 2016 13:52:38 +0100 Subject: [PATCH 30/39] constant 0x100000000 should be 0x100000000LL to avoid warning --- rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtp.c b/rtp.c index a8d330b9..8c34bb9e 100644 --- a/rtp.c +++ b/rtp.c @@ -501,7 +501,7 @@ void *rtp_timing_receiver(void *arg) { if (reference_timestamp>=play_segment_reference_frame) frame_difference = (uint64_t)reference_timestamp-(uint64_t)play_segment_reference_frame; else // rollover - frame_difference = (uint64_t)reference_timestamp+0x100000000-(uint64_t)play_segment_reference_frame; + frame_difference = (uint64_t)reference_timestamp+0x100000000LL-(uint64_t)play_segment_reference_frame; uint64_t frame_time_difference_calculated = (((uint64_t)frame_difference<<32)/44100); uint64_t frame_time_difference_actual = remote_reference_timestamp_time-play_segment_reference_frame_remote_time; // this is all done by reference to the sources' system clock // debug(1,"%llu frames since play started, %llu usec calculated, %llu usec actual",frame_difference, (frame_time_difference_calculated*1000000)>>32, (frame_time_difference_actual*1000000)>>32); From cf56dc37075b37297e7e278a36307e2117bddc11 Mon Sep 17 00:00:00 2001 From: Jief Date: Wed, 2 Nov 2016 14:58:02 +0100 Subject: [PATCH 31/39] Using Macro instead of LL to make it portable. --- rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtp.c b/rtp.c index 8c34bb9e..576e7ba0 100644 --- a/rtp.c +++ b/rtp.c @@ -501,7 +501,7 @@ void *rtp_timing_receiver(void *arg) { if (reference_timestamp>=play_segment_reference_frame) frame_difference = (uint64_t)reference_timestamp-(uint64_t)play_segment_reference_frame; else // rollover - frame_difference = (uint64_t)reference_timestamp+0x100000000LL-(uint64_t)play_segment_reference_frame; + frame_difference = (uint64_t)reference_timestamp+UINT64_C(0x100000000)-(uint64_t)play_segment_reference_frame; uint64_t frame_time_difference_calculated = (((uint64_t)frame_difference<<32)/44100); uint64_t frame_time_difference_actual = remote_reference_timestamp_time-play_segment_reference_frame_remote_time; // this is all done by reference to the sources' system clock // debug(1,"%llu frames since play started, %llu usec calculated, %llu usec actual",frame_difference, (frame_time_difference_calculated*1000000)>>32, (frame_time_difference_actual*1000000)>>32); From 897eec4a7f89adcb4ced70f7e103ce400132abfb Mon Sep 17 00:00:00 2001 From: Jief Date: Wed, 2 Nov 2016 15:01:12 +0100 Subject: [PATCH 32/39] Using macro instead of LL to make it portable --- rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtp.c b/rtp.c index 8c34bb9e..576e7ba0 100644 --- a/rtp.c +++ b/rtp.c @@ -501,7 +501,7 @@ void *rtp_timing_receiver(void *arg) { if (reference_timestamp>=play_segment_reference_frame) frame_difference = (uint64_t)reference_timestamp-(uint64_t)play_segment_reference_frame; else // rollover - frame_difference = (uint64_t)reference_timestamp+0x100000000LL-(uint64_t)play_segment_reference_frame; + frame_difference = (uint64_t)reference_timestamp+UINT64_C(0x100000000)-(uint64_t)play_segment_reference_frame; uint64_t frame_time_difference_calculated = (((uint64_t)frame_difference<<32)/44100); uint64_t frame_time_difference_actual = remote_reference_timestamp_time-play_segment_reference_frame_remote_time; // this is all done by reference to the sources' system clock // debug(1,"%llu frames since play started, %llu usec calculated, %llu usec actual",frame_difference, (frame_time_difference_calculated*1000000)>>32, (frame_time_difference_actual*1000000)>>32); From 21025440afeadeb8cee56e6bf47988ab13590370 Mon Sep 17 00:00:00 2001 From: Jief Date: Fri, 11 Nov 2016 19:16:47 +0100 Subject: [PATCH 33/39] clock_drift could be left uninitialized. clock_drift redeclared instead of initialized with "uint64_t clock_drift = 0". I think this is the correction. --- rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtp.c b/rtp.c index 576e7ba0..8d5b46df 100644 --- a/rtp.c +++ b/rtp.c @@ -474,7 +474,7 @@ void *rtp_timing_receiver(void *arg) { if (first_local_time==0) { first_local_time = local_time_chosen; first_remote_time = remote_time_chosen; - uint64_t clock_drift = 0; + clock_drift = 0; } else { uint64_t local_time_change = local_time_chosen - first_local_time; uint64_t remote_time_change = remote_time_chosen - first_remote_time; From cdd83f0f87db5dcf50595cf29d7d5a707fa221df Mon Sep 17 00:00:00 2001 From: jneubrand Date: Thu, 24 Nov 2016 11:41:51 -0800 Subject: [PATCH 34/39] Fix ClientIP info in metadata Metadata was previously reporting server ip as client ip "ssnc-clip". Fixed by: - providing remote_ip data instead of ip data for metadata in rtsp.c - continuing export of ip data under "ssnc-svip" metadata tag --- rtsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtsp.c b/rtsp.c index feb11c27..38b07453 100644 --- a/rtsp.c +++ b/rtsp.c @@ -1954,7 +1954,8 @@ void rtsp_listen_loop(void) { inet_ntop(AF_INET, &(sa->sin_addr), remote_ip4, INET_ADDRSTRLEN); unsigned short int rport = ntohs(sa->sin_port); #ifdef CONFIG_METADATA - send_ssnc_metadata('clip', strdup(ip4), strlen(ip4) , 1); + send_ssnc_metadata('clip', strdup(remote_ip4), strlen(remote_ip4) , 1); + send_ssnc_metadata('svip', strdup(ip4), strlen(ip4) , 1); #endif debug(1,"New RTSP connection from %s:%u to self at %s:%u.",remote_ip4,rport,ip4,tport); @@ -1973,7 +1974,8 @@ void rtsp_listen_loop(void) { inet_ntop(AF_INET6, &(sa6->sin6_addr), remote_ip6, INET6_ADDRSTRLEN); u_int16_t rport = ntohs(sa6->sin6_port); #ifdef CONFIG_METADATA - send_ssnc_metadata('clip', strdup(ip6), strlen(ip6), 1); + send_ssnc_metadata('clip', strdup(remote_ip6), strlen(remote_ip6), 1); + send_ssnc_metadata('svip', strdup(ip6), strlen(ip6), 1); #endif debug(1,"New RTSP connection from [%s]:%u to self at [%s]:%u.",remote_ip6,rport,ip6,tport); } From b7723d3a8f7feb94961db5611804b79c976782b6 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 24 Feb 2017 21:43:14 +0000 Subject: [PATCH 35/39] Move to version 3.0 --- configure.ac | 76 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 8d82da4a..56dbc938 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.8.6], [mikebrady@eircom.net]) +AC_INIT([shairport-sync], [3.0], [mikebrady@eircom.net]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([shairport.c]) AC_CONFIG_HEADERS([config.h]) @@ -20,6 +20,7 @@ with_os_type=`echo ${with_os_type} | tr '[[:upper:]]' '[[:lower:]]' ` # Checks for programs. AC_PROG_CC +AC_PROG_CXX AC_PROG_INSTALL PKG_PROG_PKG_CONFIG([0.9.0]) @@ -93,6 +94,22 @@ AC_ARG_WITH([configfiles], [ --with-configfiles = install configuration files during a make install ], ,[with_configfiles=yes]) AM_CONDITIONAL([INSTALL_CONFIG_FILES], [test "x$with_configfiles" = "xyes"]) +# Look for Apple ALAC flag +AC_ARG_WITH(apple-alac, [ --with-apple-alac = include support for the Apple ALAC decoder], + [AC_MSG_RESULT(>>Including the Apple ALAC Decoder) + HAS_APPLE_ALAC=1 + AM_CONDITIONAL([USE_APPLE_ALAC], [test 0]) + AC_DEFINE([CONFIG_APPLE_ALAC], 1, [Needed by the compiler.]) + if test "x${with_pkg_config}" = xyes ; then + PKG_CHECK_MODULES( + [ALAC], [alac], + [LIBS="${ALAC_LIBS} ${LIBS}" + AC_DEFINE([HAVE_APPLE_ALAC],[1],[Define to 1 if you are using the Apple ALAC Decoder])]) + else + AC_CHECK_LIB([alac], [BitBufferInit], , AC_MSG_ERROR(Apple ALAC Decoder support requires the alac library!)) + AC_DEFINE([HAVE_APPLE_ALAC],[1],[Define to 1 if you have the Apple ALAC library]) + fi ]) +AM_CONDITIONAL([USE_APPLE_ALAC], [test "x$HAS_APPLE_ALAC" = "x1"]) # Look for piddir flag AC_ARG_WITH(piddir, [ --with-piddir= Specify a pathname to a directory in which to write the PID file.], [ @@ -108,11 +125,11 @@ AC_ARG_WITH(piddir, [ --with-piddir= Specify a pathname to a directory AM_CONDITIONAL([USE_CUSTOMPIDDIR], [test "x$HAS_CUSTOMPIDDIR" = "x1"]) # Check --with-ssl=argument -AC_ARG_WITH(ssl, [ choose --with-ssl=openssl or --with-ssl=polarssl for encryption services], [ +AC_ARG_WITH(ssl, [ choose --with-ssl=openssl, --with-ssl=mbedtls or --with-ssl=polarssl (deprecated) for encryption services ], [ AC_MSG_CHECKING(encryption libraries chosen) if test "x${with_ssl}" = x -o "x${with_ssl}" = xyes ; then AC_MSG_RESULT(not found) - AC_MSG_ERROR(choose either "openssl" or "polarssl" encryption) + AC_MSG_ERROR(choose "openssl", "mbedtls" or "polarssl" encryption) fi if test "x${with_ssl}" = xopenssl ; then if test "x${with_pkg_config}" = xyes ; then @@ -127,10 +144,17 @@ AC_ARG_WITH(ssl, [ choose --with-ssl=openssl or --with-ssl=polarssl for encrypti AC_DEFINE([HAVE_LIBCRYPTO],[1],[Define to 1 if you have libcrypto]) AC_DEFINE([HAVE_LIBSSL],[1],[Define to 1 if you have libssl]) fi + elif test "x${with_ssl}" = xmbedtls ; then + AC_CHECK_LIB([mbedtls],[mbedtls_ssl_init],, + [AC_MSG_ERROR([Cannot find required libray: libmbedtls],1)]) + AC_CHECK_LIB([mbedcrypto], [mbedtls_entropy_func],, + [AC_MSG_ERROR([Cannot find required library: libmbedcrypto],1)]) + AC_CHECK_LIB([mbedx509], [mbedtls_pk_init],, + [AC_MSG_ERROR([Cannot find required library: libmbedx509],1)]) elif test "x${with_ssl}" = xpolarssl ; then - AC_CHECK_LIB([polarssl],[ssl_init], , AC_MSG_ERROR(PolarSSL selected but the library cannot be found!)) + AC_CHECK_LIB([polarssl],[ssl_init], , AC_MSG_ERROR(PolarSSL is selected but the library cannot be found and is deprecated. Consider selecting mbed TLS instead using --with-ssl=mbedtls.)) else - AC_MSG_ERROR(unknown option "${with_ssl}"." Please choose with "openssl" or "polarssl") + AC_MSG_ERROR(unknown option "${with_ssl}"." Please choose with "openssl", "mbedtls" or "polarssl") fi ], ) @@ -194,9 +218,17 @@ AC_ARG_WITH(ao, [ --with-ao = choose AO (Audio Output?) API support. N.B. no sy AC_MSG_RESULT(>>Including an AO back end. N.B. no synchronisation -- so underflow or overflow is inevitable!) HAS_AO=1 AC_DEFINE([CONFIG_AO], 1, [Needed by the compiler.]) - AC_CHECK_LIB([ao], [ao_initialize], , AC_MSG_ERROR(AO support requires the ao library!))], ) + AC_CHECK_LIB([ao], [ao_initialize], , AC_MSG_ERROR(AO support requires the ao library -- libao-dev suggested))], ) AM_CONDITIONAL([USE_AO], [test "x$HAS_AO" = "x1"]) +# Look for Soundio flag +AC_ARG_WITH(soundio, [ --with-soundio = choose soundio API support.], [ + AC_MSG_RESULT(>>Including an soundio back end) + HAS_SOUNDIO=1 + AC_DEFINE([CONFIG_SOUNDIO], 1, [Needed by the compiler.]) + AC_CHECK_LIB([soundio], [soundio_create], , AC_MSG_ERROR(soundio support requires the soundio library!))], ) +AM_CONDITIONAL([USE_SOUNDIO], [test "x$HAS_SOUNDIO" = "x1"]) + # Look for pulseaudio flag AC_ARG_WITH(pulseaudio, [ --with-pulseaudio = choose PulseAudio API support. N.B. no synchronisation -- so underflow or overflow is inevitable!], [ AC_MSG_RESULT(>>Including a PulseAudio back end. N.B. no synchronisation -- so underflow or overflow is inevitable!) @@ -214,21 +246,25 @@ AC_ARG_WITH(dns_sd, [ --with-dns_sd = choose dns_sd mDNS support], [ AC_SEARCH_LIBS([DNSServiceRefDeallocate], [dns_sd], , AC_MSG_ERROR(dns_sd support requires the dns_sd library!))], ) AM_CONDITIONAL([USE_DNS_SD], [test "x$HAS_DNS_SD" = "x1"]) -# Find systemd unit dir -AC_ARG_WITH([systemdsystemunitdir], - [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, - [with_systemdsystemunitdir=auto]) -AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ - def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) +if test "x${with_systemd}" = xyes ; then + # Find systemd unit dir + AC_ARG_WITH([systemdsystemunitdir], + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, + [with_systemdsystemunitdir=auto]) + AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ + def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) - AS_IF([test "x$def_systemdsystemunitdir" = "x"], - [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], - [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) - with_systemdsystemunitdir=no], - [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) -AS_IF([test "x$with_systemdsystemunitdir" != "xno"], - [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) -AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) + AS_IF([test "x$def_systemdsystemunitdir" = "x"], + [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], + [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) + AS_IF([test "x$with_systemdsystemunitdir" != "xno"], + [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) + AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) +else + AM_CONDITIONAL([HAVE_SYSTEMD], false) +fi # Look for xmltoman AC_CHECK_PROGS([XMLTOMAN], [xmltoman]) From c48ade2ee05310b90965d0f3e3115dd51fb9af30 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 24 Feb 2017 21:49:26 +0000 Subject: [PATCH 36/39] Updated for Version 3.0 --- UPDATING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UPDATING.md b/UPDATING.md index c7aee127..481f3c63 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -28,7 +28,9 @@ $ cd shairport-sync Now, while in the `shairport-sync` directory, perform the following commands (note that there is a choice you must make in there): ``` $ autoreconf -fi - +``` +Please review the release notes to see if any configuration settings have been changed. For instance, in the transitions from version 2 to version 3, the `--with-ssl=polarssl` has been deprecated in favour of `--with-ssl=mbedtls`. +``` #The following is the standard configuration for a Linux that uses the systemd initialisation system: $ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd --sysconfdir=/etc #OR From c669db3e28a5c4ff53be44edaa69b845293c7b91 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 24 Feb 2017 21:56:19 +0000 Subject: [PATCH 37/39] Version 3.0 --- shairport-sync.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shairport-sync.spec b/shairport-sync.spec index ddce7f69..a2b54c39 100644 --- a/shairport-sync.spec +++ b/shairport-sync.spec @@ -1,5 +1,5 @@ Name: shairport-sync -Version: 2.8.6 +Version: 3.0 Release: 1 Summary: AirTunes emulator. Shairport Sync adds multi-room capability with Audio Synchronisation. @@ -56,6 +56,8 @@ getent passwd %{name} &> /dev/null || useradd --system -c "%{name} User" \ %doc AUTHORS LICENSES README.md %changelog +* Fri Feb 24 2017 Mike Brady 2.8.6 +- Many changes including 8- 16- 24- and 32-bit output * Fri Oct 21 2016 Mike Brady 2.8.6 - Advertise self as ShairportSync rather than AirPort device 2.8.6 * Sun Sep 25 2016 Mike Brady 2.8.5 From a45e462fc5a0630d326cb28e618f6c1cc6376862 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 25 Feb 2017 13:42:18 +0000 Subject: [PATCH 38/39] Version 3 --- scripts/shairport-sync.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index cdbdc124..d19e85f3 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -5,13 +5,13 @@ general = { // name = "%H"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes. -// The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.) -// You can use the following substitutions: -// %h for the hostname, -// %H for the Hostname (i.e. with first letter capitalised (ASCII only)), -// %v for the version number, e.g. 3.0 and -// %V for the full version string, e.g. 3.0-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc -// Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H". +// The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.) +// You can use the following substitutions: +// %h for the hostname, +// %H for the Hostname (i.e. with first letter capitalised (ASCII only)), +// %v for the version number, e.g. 3.0 and +// %V for the full version string, e.g. 3.0-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc +// Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H". // password = "secret"; // leave this commented out if you don't want to require a 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. From 755e3a4ef56570e566d15a68d4c73f94d08dc5f7 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sat, 25 Feb 2017 15:14:08 +0000 Subject: [PATCH 39/39] Version 3 Add in the paragraph on UDP, add in `xmltoman` package requirement --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc1ceb79..1386880d 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ What else? * Bit depths of 8, 16, 24 and 32 bits, rather than the standard 16 bits. * Fast Response — With hardware volume control, response is instantaneous; otherwise the response time is 0.15 seconds. * Non-Interruptible — Shairport Sync sends back a "busy" signal if it's already playing audio from another source, so other sources can't disrupt an existing Shairport Sync session. (If a source disappears without warning, the session automatically terminates after two minutes and the device becomes available again.) -* Metadata — Shairport Sync can deliver metadata supplied by the source, such as Album Name, Artist Name, Cover Art, etc. through a pipe to a recipient application program — see https://github.com/mikebrady/shairport-sync-metadata-reader for a sample recipient. Sources that supply metadata include iTunes and the Music app in iOS. +* Metadata — Shairport Sync can deliver metadata supplied by the source, such as Album Name, Artist Name, Cover Art, etc. through a pipe or UDP socket to a recipient application program — see https://github.com/mikebrady/shairport-sync-metadata-reader for a sample recipient. Sources that supply metadata include iTunes and the Music app in iOS. * Raw Audio — Shairport Sync can deliver raw PCM audio to standard output or to a pipe. This output is delivered synchronously with the source after the appropriate latency and is not interpolated or "stuffed" on its way through Shairport Sync. * Autotools and Libtool Support — the Shairport Sync build process uses GNU `autotools` and `libtool` to examine and configure the build environment — important for portability and for cross compilation. Previous versions of Shairport looked at the current system to determine which packages were available, instead of looking at the target system for what packages were available. @@ -114,7 +114,7 @@ Many Linux distributions have Avahi and OpenSSL already in place, so normally it Debian, Ubuntu and Raspbian users can get the basics with: -- `apt-get install build-essential git` – these may already be installed. +- `apt-get install build-essential git xmltoman` – these may already be installed. - `apt-get install autoconf automake libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev` - `apt-get install avahi-daemon libavahi-client-dev` if you want to use Avahi (recommended). - `apt-get install libssl-dev` if you want to use OpenSSL and libcrypto, or use mbed TLS otherwise. @@ -392,6 +392,14 @@ alsa = { }; ``` +Metadata broadcasting over UDP +------------------------------ +As an alternative to sending metadata to a pipe, the `socket_address` and `socket_port` tags may be set in the metadata group to cause Shairport Sync to broadcast UDP packets containing the track metadata. + +The advantage of UDP is that packets can be sent to a single listener or, if a multicast address is used, to multiple listeners. It also allows metadata to be routed to a different host. However UDP has a maximum packet size of about 65000 bytes; while large enough for most data, Cover Art will often exceed this value. Any metadata exceeding this limit will not be sent over the socket interface. The maximum packet size may be set with the `socket_msglength` tag to any value between 500 and 65000 to control this - lower values may be used to ensure that each UDP packet is sent in a single network frame. The default is 500. Other than this restriction, metadata sent over the socket interface is identical to metadata sent over the pipe interface. + +The UDP metadata format is very simple - the first four bytes are the metadata *type*, and the next four bytes are the metadata *code* (both are sent in network byte order - see https://github.com/mikebrady/shairport-sync-metadata-reader for a definition of those terms). The remaining bytes of the packet, if any, make up the raw value of the metadata. + Latency ------- Latency is the exact time from a sound signal's original timestamp until that signal actually "appears" on the output of the audio output device, usually a Digital to Audio Converter (DAC), irrespective of any internal delays, processing times, etc. in the computer.