This replaces most of the code taken from mosx-mpg123 and should
make osx_write.c much more readable, shorter and more reliable.
Since coreaudio creates a new thread which periodically calls our
callback function, some kind of coordination between the two threads
of execution is necessary.
This implementation employs a new buffer tree node and a mutex to
serialize access to the data buffers. The parent thread pushes
down all data to the child thread which consumes this data in the
callback function. Both threads grab the new mutex whenever they
access or modify the data buffers.