On 2/17/26 14:49, Paolo Bonzini wrote:
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?

Yes, sure.
+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.
Ok.

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

Can you instead compile out qdev_prop_audiodev?
I think so. I'll try it.

+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().
That's reasonable, I'll replace it with 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.

I’ve already tried it, and it doesn’t work for some reason.
Paolo

Thank you for reviewing and for participating in the discussion about the series. I probably wouldn’t have been able to summarise the points as clearly myself.


Reply via email to