xbmc/xbmc — pull request #2144 by Memphiz (2013-01-30 17:16:17+00:00)
Title: [AE/CA] - add and handle devicechange notification

This basically registers the CA AudioEngine to OS notifications for device changes. Whenever the List of AudioDevices changes we reopen our CoreAudio Output Device (with last used format parameters). Our OpenCoreAudio method has an automated fallback to the OSX default output device. In case our current Output device vanishes we will be routed to the next OSX default output device.

This fixes the following behaviour (tested/reproduced by users and me):
1. OSX -> HDMI -> AVR -> HDMI -> TV
a. in this Constellation when turning off the TV our audio device will vanish. Without this fix - Audio output vanishes until a makestream was called with different format then before (mostly users just restarted XBMC for getting audio back)

2. When using default output and attachng a bluetooth headset or earphnes there was no automatic switch to it (osx uses these kind of audiooutputs as default automatically). A stream had to bestarted for switching to the headset/earphones

3. When using refreshrate adaption and pass through - on my hack audio just vanished and video stuttered (i had to select different audiostream for getting audio back).

With this PR all of those 3 issues are solved. Transition/reopen between/of devices even works when streams are played.

I consider this Frodo 12.1 food

@davilla and @huceke to comment (no - its not a hammer imo!)