* Function prototype for when a miniobject has lost its last refcount.
* Implementation of the mini object are allowed to revive the
* passed object by doing a gst_mini_object_ref(). If the object is not
- * revived after the dispose function, the memory associated with the
- * object is freed.
+ * revived after the dispose function, the function should return %TRUE
+ * and the memory associated with the object is freed.
+ *
+ * Returns: %TRUE if the object should be cleaned up.
*/
-typedef void (*GstMiniObjectDisposeFunction) (GstMiniObject *obj);
+typedef gboolean (*GstMiniObjectDisposeFunction) (GstMiniObject *obj);
/**
* GstMiniObjectFreeFunction:
* @obj: MiniObject to free
/**
* GstMiniObject:
- * @instance: type instance
* @refcount: atomic refcount
* @flags: extra flags.
* @copy: a copy function
} *weak_refs;
};
-GType gst_mini_object_register (const gchar *name);
-
void gst_mini_object_init (GstMiniObject *mini_object,
GType type, gsize size);
-GstMiniObject* gst_mini_object_copy (const GstMiniObject *mini_object);
-gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
-GstMiniObject* gst_mini_object_make_writable (GstMiniObject *mini_object);
+GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object);
+gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
+GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object);
/* refcounting */
-GstMiniObject* gst_mini_object_ref (GstMiniObject *mini_object);
-void gst_mini_object_unref (GstMiniObject *mini_object);
+GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object);
+void gst_mini_object_unref (GstMiniObject *mini_object);
-void gst_mini_object_weak_ref (GstMiniObject *object,
+void gst_mini_object_weak_ref (GstMiniObject *object,
GstMiniObjectWeakNotify notify,
gpointer data);
-void gst_mini_object_weak_unref (GstMiniObject *object,
+void gst_mini_object_weak_unref (GstMiniObject *object,
GstMiniObjectWeakNotify notify,
gpointer data);
-void gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
+gboolean gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
+gboolean gst_mini_object_take (GstMiniObject **olddata, GstMiniObject *newdata);
+GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata);
+#define GST_DEFINE_MINI_OBJECT_TYPE(TypeName,type_name) \
+ G_DEFINE_BOXED_TYPE(TypeName,type_name, \
+ (GBoxedCopyFunc) gst_mini_object_ref, \
+ (GBoxedFreeFunc)gst_mini_object_unref)
G_END_DECLS