Home

Awesome

Shairplay

Free, portable AirPlay Server implementation similar to ShairPort.
Currently, only AirPort Express emulation is supported.

Table of Contents

  1. Prerequisites
  1. How-to-Build
  1. Installation
  2. Airport.key File
  3. Usage
  4. Development
  1. Disclaimer
  2. Related Projects

Prerequisites<a id="prerequisites"></a>

External Dependencies<a id="external-Dependencies"></a>

Before building, a number of external dependencies needs to be installed (depending on your platform).

NameTitle
libaoCross platform audio library
libavahiDNS/DNS-SD service discovery
autoconfGeneratinge configure scripts
automakeGenerating Makefiles
libtoolCreating portable compiled libraries
pkg-configGathering metadata of installed packages

Installation on Linux<a id="installation-on-linux"></a>

Using apt-get:

sudo apt-get install autoconf automake libtool libltdl-dev
sudo apt-get libao-dev
sudo apt-get libavahi-compat-libdnssd-dev
sudo apt-get install avahi-daemon

Installation on OSX<a id="installation-on-osx"></a>

On Apple OSX, a third-party package manager such as Homebrew needs to be installed before installing dependencies.

After installing Homebrew, run:

brew install autoconf automake libtool pkg-config
brew install libao

How-to-Build<a id="how-to-build"></a>

In order to build the shairplay application, the libao audio library dependency needs to be installed - otherwise, only the library will be built.

Using Make<a id="using-make"></a>

Preparation

./autogen.sh
./configure

Building

make clean
make

Output

OutputLocation
Application Binarysrc/shairplay
Static Librarysrc/lib/.libs/libshairplay.a
Dynamic Librarysrc/lib/.libs/libshairplay.0.dylib

Using XCode<a id="using-xcode"></a>

Both the Shairplay application and library are available as targets within a main XCode project file. Internal dependencies are registered as dependencies within this project.

Preparation

./autogen.sh
./configure
make clean

XCode Project Files

XCode Project FileLocation
Main Projectextras/xcode/shairplay/shairplay.xcodeproj
Dependency: Cryptoextras/xcode/crypto/crypto.xcodeproj
Dependency: ALACextras/xcode/alac/alac.xcodeproj

Output

All XCode build output is deployed the "build" folder.

Installation<a id="installation"></a>

After building, run:

sudo make install

The results will be located at

Usage<a id="usage"></a>

Running an AirPlay Server

Place the airport.key file in your working directory. Then, start the server with:

shairplay [options...]

If you are connected to a Wi-Fi, the server should show as an AirPort Express on your iOS devices and Mac OS X computers in the same network.

Options

Example:

shairplay --help

Airport.key File<a id="airport.key"></a>

You need to have the airport.key file in the current working directory when starting the server.

It is not included in the binary for legal reasons.

Development<a id="development"></a>

Components<a id="components"></a>

ComponentFolder
Main Application & Library sourcessrc/lib/
Main Library public headersinclude/shairplay/
Qt4 Application sourcesAirTV-Qt/
Python bindingssrc/bindings/python/
Qt bindingssrc/bindings/qt4/

Source Location<a id="source-locations"></a>

Main Application

FileContents
shairplay.cShairplay application

Main Library

FileContents
base64.*base64 encoder/decoder
dnssd.*dnssd helper functions
http_parser.*HTTP parser from joyent (nginx fork)
http_request.*Request parser that uses http_parser
http_response.*Extremely simple HTTP response serializer
httpd.*Generic HTTP/RTSP server
logger.*Logging related functions
netutils.*Mostly socket related code
raop.*Main RAOP handler, handles all RTSP stuff
raop_rtp.*Handles the RAOP RTP related stuff (UDP/TCP)
raop_buffer.*Parses and buffers RAOP packets, resend logic here
rsakey.*Decrypts and parses the RSA key to bigints
rsapem.*Converts the RSA PEM key to DER encoded bytes
sdp.*Extremely simple RAOP specific SDP parser
utils.*Utils for reading a file and handling strings

Qt Application

FileContents
main.cppInitializes the application
mainapplication.cppCreates the tray icon and starts RAOP
raopservice.cppHandles all communication with the library
raopcallbackhandler.cppConverts C callbacks to Qt callbacks
audiooutput.cppTakes care of the actual audio output

Disclaimer<a id="disclaimer"></a>

All the resources in this repository are written using only freely available information from the internet. The code and related resources are meant for educational purposes only. It is the responsibility of the user to make sure all local laws are adhered to.

Related Projects<a id="related-projects"></a>