diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-10-05 11:55:03 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-10-08 21:08:27 +0200 |
commit | c753bf479ab75fe245c2de6a414b60b9e25a2bd7 (patch) | |
tree | 56d8800fe00a370420f6fa672b55c4f1517a92bc /audio | |
parent | c7c5caeb1f314c5662a3b2985fe3befebf45b650 (diff) |
audio: disable default backends if -audio/-audiodev is used
Match what is done for other options, for example -monitor, and also
the behavior of QEMU 8.1 (see the "legacy_config" variable). Require
the user to specify a backend if one is specified on the command line.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio.c | 9 | ||||
-rw-r--r-- | audio/audio.h | 1 |
2 files changed, 2 insertions, 8 deletions
diff --git a/audio/audio.c b/audio/audio.c index 98621576d9..67a7e25254 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1688,14 +1688,10 @@ static const VMStateDescription vmstate_audio = { static void audio_validate_opts(Audiodev *dev, Error **errp); -static void audio_create_default_audiodevs(void) +void audio_create_default_audiodevs(void) { const char *drvname = getenv("QEMU_AUDIO_DRV"); - if (!defaults_enabled()) { - return; - } - /* QEMU_AUDIO_DRV=none is used by libqtest. */ if (drvname && !g_str_equal(drvname, "none")) { error_report("Please use -audiodev instead of QEMU_AUDIO_*"); @@ -1827,9 +1823,6 @@ bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp) } card->state = QTAILQ_FIRST(&audio_states); } else { - if (QSIMPLEQ_EMPTY(&default_audiodevs)) { - audio_create_default_audiodevs(); - } card->state = audio_init(NULL, errp); if (!card->state) { if (!QSIMPLEQ_EMPTY(&audiodevs)) { diff --git a/audio/audio.h b/audio/audio.h index 80f3f92124..53b1d7e622 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -170,6 +170,7 @@ void audio_sample_from_uint64(void *samples, int pos, void audio_define(Audiodev *audio); void audio_parse_option(const char *opt); +void audio_create_default_audiodevs(void); void audio_init_audiodevs(void); void audio_help(void); |