* GstMiniObjectFreeFunction:
* @obj: MiniObject to free
*
- * Virtual function prototype for methods to free ressources used by
+ * Virtual function prototype for methods to free resources used by
* mini-objects.
*/
typedef void (*GstMiniObjectFreeFunction) (GstMiniObject *obj);
* @obj: MiniObject to unset flag in.
* @flag: Flag to set, must be a single bit in guint32.
*
- * This macro usets the given bits.
+ * This macro unsets the given bits.
*/
#define GST_MINI_OBJECT_FLAG_UNSET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
* gst_mini_object_lock() and gst_mini_object_unlock().
* @GST_MINI_OBJECT_FLAG_LOCK_READONLY: the object is permanently locked in
* READONLY mode. Only read locks can be performed on the object.
+ * @GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED: the object is expected to stay alive
+ * even after gst_deinit() has been called and so should be ignored by leak
+ * detection tools. (Since 1.10)
* @GST_MINI_OBJECT_FLAG_LAST: first flag that can be used by subclasses.
*
* Flags for the mini object
{
GST_MINI_OBJECT_FLAG_LOCKABLE = (1 << 0),
GST_MINI_OBJECT_FLAG_LOCK_READONLY = (1 << 1),
+ GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED = (1 << 2),
/* padding */
GST_MINI_OBJECT_FLAG_LAST = (1 << 4)
} GstMiniObjectFlags;
} GstLockFlags;
/**
- * GST_LOCK_FLAG_READWRITE:
+ * GST_LOCK_FLAG_READWRITE: (value 3) (type GstLockFlags)
*
* GstLockFlags value alias for GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE
*/
-#define GST_LOCK_FLAG_READWRITE (GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE)
+#define GST_LOCK_FLAG_READWRITE ((GstLockFlags) (GST_LOCK_FLAG_READ | GST_LOCK_FLAG_WRITE))
/**
* GST_MINI_OBJECT_REFCOUNT:
#define GST_MINI_OBJECT_REFCOUNT_VALUE(obj) (g_atomic_int_get (&(GST_MINI_OBJECT_CAST(obj))->refcount))
/**
- * GstMiniObject:
+ * GstMiniObject: (ref-func gst_mini_object_ref) (unref-func gst_mini_object_unref) (set-value-func g_value_set_boxed) (get-value-func g_value_get_boxed)
* @type: the GType of the object
* @refcount: atomic refcount
* @lockstate: atomic state of the locks
* @free: the free function
*
* Base class for refcounted lightweight objects.
- * Ref Func: gst_mini_object_ref
- * Unref Func: gst_mini_object_unref
- * Set Value Func: g_value_set_boxed
- * Get Value Func: g_value_get_boxed
*/
struct _GstMiniObject {
GType type;
GstMiniObjectFreeFunction free;
/* < private > */
- /* Used to keep track of weak ref notifies and qdata */
- guint n_qdata;
- gpointer qdata;
+ /* Used to keep track of parents, weak ref notifies and qdata */
+ guint priv_uint;
+ gpointer priv_pointer;
};
+GST_API
void gst_mini_object_init (GstMiniObject *mini_object,
guint flags, GType type,
GstMiniObjectCopyFunction copy_func,
/* refcounting */
+
+GST_API
GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object);
+
+GST_API
void gst_mini_object_unref (GstMiniObject *mini_object);
+GST_API
+void gst_clear_mini_object (volatile GstMiniObject **object_ptr);
+#define gst_clear_mini_object(object_ptr) g_clear_pointer ((object_ptr), gst_mini_object_unref)
+
+GST_API
void gst_mini_object_weak_ref (GstMiniObject *object,
GstMiniObjectNotify notify,
gpointer data);
+GST_API
void gst_mini_object_weak_unref (GstMiniObject *object,
GstMiniObjectNotify notify,
gpointer data);
/* locking */
+
+GST_API
gboolean gst_mini_object_lock (GstMiniObject *object, GstLockFlags flags);
+
+GST_API
void gst_mini_object_unlock (GstMiniObject *object, GstLockFlags flags);
+GST_API
gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
-GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object);
+
+GST_API
+GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object) G_GNUC_WARN_UNUSED_RESULT;
/* copy */
-GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object) G_GNUC_MALLOC;
+
+GST_API
+GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GST_API
void gst_mini_object_set_qdata (GstMiniObject *object, GQuark quark,
gpointer data, GDestroyNotify destroy);
+GST_API
gpointer gst_mini_object_get_qdata (GstMiniObject *object, GQuark quark);
+
+GST_API
gpointer gst_mini_object_steal_qdata (GstMiniObject *object, GQuark quark);
+GST_API
+void gst_mini_object_add_parent (GstMiniObject *object, GstMiniObject *parent);
+GST_API
+void gst_mini_object_remove_parent (GstMiniObject *object, GstMiniObject *parent);
+GST_API
gboolean gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
+
+GST_API
gboolean gst_mini_object_take (GstMiniObject **olddata, GstMiniObject *newdata);
-GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata);
+
+GST_API
+GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata) G_GNUC_WARN_UNUSED_RESULT;
/**
* GST_DEFINE_MINI_OBJECT_TYPE: