Blame 0015-spice-add-audio.patch

Justin M. Forbes a81953
From f3e02bc08c4521dc53d858174612341462d588ce Mon Sep 17 00:00:00 2001
Justin M. Forbes a81953
From: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes a81953
Date: Tue, 13 Apr 2010 10:34:46 +0200
Justin M. Forbes a81953
Subject: [PATCH 15/39] spice: add audio
Justin M. Forbes a81953
Justin M. Forbes a81953
Add support for the spice audio interface.
Justin M. Forbes a81953
Justin M. Forbes a81953
The driver is first in the driver list, but can_be_default is set only
Justin M. Forbes a81953
in case spice is active.  So if you are using spice the spice audio
Justin M. Forbes a81953
driver is the default one, otherwise whatever comes first after spice in
Justin M. Forbes a81953
the list.  Overriding the default using QEMU_AUDIO_DRV works in any
Justin M. Forbes a81953
case.
Justin M. Forbes a81953
---
Justin M. Forbes a81953
 Makefile.objs      |    1 +
Justin M. Forbes a81953
 audio/audio.c      |    3 +
Justin M. Forbes a81953
 audio/audio_int.h  |    1 +
Justin M. Forbes a81953
 audio/spiceaudio.c |  312 ++++++++++++++++++++++++++++++++++++++++++++++++++++
Justin M. Forbes a81953
 qemu-spice.h       |    1 +
Justin M. Forbes a81953
 spice.c            |    1 +
Justin M. Forbes a81953
 6 files changed, 319 insertions(+), 0 deletions(-)
Justin M. Forbes a81953
 create mode 100644 audio/spiceaudio.c
Justin M. Forbes a81953
Justin M. Forbes a81953
diff --git a/Makefile.objs b/Makefile.objs
Justin M. Forbes a81953
index d05643f..9a6b0f3 100644
Justin M. Forbes a81953
--- a/Makefile.objs
Justin M. Forbes a81953
+++ b/Makefile.objs
Justin M. Forbes a81953
@@ -94,6 +94,7 @@ common-obj-$(CONFIG_SPICE) += spice.o spice-input.o spice-display.o
Justin M. Forbes a81953
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
Justin M. Forbes a81953
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
Justin M. Forbes a81953
 audio-obj-$(CONFIG_OSS) += ossaudio.o
Justin M. Forbes a81953
+audio-obj-$(CONFIG_SPICE) += spiceaudio.o
Justin M. Forbes a81953
 audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o
Justin M. Forbes a81953
 audio-obj-$(CONFIG_ALSA) += alsaaudio.o
Justin M. Forbes a81953
 audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
Justin M. Forbes a81953
diff --git a/audio/audio.c b/audio/audio.c
Justin M. Forbes a81953
index ad51077..ade342e 100644
Justin M. Forbes a81953
--- a/audio/audio.c
Justin M. Forbes a81953
+++ b/audio/audio.c
Justin M. Forbes a81953
@@ -44,6 +44,9 @@
Justin M. Forbes a81953
     that we generate the list.
Justin M. Forbes a81953
 */
Justin M. Forbes a81953
 static struct audio_driver *drvtab[] = {
Justin M. Forbes a81953
+#ifdef CONFIG_SPICE
Justin M. Forbes a81953
+    &spice_audio_driver,
Justin M. Forbes a81953
+#endif
Justin M. Forbes a81953
     CONFIG_AUDIO_DRIVERS
Justin M. Forbes a81953
     &no_audio_driver,
Justin M. Forbes a81953
     &wav_audio_driver
Justin M. Forbes a81953
diff --git a/audio/audio_int.h b/audio/audio_int.h
Justin M. Forbes a81953
index 06e313f..d1f6c2d 100644
Justin M. Forbes a81953
--- a/audio/audio_int.h
Justin M. Forbes a81953
+++ b/audio/audio_int.h
Justin M. Forbes a81953
@@ -209,6 +209,7 @@ extern struct audio_driver coreaudio_audio_driver;
Justin M. Forbes a81953
 extern struct audio_driver dsound_audio_driver;
Justin M. Forbes a81953
 extern struct audio_driver esd_audio_driver;
Justin M. Forbes a81953
 extern struct audio_driver pa_audio_driver;
Justin M. Forbes a81953
+extern struct audio_driver spice_audio_driver;
Justin M. Forbes a81953
 extern struct audio_driver winwave_audio_driver;
Justin M. Forbes a81953
 extern struct mixeng_volume nominal_volume;
Justin M. Forbes a81953
Justin M. Forbes a81953
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
Justin M. Forbes a81953
new file mode 100644
Justin M. Forbes a81953
index 0000000..8ae7499
Justin M. Forbes a81953
--- /dev/null
Justin M. Forbes a81953
+++ b/audio/spiceaudio.c
Justin M. Forbes a81953
@@ -0,0 +1,312 @@
Justin M. Forbes a81953
+#include "hw/hw.h"
Justin M. Forbes a81953
+#include "qemu-timer.h"
Justin M. Forbes a81953
+#include "qemu-spice.h"
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+#define AUDIO_CAP "spice"
Justin M. Forbes a81953
+#include "audio.h"
Justin M. Forbes a81953
+#include "audio_int.h"
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+#define LINE_IN_SAMPLES 1024
Justin M. Forbes a81953
+#define LINE_OUT_SAMPLES 1024
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+typedef struct SpiceVoiceOut {
Justin M. Forbes a81953
+    HWVoiceOut            hw;
Justin M. Forbes a81953
+    SpicePlaybackInstance sin;
Justin M. Forbes a81953
+    int64_t               prev_ticks;
Justin M. Forbes a81953
+    int                   active;
Justin M. Forbes a81953
+    uint32_t              *frame;
Justin M. Forbes a81953
+    uint32_t              *fpos;
Justin M. Forbes a81953
+    uint32_t              fsize;
Justin M. Forbes a81953
+} SpiceVoiceOut;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+typedef struct SpiceVoiceIn {
Justin M. Forbes a81953
+    HWVoiceIn             hw;
Justin M. Forbes a81953
+    SpiceRecordInstance   sin;
Justin M. Forbes a81953
+    int64_t               prev_ticks;
Justin M. Forbes a81953
+    int                   active;
Justin M. Forbes a81953
+    uint32_t              samples[LINE_IN_SAMPLES];
Justin M. Forbes a81953
+} SpiceVoiceIn;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static const SpicePlaybackInterface playback_sif = {
Justin M. Forbes a81953
+    .base.type          = SPICE_INTERFACE_PLAYBACK,
Justin M. Forbes a81953
+    .base.description   = "playback",
Justin M. Forbes a81953
+    .base.major_version = SPICE_INTERFACE_PLAYBACK_MAJOR,
Justin M. Forbes a81953
+    .base.minor_version = SPICE_INTERFACE_PLAYBACK_MINOR,
Justin M. Forbes a81953
+};
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static const SpiceRecordInterface record_sif = {
Justin M. Forbes a81953
+    .base.type          = SPICE_INTERFACE_RECORD,
Justin M. Forbes a81953
+    .base.description   = "record",
Justin M. Forbes a81953
+    .base.major_version = SPICE_INTERFACE_RECORD_MAJOR,
Justin M. Forbes a81953
+    .base.minor_version = SPICE_INTERFACE_RECORD_MINOR,
Justin M. Forbes a81953
+};
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static void *spice_audio_init(void)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    if (!using_spice) {
Justin M. Forbes a81953
+        return NULL;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+    return &spice_audio_init;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static void spice_audio_fini(void *opaque)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    /* nothing */
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int calculate_samples(struct audio_pcm_info *info, int64_t *old_ticks)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    int64_t now;
Justin M. Forbes a81953
+    int64_t ticks;
Justin M. Forbes a81953
+    int64_t bytes;
Justin M. Forbes a81953
+    int samples;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    now = qemu_get_clock (vm_clock);
Justin M. Forbes a81953
+    ticks = now - *old_ticks;
Justin M. Forbes a81953
+    *old_ticks = now;
Justin M. Forbes a81953
+    bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ());
Justin M. Forbes a81953
+    bytes = audio_MIN (bytes, INT_MAX);
Justin M. Forbes a81953
+    samples = bytes >> info->shift;
Justin M. Forbes a81953
+    return samples;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+/* playback */
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_out_init(HWVoiceOut *hw, struct audsettings *as)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceOut *out = container_of(hw, SpiceVoiceOut, hw);
Justin M. Forbes a81953
+    struct audsettings settings;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    settings.freq       = SPICE_INTERFACE_PLAYBACK_FREQ;
Justin M. Forbes a81953
+    settings.nchannels  = SPICE_INTERFACE_PLAYBACK_CHAN;
Justin M. Forbes a81953
+    settings.fmt        = AUD_FMT_S16;
Justin M. Forbes a81953
+    settings.endianness = AUDIO_HOST_ENDIANNESS;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    audio_pcm_init_info(&hw->info, &settings);
Justin M. Forbes a81953
+    hw->samples = LINE_OUT_SAMPLES;
Justin M. Forbes a81953
+    out->active = 0;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    out->sin.base.sif = &playback_sif.base;
Justin M. Forbes a81953
+    spice_server_add_interface(spice_server, &out->sin.base);
Justin M. Forbes a81953
+    return 0;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static void line_out_fini(HWVoiceOut *hw)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceOut *out = container_of(hw, SpiceVoiceOut, hw);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    spice_server_remove_interface(&out->sin.base);
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_out_run(HWVoiceOut *hw, int live)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceOut *out = container_of(hw, SpiceVoiceOut, hw);
Justin M. Forbes a81953
+    int rpos, decr;
Justin M. Forbes a81953
+    int samples;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    if (!live) {
Justin M. Forbes a81953
+        return 0;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    decr = calculate_samples(&hw->info, &out->prev_ticks);
Justin M. Forbes a81953
+    decr = audio_MIN(live, decr);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    samples = decr;
Justin M. Forbes a81953
+    rpos = hw->rpos;
Justin M. Forbes a81953
+    while (samples) {
Justin M. Forbes a81953
+        int left_till_end_samples = hw->samples - rpos;
Justin M. Forbes a81953
+        int len = audio_MIN(samples, left_till_end_samples);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+        if (!out->frame) {
Justin M. Forbes a81953
+            spice_server_playback_get_buffer(&out->sin, &out->frame, &out->fsize);
Justin M. Forbes a81953
+            out->fpos = out->frame;
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        if (out->frame) {
Justin M. Forbes a81953
+            len = audio_MIN(len, out->fsize);
Justin M. Forbes a81953
+            hw->clip(out->fpos, hw->mix_buf + rpos, len);
Justin M. Forbes a81953
+            out->fsize -= len;
Justin M. Forbes a81953
+            out->fpos  += len;
Justin M. Forbes a81953
+            if (out->fsize == 0) {
Justin M. Forbes a81953
+                spice_server_playback_put_samples(&out->sin, out->frame);
Justin M. Forbes a81953
+                out->frame = out->fpos = NULL;
Justin M. Forbes a81953
+            }
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        rpos = (rpos + len) % hw->samples;
Justin M. Forbes a81953
+        samples -= len;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+    hw->rpos = rpos;
Justin M. Forbes a81953
+    return decr;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_out_write(SWVoiceOut *sw, void *buf, int len)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    return audio_pcm_sw_write(sw, buf, len);
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_out_ctl(HWVoiceOut *hw, int cmd, ...)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceOut *out = container_of(hw, SpiceVoiceOut, hw);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    switch (cmd) {
Justin M. Forbes a81953
+    case VOICE_ENABLE:
Justin M. Forbes a81953
+        if (out->active) {
Justin M. Forbes a81953
+            break;
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        out->active = 1;
Justin M. Forbes a81953
+        out->prev_ticks = qemu_get_clock (vm_clock);
Justin M. Forbes a81953
+        spice_server_playback_start(&out->sin);
Justin M. Forbes a81953
+        break;
Justin M. Forbes a81953
+    case VOICE_DISABLE:
Justin M. Forbes a81953
+        if (!out->active) {
Justin M. Forbes a81953
+            break;
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        out->active = 0;
Justin M. Forbes a81953
+        if (out->frame) {
Justin M. Forbes a81953
+            memset(out->fpos, 0, out->fsize << 2);
Justin M. Forbes a81953
+            spice_server_playback_put_samples(&out->sin, out->frame);
Justin M. Forbes a81953
+            out->frame = out->fpos = NULL;
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        spice_server_playback_stop(&out->sin);
Justin M. Forbes a81953
+        break;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+    return 0;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+/* record */
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_in_init(HWVoiceIn *hw, struct audsettings *as)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceIn *in = container_of(hw, SpiceVoiceIn, hw);
Justin M. Forbes a81953
+    struct audsettings settings;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    settings.freq       = SPICE_INTERFACE_RECORD_FREQ;
Justin M. Forbes a81953
+    settings.nchannels  = SPICE_INTERFACE_RECORD_CHAN;
Justin M. Forbes a81953
+    settings.fmt        = AUD_FMT_S16;
Justin M. Forbes a81953
+    settings.endianness = AUDIO_HOST_ENDIANNESS;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    audio_pcm_init_info(&hw->info, &settings);
Justin M. Forbes a81953
+    hw->samples = LINE_IN_SAMPLES;
Justin M. Forbes a81953
+    in->active = 0;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    in->sin.base.sif = &record_sif.base;
Justin M. Forbes a81953
+    spice_server_add_interface(spice_server, &in->sin.base);
Justin M. Forbes a81953
+    return 0;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static void line_in_fini(HWVoiceIn *hw)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceIn *in = container_of(hw, SpiceVoiceIn, hw);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    spice_server_remove_interface(&in->sin.base);
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_in_run(HWVoiceIn *hw)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceIn *in = container_of(hw, SpiceVoiceIn, hw);
Justin M. Forbes a81953
+    int num_samples;
Justin M. Forbes a81953
+    int ready;
Justin M. Forbes a81953
+    int len[2];
Justin M. Forbes a81953
+    uint64_t delta_samp;
Justin M. Forbes a81953
+    uint32_t *samples;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    if (!(num_samples = hw->samples - audio_pcm_hw_get_live_in(hw))) {
Justin M. Forbes a81953
+        return 0;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    delta_samp = calculate_samples(&hw->info, &in->prev_ticks);
Justin M. Forbes a81953
+    num_samples = audio_MIN(num_samples, delta_samp);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    ready = spice_server_record_get_samples(&in->sin, in->samples, num_samples);
Justin M. Forbes a81953
+    samples = in->samples;
Justin M. Forbes a81953
+    if (ready == 0) {
Justin M. Forbes a81953
+        static uint32_t silence[LINE_IN_SAMPLES];
Justin M. Forbes a81953
+        samples = silence;
Justin M. Forbes a81953
+        ready = LINE_IN_SAMPLES;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    num_samples = audio_MIN(ready, num_samples);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    if (hw->wpos + num_samples > hw->samples) {
Justin M. Forbes a81953
+        len[0] = hw->samples - hw->wpos;
Justin M. Forbes a81953
+        len[1] = num_samples - len[0];
Justin M. Forbes a81953
+    } else {
Justin M. Forbes a81953
+        len[0] = num_samples;
Justin M. Forbes a81953
+        len[1] = 0;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    hw->conv(hw->conv_buf + hw->wpos, samples, len[0], &nominal_volume);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    if (len[1]) {
Justin M. Forbes a81953
+        hw->conv(hw->conv_buf, samples + len[0], len[1],
Justin M. Forbes a81953
+                 &nominal_volume);
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    hw->wpos = (hw->wpos + num_samples) % hw->samples;
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    return num_samples;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_in_read(SWVoiceIn *sw, void *buf, int size)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    return audio_pcm_sw_read(sw, buf, size);
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static int line_in_ctl(HWVoiceIn *hw, int cmd, ...)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    SpiceVoiceIn *in = container_of(hw, SpiceVoiceIn, hw);
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    switch (cmd) {
Justin M. Forbes a81953
+    case VOICE_ENABLE:
Justin M. Forbes a81953
+        if (in->active) {
Justin M. Forbes a81953
+            break;
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        in->active = 1;
Justin M. Forbes a81953
+        in->prev_ticks = qemu_get_clock (vm_clock);
Justin M. Forbes a81953
+        spice_server_record_start(&in->sin);
Justin M. Forbes a81953
+        break;
Justin M. Forbes a81953
+    case VOICE_DISABLE:
Justin M. Forbes a81953
+        if (!in->active) {
Justin M. Forbes a81953
+            break;
Justin M. Forbes a81953
+        }
Justin M. Forbes a81953
+        in->active = 0;
Justin M. Forbes a81953
+        spice_server_record_stop(&in->sin);
Justin M. Forbes a81953
+        break;
Justin M. Forbes a81953
+    }
Justin M. Forbes a81953
+    return 0;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static struct audio_option audio_options[] = {
Justin M. Forbes a81953
+    { /* end of list */ },
Justin M. Forbes a81953
+};
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+static struct audio_pcm_ops audio_callbacks = {
Justin M. Forbes a81953
+    .init_out = line_out_init,
Justin M. Forbes a81953
+    .fini_out = line_out_fini,
Justin M. Forbes a81953
+    .run_out  = line_out_run,
Justin M. Forbes a81953
+    .write    = line_out_write,
Justin M. Forbes a81953
+    .ctl_out  = line_out_ctl,
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+    .init_in  = line_in_init,
Justin M. Forbes a81953
+    .fini_in  = line_in_fini,
Justin M. Forbes a81953
+    .run_in   = line_in_run,
Justin M. Forbes a81953
+    .read     = line_in_read,
Justin M. Forbes a81953
+    .ctl_in   = line_in_ctl,
Justin M. Forbes a81953
+};
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+struct audio_driver spice_audio_driver = {
Justin M. Forbes a81953
+    .name           = "spice",
Justin M. Forbes a81953
+    .descr          = "spice audio driver",
Justin M. Forbes a81953
+    .options        = audio_options,
Justin M. Forbes a81953
+    .init           = spice_audio_init,
Justin M. Forbes a81953
+    .fini           = spice_audio_fini,
Justin M. Forbes a81953
+    .pcm_ops        = &audio_callbacks,
Justin M. Forbes a81953
+    .max_voices_out = 1,
Justin M. Forbes a81953
+    .max_voices_in  = 1,
Justin M. Forbes a81953
+    .voice_size_out = sizeof(SpiceVoiceOut),
Justin M. Forbes a81953
+    .voice_size_in  = sizeof(SpiceVoiceIn),
Justin M. Forbes a81953
+};
Justin M. Forbes a81953
+
Justin M. Forbes a81953
+void qemu_spice_audio_init(void)
Justin M. Forbes a81953
+{
Justin M. Forbes a81953
+    spice_audio_driver.can_be_default = 1;
Justin M. Forbes a81953
+}
Justin M. Forbes a81953
diff --git a/qemu-spice.h b/qemu-spice.h
Justin M. Forbes a81953
index f061004..6f19ba7 100644
Justin M. Forbes a81953
--- a/qemu-spice.h
Justin M. Forbes a81953
+++ b/qemu-spice.h
Justin M. Forbes a81953
@@ -13,6 +13,7 @@ extern int using_spice;
Justin M. Forbes a81953
Justin M. Forbes a81953
 void qemu_spice_init(void);
Justin M. Forbes a81953
 void qemu_spice_input_init(void);
Justin M. Forbes a81953
+void qemu_spice_audio_init(void);
Justin M. Forbes a81953
 void qemu_spice_display_init(DisplayState *ds);
Justin M. Forbes a81953
Justin M. Forbes a81953
 #else  /* CONFIG_SPICE */
Justin M. Forbes a81953
diff --git a/spice.c b/spice.c
Justin M. Forbes a81953
index 3fe76cd..fc76ef7 100644
Justin M. Forbes a81953
--- a/spice.c
Justin M. Forbes a81953
+++ b/spice.c
Justin M. Forbes a81953
@@ -204,6 +204,7 @@ void qemu_spice_init(void)
Justin M. Forbes a81953
     using_spice = 1;
Justin M. Forbes a81953
Justin M. Forbes a81953
     qemu_spice_input_init();
Justin M. Forbes a81953
+    qemu_spice_audio_init();
Justin M. Forbes a81953
Justin M. Forbes a81953
     qemu_free(x509_key_file);
Justin M. Forbes a81953
     qemu_free(x509_cert_file);
Justin M. Forbes a81953
-- 
Justin M. Forbes a81953
1.7.2.3
Justin M. Forbes a81953