aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/audio.c16
-rw-r--r--audio/spiceaudio.c5
2 files changed, 16 insertions, 5 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 6ff3f168d7..46578e4a58 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -34,6 +34,7 @@
#include "qemu/module.h"
#include "sysemu/replay.h"
#include "sysemu/runstate.h"
+#include "ui/qemu-spice.h"
#include "trace.h"
#define AUDIO_CAP "audio"
@@ -1696,6 +1697,21 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
/* silence gcc warning about uninitialized variable */
AudiodevListHead head = QSIMPLEQ_HEAD_INITIALIZER(head);
+ if (using_spice) {
+ /*
+ * When using spice allow the spice audio driver being picked
+ * as default.
+ *
+ * Temporary hack. Using audio devices without explicit
+ * audiodev= property is already deprecated. Same goes for
+ * the -soundhw switch. Once this support gets finally
+ * removed we can also drop the concept of a default audio
+ * backend and this can go away.
+ */
+ driver = audio_driver_lookup("spice");
+ driver->can_be_default = 1;
+ }
+
if (dev) {
/* -audiodev option */
legacy_config = false;
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
index c062742622..ed6dff1dcc 100644
--- a/audio/spiceaudio.c
+++ b/audio/spiceaudio.c
@@ -311,11 +311,6 @@ static struct audio_driver spice_audio_driver = {
.voice_size_in = sizeof (SpiceVoiceIn),
};
-void qemu_spice_audio_init (void)
-{
- spice_audio_driver.can_be_default = 1;
-}
-
static void register_audio_spice(void)
{
audio_driver_register(&spice_audio_driver);