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>
diff --git a/audio/audio.c b/audio/audio.c
index 9862157..67a7e25 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1688,14 +1688,10 @@
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 @@
}
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)) {