> > It is going to be quite difficult to write a jack audio out plugin for xine.
> > xine works on a push write method, and jack works on a callback method.
> > I would much prefer that we modified the xine audio out loop to run in 2
> > different modes. 1) It's current mode, 2) callback mode.
> > (2) is far better for audio interfaces like jack, mac os x, and alsa.
> Daniel Mack's new Mac OS X coreaudio_out already implements its own buffer
> between xine and coreaudio's callbacks.
> libjack provides its own ringbuffer type for convenience.
> there's not really much else to it -- setting up the playback thread is
> fairly well handled by the normal CoreAudio API and libjack respectively,
> and then it's a matter of pthread locking between the two threads to
> access the shared buffer.
> so, making a generic callback mode for xine is probably just a matter
> of making some generic routines to handle the shared buffer -- it could
> be nice to use a ringbuffer like jack's as part of this.
sorry for not replying sooner, I have been busy reinstalling my debian into a full sarge setup (fighting to have ALSA properly installed) and doing lots of various other non-computer related things.
Thanks for the advice and pointers. I'll have a look at them before beginning anything serious.
Regarding the fact that jack requires the application to be callback driven, I don't think it's much of a problem for a first test plugin. As was mentionned above, Xine would just need to output all audio into a circular buffer which would then be passed via the callback to the jack server.
In case jack gets too slow to follow xine output then then some samples will be lost and the sound will skip somewhat but I guess it's already the case with other sound servers such as ESD or Arts, probably even with straigth OSS or ALSA output as well. And in case Xine is slower than needed, then the sound will loop into the circular buffer until xine manages to catch up.
We are using this exact technique in our audio library were I work so I don't expect much surprises : if jack already provides ringbuffers as was said above then it should not be very hard to implement.
I should be able to start working on it starting on monday, I'll be reading xine's, jack's and alsa's docs, then I'll try to have some preliminary code, but do not expect a fast pace, I'm on hollydays and I have a lot of non-computer related things to do and I might even travel a bit :(