[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/26] audio: reintroduce default audio backend for VNC
|
From: |
Paolo Bonzini |
|
Subject: |
[PULL 25/26] audio: reintroduce default audio backend for VNC |
|
Date: |
Fri, 6 Oct 2023 13:14:11 +0200 |
Make VNC use the default backend again if one is defined.
The recently introduced support for disabling the VNC audio
extension is still used, in case no default backend exists.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/audio.c | 28 ++++++++++++++++++----------
audio/audio.h | 1 +
docs/about/removed-features.rst | 6 ------
ui/vnc.c | 2 ++
4 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index bd4bcabccaf..73b65dc3b9b 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1801,20 +1801,28 @@ out:
return NULL;
}
+AudioState *audio_get_default_audio_state(Error **errp)
+{
+ if (!default_audio_state) {
+ default_audio_state = audio_init(NULL, errp);
+ if (!default_audio_state) {
+ if (!QSIMPLEQ_EMPTY(&audiodevs)) {
+ error_append_hint(errp, "Perhaps you wanted to use -audio or
set audiodev=%s?\n",
+ QSIMPLEQ_FIRST(&audiodevs)->dev->id);
+ }
+ }
+ }
+
+ return default_audio_state;
+}
+
bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
{
if (!card->state) {
- if (!default_audio_state) {
- default_audio_state = audio_init(NULL, errp);
- if (!default_audio_state) {
- if (!QSIMPLEQ_EMPTY(&audiodevs)) {
- error_append_hint(errp, "Perhaps you wanted to use -audio
or set audiodev=%s?\n",
- QSIMPLEQ_FIRST(&audiodevs)->dev->id);
- }
- return false;
- }
+ card->state = audio_get_default_audio_state(errp);
+ if (!card->state) {
+ return false;
}
- card->state = default_audio_state;
}
card->name = g_strdup (name);
diff --git a/audio/audio.h b/audio/audio.h
index 6da5e8f6f0f..fcc22307bee 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -176,6 +176,7 @@ void audio_init_audiodevs(void);
void audio_help(void);
AudioState *audio_state_by_name(const char *name, Error **errp);
+AudioState *audio_get_default_audio_state(Error **errp);
const char *audio_get_id(QEMUSoundCard *card);
#define DEFINE_AUDIO_PROPERTIES(_s, _f) \
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index ed94b4cd0c8..f04036987b1 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -460,12 +460,6 @@ in this case.
Note that the default audio backend must be configured on the command
line if the ``-nodefaults`` options is used.
-Creating vnc without ``audiodev=`` property (removed in 8.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-When using vnc, you should specify an ``audiodev=`` property if
-you plan to transmit audio through the VNC protocol.
-
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/ui/vnc.c b/ui/vnc.c
index acbb88c4ca0..7f4c471503a 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4185,6 +4185,8 @@ void vnc_display_open(const char *id, Error **errp)
if (!vd->audio_state) {
goto fail;
}
+ } else {
+ vd->audio_state = audio_get_default_audio_state(NULL);
}
device_id = qemu_opt_get(opts, "display");
--
2.41.0
- [PULL 19/26] cutils: squelch compiler warnings with custom paths, (continued)
- [PULL 19/26] cutils: squelch compiler warnings with custom paths, Paolo Bonzini, 2023/10/06
- [PULL 20/26] audio: error hints need a trailing \n, Paolo Bonzini, 2023/10/06
- [PULL 18/26] configure: change $softmmu to $system, Paolo Bonzini, 2023/10/06
- [PULL 13/26] target/i386: Rename i386_softmmu_kvm_ss -> i386_kvm_ss, Paolo Bonzini, 2023/10/06
- [PULL 15/26] meson: Rename softmmu_mods -> system_mods, Paolo Bonzini, 2023/10/06
- [PULL 21/26] audio: disable default backends if -audio/-audiodev is used, Paolo Bonzini, 2023/10/06
- [PULL 23/26] audio: extend -audio to allow creating a default backend, Paolo Bonzini, 2023/10/06
- [PULL 24/26] audio: do not use first -audiodev as default audio device, Paolo Bonzini, 2023/10/06
- [PULL 14/26] hw/virtio/meson: Rename softmmu_virtio_ss -> system_virtio_ss, Paolo Bonzini, 2023/10/06
- [PULL 22/26] audio: extract audio_define_default, Paolo Bonzini, 2023/10/06
- [PULL 25/26] audio: reintroduce default audio backend for VNC,
Paolo Bonzini <=
- [PULL 26/26] audio, qtest: get rid of QEMU_AUDIO_DRV, Paolo Bonzini, 2023/10/06
- Re: [PULL 00/26] Audio, source reorg, HVF changes for 2023-10-06, Paolo Bonzini, 2023/10/08