qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PULL 23/27] qapi, audio: add query-audiodev command
Date: Tue, 31 Jan 2023 11:12:01 +0100	[thread overview]
Message-ID: <20230131101205.1499867-24-thuth@redhat.com> (raw)
In-Reply-To: <20230131101205.1499867-1-thuth@redhat.com>

From: Daniel P. Berrangé <berrange@redhat.com>

Way back in QEMU 4.0, the -audiodev command line option was introduced
for configuring audio backends. This CLI option does not use QemuOpts
so it is not visible for introspection in 'query-command-line-options',
instead using the QAPI Audiodev type.  Unfortunately there is also no
QMP command that uses the Audiodev type, so it is not introspectable
with 'query-qmp-schema' either.

This introduces a 'query-audiodev' command that simply reflects back
the list of configured -audiodev command line options. This alone is
maybe not very useful by itself, but it makes Audiodev introspectable
via 'query-qmp-schema', so that libvirt (and other upper layer tools)
can discover the available audiodevs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
[thuth: Update for upcoming QEMU v8.0, and use QAPI_LIST_PREPEND]
Message-Id: <20230123083957.20349-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 qapi/audio.json | 13 +++++++++++++
 audio/audio.c   | 12 ++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/qapi/audio.json b/qapi/audio.json
index 1e0a24bdfc..c7aafa2763 100644
--- a/qapi/audio.json
+++ b/qapi/audio.json
@@ -443,3 +443,16 @@
     'sndio':     'AudiodevSndioOptions',
     'spice':     'AudiodevGenericOptions',
     'wav':       'AudiodevWavOptions' } }
+
+##
+# @query-audiodevs:
+#
+# Returns information about audiodev configuration
+#
+# Returns: array of @Audiodev
+#
+# Since: 8.0
+#
+##
+{ 'command': 'query-audiodevs',
+  'returns': ['Audiodev'] }
diff --git a/audio/audio.c b/audio/audio.c
index d849a94a81..6f270c07b7 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -28,8 +28,10 @@
 #include "monitor/monitor.h"
 #include "qemu/timer.h"
 #include "qapi/error.h"
+#include "qapi/clone-visitor.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/qapi-visit-audio.h"
+#include "qapi/qapi-commands-audio.h"
 #include "qemu/cutils.h"
 #include "qemu/module.h"
 #include "qemu/help_option.h"
@@ -2311,3 +2313,13 @@ size_t audio_rate_get_bytes(RateCtl *rate, struct audio_pcm_info *info,
 
     return bytes;
 }
+
+AudiodevList *qmp_query_audiodevs(Error **errp)
+{
+    AudiodevList *ret = NULL;
+    AudiodevListEntry *e;
+    QSIMPLEQ_FOREACH(e, &audiodevs, next) {
+        QAPI_LIST_PREPEND(ret, QAPI_CLONE(Audiodev, e->dev));
+    }
+    return ret;
+}
-- 
2.31.1



  parent reply	other threads:[~2023-01-31 10:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 10:11 [PULL 00/27] qtest and misc patches Thomas Huth
2023-01-31 10:11 ` [PULL 01/27] tests/qtest: netdev: test stream and dgram backends Thomas Huth
2023-01-31 10:11 ` [PULL 02/27] tests/qtest/qom-test: Stop spamming the test log Thomas Huth
2023-01-31 10:11 ` [PULL 03/27] tests/qtest/bios-tables-test: Make the test less verbose by default Thomas Huth
2023-01-31 10:11 ` [PULL 04/27] hw/misc/sifive_u_otp: Remove the deprecated OTP config with '-drive if=none' Thomas Huth
2023-01-31 10:11 ` [PULL 05/27] configs/targets/nios2-softmmu: Add TARGET_NEED_FDT=y to the nios2 config Thomas Huth
2023-01-31 10:11 ` [PULL 06/27] travis.yml: Use the libfdt from the distro instead of the submodule Thomas Huth
2023-01-31 10:11 ` [PULL 07/27] travis.yml: Remove the generic addons section Thomas Huth
2023-01-31 10:11 ` [PULL 08/27] tests/docker/dockerfiles: Add libfdt to the i386 and to the riscv64 container Thomas Huth
2023-01-31 10:11 ` [PULL 09/27] qemu/bswap: Replace bswapXX() by compiler __builtin_bswap() Thomas Huth
2023-01-31 10:11 ` [PULL 10/27] qemu/bswap: Replace bswapXXs() " Thomas Huth
2023-01-31 10:11 ` [PULL 11/27] qemu/bswap: Remove <byteswap.h> dependency Thomas Huth
2023-01-31 10:11 ` [PULL 12/27] qemu/bswap: Use compiler __builtin_bswap() on Haiku Thomas Huth
2023-01-31 10:11 ` [PULL 13/27] qemu/bswap: Use compiler __builtin_bswap() on FreeBSD Thomas Huth
2023-01-31 10:11 ` [PULL 14/27] qemu/bswap: Use compiler __builtin_bswap() on NetBSD Thomas Huth
2023-01-31 10:11 ` [PULL 15/27] MAINTAINERS: Abort HAXM maintenance Thomas Huth
2023-01-31 10:11 ` [PULL 16/27] docs/about/deprecated: Mark HAXM in QEMU as deprecated Thomas Huth
2023-01-31 10:11 ` [PULL 17/27] tests/tcg: Do not build/run TCG tests if TCG is disabled Thomas Huth
2023-01-31 10:11 ` [PULL 18/27] tests/qtest/vnc-display-test: Suppress build warnings on Windows Thomas Huth
2023-01-31 10:11 ` [PULL 19/27] tests/qtest/vnc-display-test: Use the 'none' machine Thomas Huth
2023-01-31 10:11 ` [PULL 20/27] tests/qtest/vnc-display-test: Disable on Darwin Thomas Huth
2023-01-31 10:11 ` [PULL 21/27] tests/qtest/boot-serial-test: Constify tests[] array Thomas Huth
2023-01-31 10:12 ` [PULL 22/27] docs/s390x/pcidevices: document pci devices on s390x Thomas Huth
2023-01-31 10:12 ` Thomas Huth [this message]
2023-01-31 10:12 ` [PULL 24/27] qapi, audio: Make introspection reflect build configuration more closely Thomas Huth
2023-01-31 10:12 ` [PULL 25/27] gitlab-ci.d/buildtest: Remove ppc-softmmu from the clang-system job Thomas Huth
2023-01-31 10:12 ` [PULL 26/27] tests/qtest/display-vga-test: Add proper checks if a device is available Thomas Huth
2023-01-31 10:12 ` [PULL 27/27] gitlab-ci.d/buildtest: Merge the --without-default-* jobs Thomas Huth
2023-02-02 18:00 ` [PULL 00/27] qtest and misc patches Peter Maydell

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=20230131101205.1499867-24-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).