From: Paolo Bonzini <pbonzini@redhat.com>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Cc: "BALATON Zoltan" <balaton@eik.bme.hu>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Volker Rümelin" <vr_qemu@t-online.de>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH 34/43] audio: rename AudioState -> AudioBE
Date: Tue, 21 Oct 2025 11:30:04 +0200 [thread overview]
Message-ID: <1bd34160-d034-465b-a1ac-0e734ed40484@redhat.com> (raw)
In-Reply-To: <20251021090317.425409-35-marcandre.lureau@redhat.com>
On 10/21/25 11:03, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Naming is hard. But in general in QEMU, a host "backend" is the term
> used to fullfill the request made by the device "frontend".
>
> Note that "audiodev" is the corresponding QAPI type name (or configuration).
BE and FE aren't used in existing code though. Looking at current use:
- BlockDriverState*/BlockBackend*
- Chardev*/CharBackend
- NetClientState*/NICState*
... it's actually quite common for the *frontend* to have a pointer or
object of type FooBackend; that would give Audiodev* and AudioBackend*.
Paolo
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/audio.h | 18 +++----
> audio/audio_int.h | 20 +++----
> audio/audio_template.h | 20 +++----
> ui/vnc.h | 2 +-
> audio/alsaaudio.c | 2 +-
> audio/audio-hmp-cmds.c | 2 +-
> audio/audio.c | 90 ++++++++++++++++----------------
> audio/dbusaudio.c | 8 +--
> audio/ossaudio.c | 4 +-
> audio/wavcapture.c | 2 +-
> hw/audio/pcspk.c | 2 +-
> hw/core/machine.c | 2 +-
> hw/core/qdev-properties-system.c | 6 +--
> ui/dbus.c | 8 +--
> ui/vnc.c | 10 ++--
> 15 files changed, 98 insertions(+), 98 deletions(-)
>
> diff --git a/audio/audio.h b/audio/audio.h
> index 1858b930ca..845e078169 100644
> --- a/audio/audio.h
> +++ b/audio/audio.h
> @@ -64,15 +64,15 @@ typedef struct SWVoiceOut SWVoiceOut;
> typedef struct CaptureVoiceOut CaptureVoiceOut;
> typedef struct SWVoiceIn SWVoiceIn;
>
> -typedef struct AudioStateClass AudioStateClass;
> -struct AudioStateClass {
> +typedef struct AudioBEClass AudioBEClass;
> +struct AudioBEClass {
> ObjectClass parent_class;
> };
>
> -typedef struct AudioState AudioState;
> +typedef struct AudioBE AudioBE;
> typedef struct QEMUSoundCard {
> char *name;
> - AudioState *state;
> + AudioBE *be;
> QLIST_ENTRY (QEMUSoundCard) entries;
> } QEMUSoundCard;
>
> @@ -83,7 +83,7 @@ typedef struct QEMUAudioTimeStamp {
> bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp);
> void AUD_remove_card (QEMUSoundCard *card);
> CaptureVoiceOut *AUD_add_capture(
> - AudioState *s,
> + AudioBE *s,
> struct audsettings *as,
> struct audio_capture_ops *ops,
> void *opaque
> @@ -154,14 +154,14 @@ void audio_create_default_audiodevs(void);
> 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);
> +AudioBE *audio_be_by_name(const char *name, Error **errp);
> +AudioBE *audio_get_default_audio_be(Error **errp);
> const char *audio_get_id(QEMUSoundCard *card);
>
> #define DEFINE_AUDIO_PROPERTIES(_s, _f) \
> DEFINE_PROP_AUDIODEV("audiodev", _s, _f)
>
> -#define TYPE_AUDIO_STATE "audio-state"
> -OBJECT_DECLARE_TYPE(AudioState, AudioStateClass, AUDIO_STATE)
> +#define TYPE_AUDIO_BE "audio-be"
> +OBJECT_DECLARE_TYPE(AudioBE, AudioBEClass, AUDIO_BE)
>
> #endif /* QEMU_AUDIO_H */
> diff --git a/audio/audio_int.h b/audio/audio_int.h
> index cc7a6fe087..d7e24ec089 100644
> --- a/audio/audio_int.h
> +++ b/audio/audio_int.h
> @@ -57,7 +57,7 @@ struct audio_pcm_info {
> int swap_endianness;
> };
>
> -typedef struct AudioState AudioState;
> +typedef struct AudioBE AudioBE;
> typedef struct SWVoiceCap SWVoiceCap;
>
> typedef struct STSampleBuffer {
> @@ -66,7 +66,7 @@ typedef struct STSampleBuffer {
> } STSampleBuffer;
>
> typedef struct HWVoiceOut {
> - AudioState *s;
> + AudioBE *s;
> int enabled;
> int poll_mode;
> int pending_disable;
> @@ -87,7 +87,7 @@ typedef struct HWVoiceOut {
> } HWVoiceOut;
>
> typedef struct HWVoiceIn {
> - AudioState *s;
> + AudioBE *s;
> int enabled;
> int poll_mode;
> struct audio_pcm_info info;
> @@ -109,7 +109,7 @@ typedef struct HWVoiceIn {
>
> struct SWVoiceOut {
> QEMUSoundCard *card;
> - AudioState *s;
> + AudioBE *s;
> struct audio_pcm_info info;
> t_sample *conv;
> STSampleBuffer resample_buf;
> @@ -126,7 +126,7 @@ struct SWVoiceOut {
>
> struct SWVoiceIn {
> QEMUSoundCard *card;
> - AudioState *s;
> + AudioBE *s;
> int active;
> struct audio_pcm_info info;
> void *rate;
> @@ -147,7 +147,7 @@ struct audio_driver {
> void *(*init) (Audiodev *, Error **);
> void (*fini) (void *);
> #ifdef CONFIG_GIO
> - void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager, bool p2p);
> + void (*set_dbus_server) (AudioBE *s, GDBusObjectManagerServer *manager, bool p2p);
> #endif
> struct audio_pcm_ops *pcm_ops;
> int max_voices_out;
> @@ -206,7 +206,7 @@ static inline void *advance (void *p, int incr)
> return (d + incr);
> }
>
> -int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
> +int wav_start_capture(AudioBE *state, CaptureState *s, const char *path,
> int freq, int bits, int nchannels);
>
> void audio_generic_run_buffer_in(HWVoiceIn *hw);
> @@ -238,7 +238,7 @@ struct SWVoiceCap {
> QLIST_ENTRY (SWVoiceCap) entries;
> };
>
> -typedef struct AudioState {
> +typedef struct AudioBE {
> Object parent;
>
> struct audio_driver *drv;
> @@ -258,7 +258,7 @@ typedef struct AudioState {
> bool timer_running;
> uint64_t timer_last;
> VMChangeStateEntry *vmse;
> -} AudioState;
> +} AudioBE;
>
> extern const struct mixeng_volume nominal_volume;
>
> @@ -271,7 +271,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
>
> int audio_bug (const char *funcname, int cond);
>
> -void audio_run(AudioState *s, const char *msg);
> +void audio_run(AudioBE *s, const char *msg);
>
> const char *audio_application_name(void);
>
> diff --git a/audio/audio_template.h b/audio/audio_template.h
> index c29d79c443..c8f3e9dc93 100644
> --- a/audio/audio_template.h
> +++ b/audio/audio_template.h
> @@ -36,7 +36,7 @@
> #define HWBUF hw->conv_buf
> #endif
>
> -static void glue(audio_init_nb_voices_, TYPE)(AudioState *s,
> +static void glue(audio_init_nb_voices_, TYPE)(AudioBE *s,
> struct audio_driver *drv, int min_voices)
> {
> int max_voices = glue (drv->max_voices_, TYPE);
> @@ -221,7 +221,7 @@ static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
> static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
> {
> HW *hw = *hwp;
> - AudioState *s = hw->s;
> + AudioBE *s = hw->s;
>
> if (!hw->sw_head.lh_first) {
> #ifdef DAC
> @@ -236,12 +236,12 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
> }
> }
>
> -static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioState *s, HW *hw)
> +static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioBE *s, HW *hw)
> {
> return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first;
> }
>
> -static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioState *s, HW *hw)
> +static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioBE *s, HW *hw)
> {
> while ((hw = glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) {
> if (hw->enabled) {
> @@ -251,7 +251,7 @@ static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioState *s, HW *hw)
> return NULL;
> }
>
> -static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioState *s, HW *hw,
> +static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioBE *s, HW *hw,
> struct audsettings *as)
> {
> while ((hw = glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) {
> @@ -262,7 +262,7 @@ static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioState *s, HW *hw,
> return NULL;
> }
>
> -static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s,
> +static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioBE *s,
> struct audsettings *as)
> {
> HW *hw;
> @@ -398,7 +398,7 @@ AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)(Audiodev *dev)
> abort();
> }
>
> -static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
> +static HW *glue(audio_pcm_hw_add_, TYPE)(AudioBE *s, struct audsettings *as)
> {
> HW *hw;
> AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
> @@ -424,7 +424,7 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
> }
>
> static SW *glue(audio_pcm_create_voice_pair_, TYPE)(
> - AudioState *s,
> + AudioBE *s,
> const char *sw_name,
> struct audsettings *as
> )
> @@ -494,7 +494,7 @@ SW *glue (AUD_open_, TYPE) (
> struct audsettings *as
> )
> {
> - AudioState *s;
> + AudioBE *s;
> AudiodevPerDirectionOptions *pdo;
>
> if (audio_bug(__func__, !card || !name || !callback_fn || !as)) {
> @@ -503,7 +503,7 @@ SW *glue (AUD_open_, TYPE) (
> goto fail;
> }
>
> - s = card->state;
> + s = card->be;
> pdo = glue(audio_get_pdo_, TYPE)(s->dev);
>
> ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
> diff --git a/ui/vnc.h b/ui/vnc.h
> index f2dab2f4d9..a6aac50ec3 100644
> --- a/ui/vnc.h
> +++ b/ui/vnc.h
> @@ -184,7 +184,7 @@ struct VncDisplay
> VncDisplaySASL sasl;
> #endif
>
> - AudioState *audio_state;
> + AudioBE *audio_be;
>
> VMChangeStateEntry *vmstate_handler_entry;
> };
> diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
> index 9b6c01c0ef..1c762e0e24 100644
> --- a/audio/alsaaudio.c
> +++ b/audio/alsaaudio.c
> @@ -41,7 +41,7 @@ struct pollhlp {
> struct pollfd *pfds;
> int count;
> int mask;
> - AudioState *s;
> + AudioBE *s;
> };
>
> typedef struct ALSAVoiceOut {
> diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c
> index 819f8fa9d8..f7a7d0c947 100644
> --- a/audio/audio-hmp-cmds.c
> +++ b/audio/audio-hmp-cmds.c
> @@ -67,7 +67,7 @@ void hmp_wavcapture(Monitor *mon, const QDict *qdict)
> const char *audiodev = qdict_get_str(qdict, "audiodev");
> CaptureState *s;
> Error *local_err = NULL;
> - AudioState *as = audio_state_by_name(audiodev, &local_err);
> + AudioBE *as = audio_be_by_name(audiodev, &local_err);
>
> if (!as) {
> error_report_err(local_err);
> diff --git a/audio/audio.c b/audio/audio.c
> index 9e6d79b4e3..66a2e86f13 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -99,7 +99,7 @@ static audio_driver *audio_driver_lookup(const char *name)
> return NULL;
> }
>
> -static AudioState *default_audio_state;
> +static AudioBE *default_audio_be;
>
> const struct mixeng_volume nominal_volume = {
> .mute = 0,
> @@ -380,7 +380,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len)
> /*
> * Capture
> */
> -static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioState *s,
> +static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioBE *s,
> struct audsettings *as)
> {
> CaptureVoiceOut *cap;
> @@ -460,7 +460,7 @@ static void audio_detach_capture (HWVoiceOut *hw)
>
> static int audio_attach_capture (HWVoiceOut *hw)
> {
> - AudioState *s = hw->s;
> + AudioBE *s = hw->s;
> CaptureVoiceOut *cap;
>
> audio_detach_capture (hw);
> @@ -798,7 +798,7 @@ static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *info)
> /*
> * Timer
> */
> -static int audio_is_timer_needed(AudioState *s)
> +static int audio_is_timer_needed(AudioBE *s)
> {
> HWVoiceIn *hwi = NULL;
> HWVoiceOut *hwo = NULL;
> @@ -816,7 +816,7 @@ static int audio_is_timer_needed(AudioState *s)
> return 0;
> }
>
> -static void audio_reset_timer (AudioState *s)
> +static void audio_reset_timer (AudioBE *s)
> {
> if (audio_is_timer_needed(s)) {
> timer_mod_anticipate_ns(s->ts,
> @@ -838,7 +838,7 @@ static void audio_reset_timer (AudioState *s)
> static void audio_timer (void *opaque)
> {
> int64_t now, diff;
> - AudioState *s = opaque;
> + AudioBE *s = opaque;
>
> now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
> diff = now - s->timer_last;
> @@ -921,7 +921,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on)
>
> hw = sw->hw;
> if (sw->active != on) {
> - AudioState *s = sw->s;
> + AudioBE *s = sw->s;
> SWVoiceOut *temp_sw;
> SWVoiceCap *sc;
>
> @@ -969,7 +969,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on)
>
> hw = sw->hw;
> if (sw->active != on) {
> - AudioState *s = sw->s;
> + AudioBE *s = sw->s;
> SWVoiceIn *temp_sw;
>
> if (on) {
> @@ -1137,7 +1137,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live)
> return clipped;
> }
>
> -static void audio_run_out (AudioState *s)
> +static void audio_run_out (AudioBE *s)
> {
> HWVoiceOut *hw = NULL;
> SWVoiceOut *sw;
> @@ -1291,7 +1291,7 @@ static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size_t samples)
> return conv;
> }
>
> -static void audio_run_in (AudioState *s)
> +static void audio_run_in (AudioBE *s)
> {
> HWVoiceIn *hw = NULL;
>
> @@ -1339,7 +1339,7 @@ static void audio_run_in (AudioState *s)
> }
> }
>
> -static void audio_run_capture (AudioState *s)
> +static void audio_run_capture (AudioBE *s)
> {
> CaptureVoiceOut *cap;
>
> @@ -1386,7 +1386,7 @@ static void audio_run_capture (AudioState *s)
> }
> }
>
> -void audio_run(AudioState *s, const char *msg)
> +void audio_run(AudioBE *s, const char *msg)
> {
> audio_run_out(s);
> audio_run_in(s);
> @@ -1559,7 +1559,7 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size)
> return total;
> }
>
> -static bool audio_driver_init(AudioState *s, struct audio_driver *drv,
> +static bool audio_driver_init(AudioBE *s, struct audio_driver *drv,
> Audiodev *dev, Error **errp)
> {
> s->drv_opaque = drv->init(dev, errp);
> @@ -1592,7 +1592,7 @@ static bool audio_driver_init(AudioState *s, struct audio_driver *drv,
> static void audio_vm_change_state_handler (void *opaque, bool running,
> RunState state)
> {
> - AudioState *s = opaque;
> + AudioBE *s = opaque;
> HWVoiceOut *hwo = NULL;
> HWVoiceIn *hwi = NULL;
>
> @@ -1613,9 +1613,9 @@ static void audio_vm_change_state_handler (void *opaque, bool running,
>
> static const VMStateDescription vmstate_audio;
>
> -static void audio_state_init(Object *obj)
> +static void audio_be_init(Object *obj)
> {
> - AudioState *s = AUDIO_STATE(obj);
> + AudioBE *s = AUDIO_BE(obj);
>
> QLIST_INIT (&s->hw_head_out);
> QLIST_INIT (&s->hw_head_in);
> @@ -1629,9 +1629,9 @@ static void audio_state_init(Object *obj)
> vmstate_register_any(NULL, &vmstate_audio, s);
> }
>
> -static void audio_state_finalize(Object *obj)
> +static void audio_be_finalize(Object *obj)
> {
> - AudioState *s = AUDIO_STATE(obj);
> + AudioBE *s = AUDIO_BE(obj);
> HWVoiceOut *hwo, *hwon;
> HWVoiceIn *hwi, *hwin;
>
> @@ -1692,7 +1692,7 @@ static Object *get_audiodevs_root(void)
>
> void audio_cleanup(void)
> {
> - default_audio_state = NULL;
> + default_audio_be = NULL;
>
> object_unparent(get_audiodevs_root());
> }
> @@ -1743,14 +1743,14 @@ void audio_create_default_audiodevs(void)
> * if dev == NULL => legacy implicit initialization, return the already created
> * state or create a new one
> */
> -static AudioState *audio_init(Audiodev *dev, Error **errp)
> +static AudioBE *audio_init(Audiodev *dev, Error **errp)
> {
> int done = 0;
> const char *drvname;
> - AudioState *s;
> + AudioBE *s;
> struct audio_driver *driver;
>
> - s = AUDIO_STATE(object_new(TYPE_AUDIO_STATE));
> + s = AUDIO_BE(object_new(TYPE_AUDIO_BE));
>
> if (dev) {
> /* -audiodev option */
> @@ -1766,7 +1766,7 @@ static AudioState *audio_init(Audiodev *dev, Error **errp)
> goto out;
> }
> } else {
> - assert(!default_audio_state);
> + assert(!default_audio_be);
> for (;;) {
> AudiodevListEntry *e = QSIMPLEQ_FIRST(&default_audiodevs);
> if (!e) {
> @@ -1797,11 +1797,11 @@ out:
> return NULL;
> }
>
> -AudioState *audio_get_default_audio_state(Error **errp)
> +AudioBE *audio_get_default_audio_be(Error **errp)
> {
> - if (!default_audio_state) {
> - default_audio_state = audio_init(NULL, errp);
> - if (!default_audio_state) {
> + if (!default_audio_be) {
> + default_audio_be = audio_init(NULL, errp);
> + if (!default_audio_be) {
> if (!QSIMPLEQ_EMPTY(&audiodevs)) {
> error_append_hint(errp, "Perhaps you wanted to use -audio or set audiodev=%s?\n",
> QSIMPLEQ_FIRST(&audiodevs)->dev->id);
> @@ -1809,21 +1809,21 @@ AudioState *audio_get_default_audio_state(Error **errp)
> }
> }
>
> - return default_audio_state;
> + return default_audio_be;
> }
>
> bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
> {
> - if (!card->state) {
> - card->state = audio_get_default_audio_state(errp);
> - if (!card->state) {
> + if (!card->be) {
> + card->be = audio_get_default_audio_be(errp);
> + if (!card->be) {
> return false;
> }
> }
>
> card->name = g_strdup (name);
> memset (&card->entries, 0, sizeof (card->entries));
> - QLIST_INSERT_HEAD(&card->state->card_head, card, entries);
> + QLIST_INSERT_HEAD(&card->be->card_head, card, entries);
>
> return true;
> }
> @@ -1837,7 +1837,7 @@ void AUD_remove_card (QEMUSoundCard *card)
> static struct audio_pcm_ops capture_pcm_ops;
>
> CaptureVoiceOut *AUD_add_capture(
> - AudioState *s,
> + AudioBE *s,
> struct audsettings *as,
> struct audio_capture_ops *ops,
> void *cb_opaque
> @@ -2220,7 +2220,7 @@ int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo,
> audioformat_bytes_per_sample(as->fmt);
> }
>
> -AudioState *audio_state_by_name(const char *name, Error **errp)
> +AudioBE *audio_be_by_name(const char *name, Error **errp)
> {
> Object *obj = object_resolve_path_component(get_audiodevs_root(), name);
>
> @@ -2228,15 +2228,15 @@ AudioState *audio_state_by_name(const char *name, Error **errp)
> error_setg(errp, "audiodev '%s' not found", name);
> return NULL;
> } else {
> - return AUDIO_STATE(obj);
> + return AUDIO_BE(obj);
> }
> }
>
> const char *audio_get_id(QEMUSoundCard *card)
> {
> - if (card->state) {
> - assert(card->state->dev);
> - return card->state->dev->id;
> + if (card->be) {
> + assert(card->be->dev);
> + return card->be->dev->id;
> } else {
> return "";
> }
> @@ -2305,19 +2305,19 @@ AudiodevList *qmp_query_audiodevs(Error **errp)
> return ret;
> }
>
> -static const TypeInfo audio_state_info = {
> - .name = TYPE_AUDIO_STATE,
> +static const TypeInfo audio_be_info = {
> + .name = TYPE_AUDIO_BE,
> .parent = TYPE_OBJECT,
> - .instance_size = sizeof(AudioState),
> - .instance_init = audio_state_init,
> - .instance_finalize = audio_state_finalize,
> + .instance_size = sizeof(AudioBE),
> + .instance_init = audio_be_init,
> + .instance_finalize = audio_be_finalize,
> .abstract = false, // todo, subclass and make it abstract
> - .class_size = sizeof(AudioStateClass),
> + .class_size = sizeof(AudioBEClass),
> };
>
> static void register_types(void)
> {
> - type_register_static(&audio_state_info);
> + type_register_static(&audio_be_info);
> }
>
> type_init(register_types);
> diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
> index 908214a170..873f76a89e 100644
> --- a/audio/dbusaudio.c
> +++ b/audio/dbusaudio.c
> @@ -458,7 +458,7 @@ listener_in_vanished_cb(GDBusConnection *connection,
> }
>
> static gboolean
> -dbus_audio_register_listener(AudioState *s,
> +dbus_audio_register_listener(AudioBE *s,
> GDBusMethodInvocation *invocation,
> #ifdef G_OS_UNIX
> GUnixFDList *fd_list,
> @@ -615,7 +615,7 @@ dbus_audio_register_listener(AudioState *s,
> }
>
> static gboolean
> -dbus_audio_register_out_listener(AudioState *s,
> +dbus_audio_register_out_listener(AudioBE *s,
> GDBusMethodInvocation *invocation,
> #ifdef G_OS_UNIX
> GUnixFDList *fd_list,
> @@ -631,7 +631,7 @@ dbus_audio_register_out_listener(AudioState *s,
> }
>
> static gboolean
> -dbus_audio_register_in_listener(AudioState *s,
> +dbus_audio_register_in_listener(AudioBE *s,
> GDBusMethodInvocation *invocation,
> #ifdef G_OS_UNIX
> GUnixFDList *fd_list,
> @@ -646,7 +646,7 @@ dbus_audio_register_in_listener(AudioState *s,
> }
>
> static void
> -dbus_audio_set_server(AudioState *s, GDBusObjectManagerServer *server, bool p2p)
> +dbus_audio_set_server(AudioBE *s, GDBusObjectManagerServer *server, bool p2p)
> {
> DBusAudio *da = s->drv_opaque;
>
> diff --git a/audio/ossaudio.c b/audio/ossaudio.c
> index c5858284a1..f202e743ff 100644
> --- a/audio/ossaudio.c
> +++ b/audio/ossaudio.c
> @@ -107,13 +107,13 @@ static void oss_anal_close (int *fdp)
>
> static void oss_helper_poll_out (void *opaque)
> {
> - AudioState *s = opaque;
> + AudioBE *s = opaque;
> audio_run(s, "oss_poll_out");
> }
>
> static void oss_helper_poll_in (void *opaque)
> {
> - AudioState *s = opaque;
> + AudioBE *s = opaque;
> audio_run(s, "oss_poll_in");
> }
>
> diff --git a/audio/wavcapture.c b/audio/wavcapture.c
> index 0fbc695d23..55ba0906a2 100644
> --- a/audio/wavcapture.c
> +++ b/audio/wavcapture.c
> @@ -103,7 +103,7 @@ static struct capture_ops wav_capture_ops = {
> .info = wav_capture_info
> };
>
> -int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
> +int wav_start_capture(AudioBE *state, CaptureState *s, const char *path,
> int freq, int bits, int nchannels)
> {
> WAVState *wav;
> diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
> index c8c63b7915..e9ab5ac41b 100644
> --- a/hw/audio/pcspk.c
> +++ b/hw/audio/pcspk.c
> @@ -188,7 +188,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
>
> isa_register_ioport(isadev, &s->ioport, s->iobase);
>
> - if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) {
> + if (s->card.be && AUD_register_card(s_spk, &s->card, errp)) {
> pcspk_audio_init(s);
> }
> }
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 681adbb7ac..2de8b89606 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -763,7 +763,7 @@ static void machine_set_audiodev(Object *obj, const char *value,
> {
> MachineState *ms = MACHINE(obj);
>
> - if (!audio_state_by_name(value, errp)) {
> + if (!audio_be_by_name(value, errp)) {
> return;
> }
>
> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
> index 1f810b7ddf..be682895f7 100644
> --- a/hw/core/qdev-properties-system.c
> +++ b/hw/core/qdev-properties-system.c
> @@ -499,16 +499,16 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name,
> {
> const Property *prop = opaque;
> QEMUSoundCard *card = object_field_prop_ptr(obj, prop);
> - AudioState *state;
> + AudioBE *state;
> g_autofree char *str = NULL;
>
> if (!visit_type_str(v, name, &str, errp)) {
> return;
> }
>
> - state = audio_state_by_name(str, errp);
> + state = audio_be_by_name(str, errp);
> if (state) {
> - card->state = state;
> + card->be = state;
> }
> }
>
> diff --git a/ui/dbus.c b/ui/dbus.c
> index dd0336702d..962b4a8c1e 100644
> --- a/ui/dbus.c
> +++ b/ui/dbus.c
> @@ -220,16 +220,16 @@ dbus_display_complete(UserCreatable *uc, Error **errp)
> }
>
> if (dd->audiodev && *dd->audiodev) {
> - AudioState *audio_state = audio_state_by_name(dd->audiodev, errp);
> - if (!audio_state) {
> + AudioBE *audio_be = audio_be_by_name(dd->audiodev, errp);
> + if (!audio_be) {
> return;
> }
> - if (!g_str_equal(audio_state->drv->name, "dbus")) {
> + if (!g_str_equal(audio_be->drv->name, "dbus")) {
> error_setg(errp, "Audiodev '%s' is not compatible with DBus",
> dd->audiodev);
> return;
> }
> - audio_state->drv->set_dbus_server(audio_state, dd->server, dd->p2p);
> + audio_be->drv->set_dbus_server(audio_be, dd->server, dd->p2p);
> }
>
> consoles = g_array_new(FALSE, FALSE, sizeof(guint32));
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 77c823bf2e..0094ec680c 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -1276,7 +1276,7 @@ static void audio_add(VncState *vs)
> ops.destroy = audio_capture_destroy;
> ops.capture = audio_capture;
>
> - vs->audio_cap = AUD_add_capture(vs->vd->audio_state, &vs->as, &ops, vs);
> + vs->audio_cap = AUD_add_capture(vs->vd->audio_be, &vs->as, &ops, vs);
> if (!vs->audio_cap) {
> error_report("Failed to add audio capture");
> }
> @@ -2193,7 +2193,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
> send_ext_key_event_ack(vs);
> break;
> case VNC_ENCODING_AUDIO:
> - if (vs->vd->audio_state) {
> + if (vs->vd->audio_be) {
> vnc_set_feature(vs, VNC_FEATURE_AUDIO);
> send_ext_audio_ack(vs);
> }
> @@ -4236,12 +4236,12 @@ void vnc_display_open(const char *id, Error **errp)
>
> audiodev = qemu_opt_get(opts, "audiodev");
> if (audiodev) {
> - vd->audio_state = audio_state_by_name(audiodev, errp);
> - if (!vd->audio_state) {
> + vd->audio_be = audio_be_by_name(audiodev, errp);
> + if (!vd->audio_be) {
> goto fail;
> }
> } else {
> - vd->audio_state = audio_get_default_audio_state(NULL);
> + vd->audio_be = audio_get_default_audio_be(NULL);
> }
>
> device_id = qemu_opt_get(opts, "display");
next prev parent reply other threads:[~2025-10-21 9:30 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 9:02 [PATCH 00/43] Audio clean-ups marcandre.lureau
2025-10-21 9:02 ` [PATCH 01/43] hw/audio: improve error reports marcandre.lureau
2025-10-21 13:06 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 02/43] hw/audio: rename model list function marcandre.lureau
2025-10-21 10:04 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 03/43] hw/audio: remove global pcspk marcandre.lureau
2025-10-21 9:49 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 04/43] hw/pcspk: use explicitly the required PIT types marcandre.lureau
2025-10-21 9:50 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 05/43] hw/pcspk: make 'pit' a class property marcandre.lureau
2025-10-21 17:45 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 06/43] hw/pcspk: check the "pit" is set marcandre.lureau
2025-10-21 9:51 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 07/43] docs: update -soundhw -> -device list marcandre.lureau
2025-10-21 11:27 ` Thomas Huth
2025-10-21 9:02 ` [PATCH 08/43] qdev: add qdev_find_default_bus() marcandre.lureau
2025-10-21 11:22 ` BALATON Zoltan
2025-10-21 11:28 ` Marc-André Lureau
2025-10-21 9:02 ` [PATCH 09/43] hw/audio: look up the default bus from the device class marcandre.lureau
2025-10-21 9:02 ` [PATCH 10/43] audio: rename audio_define->audio_add_audiodev() marcandre.lureau
2025-10-21 9:52 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 11/43] hw/audio: use better naming for -audio model handling code marcandre.lureau
2025-10-21 9:02 ` [PATCH 12/43] hw/audio/virtio-snd-pci: remove custom model callback marcandre.lureau
2025-10-21 9:02 ` [PATCH 13/43] hw/audio: simplify 'hda' audio init code marcandre.lureau
2025-10-21 9:02 ` [PATCH 14/43] hw/audio: generalize audio_model.init() marcandre.lureau
2025-10-21 9:02 ` [PATCH 15/43] hw/audio: drop audio_model.isa marcandre.lureau
2025-10-21 17:47 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 16/43] audio: start making AudioState a QOM Object marcandre.lureau
2025-10-21 9:56 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 17/43] audio: register backends in /audiodevs container marcandre.lureau
2025-10-21 9:57 ` Philippe Mathieu-Daudé
2025-10-21 9:59 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 18/43] audio: use /audiodevs qom container marcandre.lureau
2025-10-21 9:02 ` [PATCH 19/43] audio/paaudio: remove needless return value marcandre.lureau
2025-10-21 9:59 ` Philippe Mathieu-Daudé
2025-10-21 9:02 ` [PATCH 20/43] audio/dsound: simplify init() marcandre.lureau
2025-10-21 9:02 ` [PATCH 21/43] audio/dsound: report init error via **errp marcandre.lureau
2025-10-21 9:02 ` [PATCH 22/43] audio: simplify audio_driver_init() marcandre.lureau
2025-10-21 9:02 ` [PATCH 23/43] audio: move period tick initialization marcandre.lureau
2025-10-21 9:02 ` [PATCH 24/43] audio: drop needless error message marcandre.lureau
2025-10-21 9:02 ` [PATCH 25/43] audio: clean-up vmstate change handler on finalize marcandre.lureau
2025-10-21 9:02 ` [PATCH 26/43] audio: unregister vmstate description marcandre.lureau
2025-10-21 9:02 ` [PATCH 27/43] audio: initialize card_head during object init marcandre.lureau
2025-10-21 9:02 ` [PATCH 28/43] audio: remove some needless headers marcandre.lureau
2025-10-21 9:03 ` [PATCH 29/43] audio: remove AUDIO_HOST_ENDIANNESS marcandre.lureau
2025-10-21 9:03 ` [PATCH 30/43] audio: introduce AUD_set_volume_{in,out}_lr() marcandre.lureau
2025-10-21 9:03 ` [PATCH 31/43] hw/audio: replace AUD_log() usage marcandre.lureau
2025-10-21 10:01 ` Philippe Mathieu-Daudé
2025-10-21 9:03 ` [PATCH 32/43] audio/replay: fix type punning marcandre.lureau
2025-10-21 9:03 ` [PATCH 33/43] audio: move internal APIs to audio_int.h marcandre.lureau
2025-10-21 9:03 ` [PATCH 34/43] audio: rename AudioState -> AudioBE marcandre.lureau
2025-10-21 9:30 ` Paolo Bonzini [this message]
2025-10-21 9:40 ` Paolo Bonzini
2025-10-21 10:03 ` Philippe Mathieu-Daudé
2025-10-21 10:40 ` Marc-André Lureau
2025-10-21 10:48 ` Paolo Bonzini
2025-10-21 12:50 ` Marc-André Lureau
2025-10-21 12:58 ` BALATON Zoltan
2025-10-21 12:08 ` BALATON Zoltan
2025-10-21 9:03 ` [PATCH 35/43] audio: rename QEMUSoundCard -> AudioFE marcandre.lureau
2025-10-21 12:11 ` BALATON Zoltan
2025-10-21 12:29 ` Marc-André Lureau
2025-10-21 12:49 ` BALATON Zoltan
2025-10-21 13:06 ` Marc-André Lureau
2025-10-24 11:50 ` Daniel P. Berrangé
2025-10-21 9:03 ` [PATCH 36/43] audio: rename audio_get_id() marcandre.lureau
2025-10-21 9:03 ` [PATCH 37/43] audio/dbus: use a helper function to set the backend dbus server marcandre.lureau
2025-10-21 9:03 ` [PATCH 38/43] audio: move audio.h under include/qemu/ marcandre.lureau
2025-10-23 6:00 ` Akihiko Odaki
2025-10-21 9:03 ` [PATCH 39/43] audio: remove dependency on spice header marcandre.lureau
2025-10-21 9:03 ` [PATCH 40/43] audio: cleanup, use bool for booleans marcandre.lureau
2025-10-21 9:03 ` [PATCH 41/43] audio: drop needless list of FE marcandre.lureau
2025-10-21 9:03 ` [PATCH 42/43] audio: move capture API to own header marcandre.lureau
2025-10-21 9:03 ` [PATCH 43/43] audio: drop needless audio_driver "descr" field marcandre.lureau
2025-10-23 5:58 ` Akihiko Odaki
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=1bd34160-d034-465b-a1ac-0e734ed40484@redhat.com \
--to=pbonzini@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=vr_qemu@t-online.de \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/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).