[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/24] audio: forbid default audiodev backend with -nodefaults
From: |
Paolo Bonzini |
Subject: |
[PULL 24/24] audio: forbid default audiodev backend with -nodefaults |
Date: |
Tue, 3 Oct 2023 10:30:41 +0200 |
Now that all callers support setting an audiodev, forbid using the default
audiodev if -nodefaults is provided on the command line.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/audio.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/audio/audio.c b/audio/audio.c
index 4289b7bf028..730bf2498dc 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1692,6 +1692,10 @@ static 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_*");
@@ -1808,6 +1812,14 @@ bool AUD_register_card (const char *name, QEMUSoundCard
*card, Error **errp)
{
if (!card->state) {
if (!QTAILQ_EMPTY(&audio_states)) {
+ /*
+ * FIXME: once it is possible to create an arbitrary
+ * default device via -audio DRIVER,OPT=VALUE (no "model"),
+ * replace this special case with the default AudioState*,
+ * storing it in a separate global. For now, keep the
+ * warning to encourage moving off magic use of the first
+ * -audiodev.
+ */
if (QSIMPLEQ_EMPTY(&default_audiodevs)) {
dolog("Device %s: audiodev default parameter is deprecated,
please "
"specify audiodev=%s\n", name,
@@ -1820,6 +1832,10 @@ bool AUD_register_card (const char *name, QEMUSoundCard
*card, Error **errp)
}
card->state = audio_init(NULL, errp);
if (!card->state) {
+ if (!QSIMPLEQ_EMPTY(&audiodevs)) {
+ error_append_hint(errp, "Perhaps you wanted to set
audiodev=%s?",
+ QSIMPLEQ_FIRST(&audiodevs)->dev->id);
+ }
return false;
}
}
--
2.41.0
- [PULL 15/24] audio: return Error ** from audio_state_by_name, (continued)
- [PULL 15/24] audio: return Error ** from audio_state_by_name, Paolo Bonzini, 2023/10/03
- [PULL 16/24] audio: commonize voice initialization, Paolo Bonzini, 2023/10/03
- [PULL 19/24] Introduce machine property "audiodev", Paolo Bonzini, 2023/10/03
- [PULL 17/24] audio: simplify flow in audio_init, Paolo Bonzini, 2023/10/03
- [PULL 04/24] pc: remove short_root_bus property, Paolo Bonzini, 2023/10/03
- [PULL 22/24] vt82c686 machines: Support machine-default audiodev with fallback, Paolo Bonzini, 2023/10/03
- [PULL 20/24] hw/arm: Support machine-default audiodev with fallback, Paolo Bonzini, 2023/10/03
- [PULL 13/24] audio: Require AudioState in AUD_add_capture, Paolo Bonzini, 2023/10/03
- [PULL 14/24] audio: allow returning an error from the driver init, Paolo Bonzini, 2023/10/03
- [PULL 18/24] audio: remove QEMU_AUDIO_* and -audio-help support, Paolo Bonzini, 2023/10/03
- [PULL 24/24] audio: forbid default audiodev backend with -nodefaults,
Paolo Bonzini <=
- [PULL 09/24] esp: restrict non-DMA transfer length to that of available data, Paolo Bonzini, 2023/10/03
- [PULL 23/24] audio: propagate Error * out of audio_init, Paolo Bonzini, 2023/10/03
- Re: [PULL 00/24] Audio, build system, misc fixes for 2023-10-03, Stefan Hajnoczi, 2023/10/03
- Re: [PULL 00/24] Audio, build system, misc fixes for 2023-10-03, Michael Tokarev, 2023/10/03