Moving the message to the gtk-vnc-devel mailing list....
On Tue, Nov 29, 2011 at 04:50:22PM -0500, Steven Carr wrote:
> Hello,
> My name is Steven Carr. I have written a patch to gtk-vnc to support
> QEMU/KVM Audio over VNC (outputs to PulseAudio). As with all things Open
> Source, I had a need and scratched it. I needed audio supported for virt-
> manager. I use RHEL 6.1, so audio output uses PulseAudio. The patch is
> based on the contents of the git repository as of 2011-11-29. This was the
> easiest approach to transparently enabling audio on virt-manager.
Thanks for hacking on this. I too have hacked on audio support myself but
I always ended up down a rathole trying to wire it up to gstreamer, so never
ended up finishing it. What you have done with pulseaudio is much simpler
and shows me a nicer direction for us to take :-)
> Taking into consideration the various distributions and sound outputs, it
> might be better to simply have a callback to deliver the audio data packets to
> the user application. This way, it is up to the calling application to
> implement proper audio output (ESD, Pulse, written to a mpeg file, whatever).
>
> int do_audio(void *private, int state, int bytes, char *data)
> {
> my_private_t *priv = (my_private_t *)private;
>
> switch(state) {
> case VNC_QEMU_AUDIO_START:
> case VNC_QEMU_AUDIO_STOP:
> case VNC_QEMU_AUDIO_DATA:
> /* magic happens here */
> }
> }
>
> /* register audio handler */
> void vnc_connection_audio_callback(conn, do_audio, (void *)private_struct);
> void vnc_connection_audio_enable(conn, sample_size, channels, rate);
> void vnc_connection_audio_disable(conn);
I think what I'd do is to create a new GObject interface
VncAudioSink *
which have a couple of methods
vnc_audio_sink_start(VncAudioSink *sink, VncAudioFormat *format);;
vnc_audio_sink_write(VncAudioSink *sink, void *data, gszie len)
vnc_audio_sink_stop(VncAudioSink *sink);
VncAudiobuffer is a simple struct, much like VncPixelformat, just for
holding the sample size / channels / rate
Then, create an implementation of that interface for pulseaudio
VncAudioSinkPulse *
To complete things we just need an API to allow attaching of
an VncAudioSink * to a VncConnection *.
vnc_connection_set_audio_sink(VncConnection *conn, VncAudiSink *sink);
Is this something you have more time to work on ? If not I'll use you
patch as the basis for doing this myself in the future.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Attachment:
signature.asc
Description: Digital signature