Avahi provides (sometimes at least) a dns_sd compatibility layer.
There's no point using it if we can use avahi's "native" library, so
don't even detect dns_sd.h's availability
This backend allows shairport to run without having a heavy daemon such
as avahi or mDNSResponder running in the background.
ipv6 support is more or less experimental right now.
mDNS is now handled more or less in the same way audio is.
Multiple mDNS backends are available, shairport tries them all until one
works.
This makes it, IMHO, cleaner, and easier to add other mDNS backends in
the future, such as using tinysvcmdns or dns-sd library.
Also it will also allow to define mDNS backends as plugins, in a similar
way it is done in PR #230.
pthread seems to reuse thread identifiers (at least on arm).
Reset it to zero after closing a playing connection, or else future
thread might believe they are playing.
This allows to get a better error message than "Spawning the daemon failed."
when initialization fails.
The error message is sent through the pipe. When init is OK, just send
a null byte.
libpulse was initialized before the fork. This caused calls to libpulse
made after the fork fail.
Now initialize lib pulse when we need it, after the fork.
The driver id returned by libao wasn't checked correctly.
When the driver did not exist, libao returns a negative number. The
libao output driver checked for a non zero id.
This caused shairport to refuse to use the first driver, and not fail
when using a non-existant driver.