On 2/17/26 06:27, Sergei Heifetz wrote:
When QEMU is configured with `--disable-audio`, do not build any
audio-related sources.

- audio/meson.build and replay/meson.build:
   Exclude audio-related sources when audio is disabled.

- audio/audio-stub.c:
   Provide a minimal set of straightforward stubs.

- replay/replay-audio-stub.c:
   Move the existing stubs from replay/stubs-system.c into a separate
   file.

- qapi/audio.json:
   Remove the QMP `query-audiodevs` command.

- audio/audio-hmp-cmds-stub.c:
   Provide meaningful messages for audio-related HMP commands:
   stopcapture, wavcapture, info capture.

Signed-off-by: Sergei Heifetz <[email protected]>
---
  audio/audio-hmp-cmds-stub.c | 28 ++++++++++++++++++++++++++++

Can you remove the commands instead?

+AudioBackend *audio_be_by_name(const char *name, Error **errp)
+{
+  error_setg(
+      errp,
+      "trying to find audiodev '%s' by name with audio component disabled",

This can be simplified to just  'audio disabled' or something like that.

+      name);
+  return NULL;
+}
+
+const char *audio_be_get_id(AudioBackend *be) { return ""; }

Can you instead compile out qdev_prop_audiodev?

+bool audio_be_set_dbus_server(AudioBackend *be,
+                              GDBusObjectManagerServer *server, bool p2p,
+                              Error **errp)
+{
+  error_setg(errp, "trying to set dbus server with audio component disabled");

Since this requires an AudioBackend, which you cannot get with audio disabled, it can be simply abort().

+if audio_enabled
+  system_ss.add(when: 'CONFIG_TCG',
+  if_true: files('replay-audio.c'),
+  if_false: files('replay-audio-stub.c'))
+else
+  system_ss.add(files('replay-audio-stub.c'))
+endif

I think this can be simply

  system_ss.add(when: ['CONFIG_TCG', 'CONFIG_AUDIO'],
     if_true: files('replay-audio.c'),
     if_false: files('replay-audio-stub.c'))

but I may be incorrect.

Paolo


Reply via email to