From 3e275580957815195d356408fbbcb891f9fe5777 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 24 Feb 2021 13:03:47 +0100 Subject: [PATCH] miniobject: add GST_TYPE_MINI_OBJECT Part-of: --- gst/gstminiobject.c | 13 +++++++++++++ gst/gstminiobject.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c index bc7aef07be..e980c89c40 100644 --- a/gst/gstminiobject.c +++ b/gst/gstminiobject.c @@ -59,6 +59,8 @@ #include "gst/gstinfo.h" #include +GType _gst_mini_object_type = 0; + /* Mutex used for weak referencing */ G_LOCK_DEFINE_STATIC (qdata_mutex); static GQuark weak_ref_quark; @@ -72,6 +74,14 @@ static GQuark weak_ref_quark; #define LOCK_MASK ((SHARE_ONE - 1) - FLAG_MASK) #define LOCK_FLAG_MASK (SHARE_ONE - 1) +/** + * GST_TYPE_MINI_OBJECT: + * + * The #GType associated with #GstMiniObject. + * + * Since: 1.20 + */ + /* For backwards compatibility reasons we use the * guint and gpointer in the GstMiniObject struct in * a rather complicated way to store the parent(s) and qdata. @@ -126,9 +136,12 @@ typedef struct #define QDATA_DATA(o,i) (QDATA(o,i).data) #define QDATA_DESTROY(o,i) (QDATA(o,i).destroy) +GST_DEFINE_MINI_OBJECT_TYPE (GstMiniObject, gst_mini_object); + void _priv_gst_mini_object_initialize (void) { + _gst_mini_object_type = gst_mini_object_get_type (); weak_ref_quark = g_quark_from_static_string ("GstMiniObjectWeakRefQuark"); } diff --git a/gst/gstminiobject.h b/gst/gstminiobject.h index b931e76e7a..f4dfa8d913 100644 --- a/gst/gstminiobject.h +++ b/gst/gstminiobject.h @@ -29,6 +29,10 @@ G_BEGIN_DECLS +GST_API GType _gst_mini_object_type; + +#define GST_TYPE_MINI_OBJECT (_gst_mini_object_type) + #define GST_IS_MINI_OBJECT_TYPE(obj,type) ((obj) && GST_MINI_OBJECT_TYPE(obj) == (type)) #define GST_MINI_OBJECT_CAST(obj) ((GstMiniObject*)(obj)) #define GST_MINI_OBJECT_CONST_CAST(obj) ((const GstMiniObject*)(obj)) @@ -36,6 +40,9 @@ G_BEGIN_DECLS typedef struct _GstMiniObject GstMiniObject; +GST_API +GType gst_mini_object_get_type (void); + /** * GstMiniObjectCopyFunction: * @obj: MiniObject to copy -- 2.34.1