On Mon, 1 Dec 2025, [email protected] wrote:
From: Marc-André Lureau <[email protected]>

Hi,

The following patch series provides a GStreamer-based audio backend, which could
ultimately allow QEMU to leverage the framework to support the various audio
subsystems and simplify the audio handling logic (timing, resampling, mixing
etc), as well as allow greater pipeline flexibility and customization.

While it's good to have a GStreamer backend to integrate well into systems already using that, this should not replace existing audio backends in QEMU. The reason is that GStreamer has extensive dependencies that I would like to avoid and still be able to use QEMU with just an ALSA or SDL audio backend that are much leaner and provide the needed functionality for most cases. Also when using jack you'd want to have a QEMU backend for it not going through multiple layers. So adding a GStreamer backend has its use as another audio backend but not as a replacement for QEMU's audio handling logic and backends.

Regards,
BALATON Zoltan

The preliminary patches consist of additional cleanups started in QEMU 10.2, in
order to make the code more modular and use QOM.

Finally, the last patch introduces the "audio" rust crate that implements the
GStreamer backend. See the TODO list in the commit message for the remaining or
related work items.

Please review and test!

Based-on: https://gitlab.com/bonzini/qemu.git rust-cargo
Requires meson from https://github.com/bonzini/meson.git cargo-object-full

Marc-André Lureau (24):
 rust: patch thiserror to work with meson
 audio: remove obsolete/obscure functions
 audio/dbus: make "dbus" the default backend when using -display dbus
 qemu-options.hx: clarify default audio backend selection
 audio: introduce AudioDriver
 audio: simplify audio_init()
 audio: move object creation to audio_driver_init()
 audio: add QOM module-objects for each backend
 audio: remove set_dbus_server from audio_driver
 audio: lookup "audio-" object types, and realize them
 audio: switch to module-object, drop audio driver registration
 module: remove audio module support
 audio: keep a strong reference on the backend
 audio: make list type declaration private
 audio: make create_pdos() private
 replay: remove dependency on audio/
 audio: make all the backend-specific APIs take the be
 audio: make AudioBackend truely abstract
 audio: split AudioBackend
 audio: AUD_ -> audio_be_
 audio-be: add common pre-conditions
 audio-be: add some state trace
 audio: split AudioDriver code in audio-driver.c
 WIP: rust/audio: add GStreamer backend

qapi/audio.json                               |   29 +
...dio_template.h => audio-driver_template.h} |   76 +-
audio/audio_int.h                             |   50 +-
include/qemu/audio-capture.h                  |   24 +-
include/qemu/audio.h                          |  129 +-
include/qemu/module.h                         |    3 +-
include/system/replay.h                       |    8 +-
replay/replay-internal.h                      |    2 +
rust/audio/wrapper.h                          |   27 +
audio/alsaaudio.c                             |   42 +-
audio/audio-be.c                              |  276 ++
audio/audio-driver.c                          | 1988 +++++++++++++++
audio/audio.c                                 | 2248 ++---------------
audio/dbusaudio.c                             |   57 +-
audio/dsoundaudio.c                           |   37 +-
audio/jackaudio.c                             |   37 +-
audio/noaudio.c                               |   37 +-
audio/ossaudio.c                              |   41 +-
audio/paaudio.c                               |   37 +-
audio/pwaudio.c                               |   37 +-
audio/sdlaudio.c                              |   37 +-
audio/sndioaudio.c                            |   37 +-
audio/spiceaudio.c                            |   37 +-
audio/wavaudio.c                              |   37 +-
audio/wavcapture.c                            |    7 +-
hw/audio/ac97.c                               |   42 +-
hw/audio/adlib.c                              |   29 +-
hw/audio/asc.c                                |   20 +-
hw/audio/cs4231a.c                            |   18 +-
hw/audio/es1370.c                             |   26 +-
hw/audio/gus.c                                |   11 +-
hw/audio/hda-codec.c                          |   26 +-
hw/audio/lm4549.c                             |   20 +-
hw/audio/pcspk.c                              |    8 +-
hw/audio/sb16.c                               |   22 +-
hw/audio/via-ac97.c                           |   20 +-
hw/audio/virtio-snd.c                         |   36 +-
hw/audio/wm8750.c                             |   42 +-
hw/display/xlnx_dp.c                          |   14 +-
hw/usb/dev-audio.c                            |   18 +-
replay/replay-audio.c                         |   51 +-
replay/replay.c                               |    2 +-
replay/stubs-system.c                         |    8 +-
ui/dbus.c                                     |   16 +-
ui/vnc.c                                      |    4 +-
Cargo.lock                                    |  572 ++++-
Cargo.toml                                    |    6 +
audio/coreaudio.m                             |   37 +-
audio/meson.build                             |    2 +
audio/trace-events                            |    9 +
qemu-options.hx                               |   20 +-
rust/audio/Cargo.toml                         |   29 +
rust/audio/build.rs                           |   49 +
rust/audio/meson.build                        |   75 +
rust/audio/src/audio.rs                       |  516 ++++
rust/audio/src/bindings.rs                    |   32 +
rust/audio/src/gstreamer.rs                   | 1070 ++++++++
rust/audio/src/lib.rs                         |   99 +
rust/meson.build                              |    6 +
.../packagefiles/syn-2-rs/meson/meson.build   |    3 +
.../thiserror-2.0.17-include.patch            |   14 +
.../thiserror-impl-2.0.17-include.patch       |   13 +
subprojects/syn-2-rs.wrap                     |   11 +-
subprojects/thiserror-2-rs.wrap               |   10 +
subprojects/thiserror-impl-2-rs.wrap          |   10 +
65 files changed, 5862 insertions(+), 2494 deletions(-)
rename audio/{audio_template.h => audio-driver_template.h} (90%)
create mode 100644 rust/audio/wrapper.h
create mode 100644 audio/audio-be.c
create mode 100644 audio/audio-driver.c
create mode 100644 rust/audio/Cargo.toml
create mode 100644 rust/audio/build.rs
create mode 100644 rust/audio/meson.build
create mode 100644 rust/audio/src/audio.rs
create mode 100644 rust/audio/src/bindings.rs
create mode 100644 rust/audio/src/gstreamer.rs
create mode 100644 rust/audio/src/lib.rs
create mode 100644 subprojects/packagefiles/syn-2-rs/meson/meson.build
create mode 100644 subprojects/packagefiles/thiserror-2.0.17-include.patch
create mode 100644 subprojects/packagefiles/thiserror-impl-2.0.17-include.patch
create mode 100644 subprojects/thiserror-2-rs.wrap
create mode 100644 subprojects/thiserror-impl-2-rs.wrap

Reply via email to