audio: remove qemu_spice_audio_init()

Handle the spice special case in audio_init instead.

With the qemu_spice_audio_init() symbol dependency being
gone we can build spiceaudio as module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200916084117.21828-2-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2020-09-16 10:41:16 +02:00
parent a8a98cfd42
commit f0c4555edf
4 changed files with 16 additions and 7 deletions

View File

@ -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;

View File

@ -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);

View File

@ -29,7 +29,6 @@ extern int using_spice;
void qemu_spice_init(void);
void qemu_spice_input_init(void);
void qemu_spice_audio_init(void);
void qemu_spice_display_init(void);
int qemu_spice_display_add_client(int csock, int skipauth, int tls);
int qemu_spice_add_interface(SpiceBaseInstance *sin);

View File

@ -804,7 +804,6 @@ void qemu_spice_init(void)
qemu_spice_add_interface(&spice_migrate.base);
qemu_spice_input_init();
qemu_spice_audio_init();
qemu_add_vm_change_state_handler(vm_change_state_handler, NULL);
qemu_spice_display_stop();