miniobject: add GST_TYPE_MINI_OBJECT

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/764>
This commit is contained in:
Guillaume Desmottes 2021-02-24 13:03:47 +01:00
parent 670596abdb
commit 3e27558095
2 changed files with 20 additions and 0 deletions

View file

@ -59,6 +59,8 @@
#include "gst/gstinfo.h"
#include <gobject/gvaluecollector.h>
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");
}

View file

@ -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