PDA

View Full Version : Airport Express (Airplay/AirTunes Audio) emulator for iOS




MikeNemat
Apr 13, 2011, 04:12 PM
I'm working on a project to port the recently released Shairport tool that emulates an Airport Express to iOS and Mac OS X. (Disclaimer: this app is for personal use since it uses a leaked private key, I have no intention to release it on the app store). Ideally, my app will be more of a framework or library that anyone can use for their apps. Shairport is written in Perl/C so it is not suitable for "user-friendly" deployment to iOS and Mac OS X. My app will use OpenSSL for the AES and RSA encryption, ASyncSockets for HTTP and UDP networking, and nothing else. The idea is to make this a native app, no perl, no avahi, no libao, no software ALAC decoder.

As of now, I have the secure handshaking aspect of the RAOP protocol working as well as native Bonjour/Zeroconf/mDNS/Whatever you want to call it broadcasting working. I am able to respond to the RTSP requests OPTION, ANNOUNCE, and SETUP. iTunes will see my app as an Airport Express in the AirPlay list and will begin streaming audio in ALAC format to the app. I am successfully listening on the 3 UDP ports specified by the SETUP request, however, I'm at a bit of a loss on how to decrypt this with the AES keys from the SETUP request and how to feed this into CoreAudio.

Couple of questions to the community:

1) Are you working on anything similar, if so, perhaps we can collaborate? I would have no objections with starting an open-source project around this, however my code is at the uber-early proof of concept stage at this point.
2) Do you have experience using CoreAudio and the AudioFileStream format, if so, do you have an example you'd be willing to share?
3) Have you ever streamed audio to an Airport Express before? Is it a straight-up ALAC bitstream that reads bits from the file and spits it out as UDP packets? Are the headers intact?
4) Do you have an understanding of what the timing port and control ports are used for?
5) Have you looked at the shairport source code? Can you offer insights on how much of the back-end server and ALAC decoder code can be replaced by CoreAudio?



codeedog
Sep 13, 2012, 12:19 PM
Mike, I'm about to start working on this. I've downloaded the latest shairport and am considering just doing a machine port to the Mac (it's been done, but basically hop over libao and go straight to Core Audio), although I like your idea of a compete re-write. I've had quite a bit of programming experience at the IP layers and built very complex systems, although I haven't had much experience with Bonjour, etc. I'm looking forward to the challenge.

That said, if you've made any significant progress in this area, I'm happy to take a look at your code and, possibly, extend it.

I think anything done has to ultimately be open source and certainly cannot be sold, so I agree, this cannot be a money maker. Nonetheless, I think quite a few people would find all of this useful.

Please contact me. Not sure how we can trade emails without placing them on this board. Friending?