On Mon, 27 Oct 2025, [email protected] wrote:
From: Marc-André Lureau <[email protected]>
QOM brings some conveniences for introspection, type checking, reference
counting, interfaces etc. This is only the first step to introduce QOM
in audio/ (I have more in the pipeline)
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
---
audio/audio.h | 7 +++++++
audio/audio_int.h | 2 ++
audio/audio.c | 43 ++++++++++++++++++++++++++++++++-----------
3 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/audio/audio.h b/audio/audio.h
index eb5b5d662d..e41c5bc55a 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -80,6 +80,10 @@ typedef struct SWVoiceOut SWVoiceOut;
typedef struct CaptureVoiceOut CaptureVoiceOut;
typedef struct SWVoiceIn SWVoiceIn;
+struct AudioStateClass {
+ ObjectClass parent_class;
+};
+
typedef struct AudioState AudioState;
typedef struct QEMUSoundCard {
char *name;
@@ -182,4 +186,7 @@ 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)
+
#endif /* QEMU_AUDIO_H */
diff --git a/audio/audio_int.h b/audio/audio_int.h
index f78ca05f92..b2b4d2d10e 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -217,6 +217,8 @@ struct SWVoiceCap {
};
typedef struct AudioState {
+ Object parent;
Coding style says parent_obj, not sure other names are acceptable.
Regards,
BALATON Zoltan