From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: balaton@eik.bme.hu
Subject: [PATCH 13/13] audio: forbid default audiodev backend with -nodefaults
Date: Mon, 2 Oct 2023 16:57:27 +0200 [thread overview]
Message-ID: <20231002145728.87958-14-pbonzini@redhat.com> (raw)
In-Reply-To: <20231002145728.87958-1-pbonzini@redhat.com>
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
next prev parent reply other threads:[~2023-10-02 14:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 14:57 [PATCH v4 00/13] Cleanup deprecated audio features, take 2 Paolo Bonzini
2023-10-02 14:57 ` [PATCH 01/13] ui/vnc: Require audiodev= to enable audio Paolo Bonzini
2023-10-02 14:57 ` [PATCH 02/13] audio: Require AudioState in AUD_add_capture Paolo Bonzini
2023-10-02 14:57 ` [PATCH 03/13] audio: allow returning an error from the driver init Paolo Bonzini
2023-10-02 14:57 ` [PATCH 04/13] audio: return Error ** from audio_state_by_name Paolo Bonzini
2023-10-02 14:57 ` [PATCH 05/13] audio: commonize voice initialization Paolo Bonzini
2023-10-02 14:57 ` [PATCH 06/13] audio: simplify flow in audio_init Paolo Bonzini
2023-10-02 14:57 ` [PATCH 07/13] audio: remove QEMU_AUDIO_* and -audio-help support Paolo Bonzini
2023-10-02 14:57 ` [PATCH 08/13] Introduce machine property "audiodev" Paolo Bonzini
2023-10-02 14:57 ` [PATCH 09/13] hw/arm: Support machine-default audiodev with fallback Paolo Bonzini
2023-10-02 14:57 ` [PATCH 10/13] hw/ppc: " Paolo Bonzini
2023-10-02 14:57 ` [PATCH 11/13] vt82c686 machines: " Paolo Bonzini
2023-10-02 14:57 ` [PATCH 12/13] audio: propagate Error * out of audio_init Paolo Bonzini
2023-10-02 14:57 ` Paolo Bonzini [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-09-28 7:36 [PATCH v2 00/13] Cleanup deprecated audio features, take 2 Paolo Bonzini
2023-09-28 7:36 ` [PATCH 13/13] audio: forbid default audiodev backend with -nodefaults Paolo Bonzini
2023-09-23 8:54 [PATCH 00/13] Cleanup deprecated audio features, take 2 Paolo Bonzini
2023-09-23 8:55 ` [PATCH 13/13] audio: forbid default audiodev backend with -nodefaults Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231002145728.87958-14-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).