memory: make GstAllocator a miniobject
[platform/upstream/gstreamer.git] / gst / gstmemory.h
index 219831f..701249d 100644 (file)
@@ -43,6 +43,12 @@ typedef struct _GstMemoryInfo GstMemoryInfo;
 typedef struct _GstAllocator GstAllocator;
 typedef struct _GstAllocationParams GstAllocationParams;
 
+/**
+ * gst_memory_alignment:
+ *
+ * The default memory alignment in bytes - 1
+ * an alignment of 7 would be the same as what malloc() guarantees.
+ */
 GST_EXPORT gsize gst_memory_alignment;
 
 #define GST_MEMORY_CAST(mem)   ((GstMemory *)(mem))
@@ -181,6 +187,11 @@ typedef struct {
   gpointer user_data[4];
 } GstMapInfo;
 
+/**
+ * GST_MAP_INFO_INIT:
+ *
+ * Initializer for #GstMapInfo
+ */
 #define GST_MAP_INFO_INIT { NULL, 0, NULL, 0, 0, }
 
 /**
@@ -345,13 +356,51 @@ struct _GstMemoryInfo {
   gpointer _gst_reserved[GST_PADDING];
 };
 
+/**
+ * GstAllocator:
+ *
+ * An opaque type returned from gst_allocator_new() or gst_allocator_find()
+ * that can be used to allocator memory.
+ */
+
 /* allocators */
 GstAllocator * gst_allocator_new             (const GstMemoryInfo * info,
                                               gpointer user_data, GDestroyNotify notify);
 const gchar *  gst_allocator_get_memory_type (GstAllocator * allocator);
 
-GstAllocator * gst_allocator_ref             (GstAllocator * allocator);
-void           gst_allocator_unref           (GstAllocator * allocator);
+/**
+ * gst_allocator_ref:
+ * @allocator: The allocator to refcount
+ *
+ * Increase the refcount of this allocator.
+ *
+ * Returns: (transfer full): @allocator (for convenience when doing assignments)
+ */
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC GstAllocator * gst_allocator_ref (GstAllocator * allocator);
+#endif
+
+static inline GstAllocator *
+gst_allocator_ref (GstAllocator * allocator)
+{
+  return (GstAllocator *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (allocator));
+}
+
+/**
+ * gst_allocator_unref:
+ * @allocator: (transfer full): the allocator to refcount
+ *
+ * Decrease the refcount of an allocator, freeing it if the refcount reaches 0.
+ */
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC void gst_allocator_unref (GstAllocator * allocator);
+#endif
+
+static inline void
+gst_allocator_unref (GstAllocator * allocator)
+{
+  gst_mini_object_unref (GST_MINI_OBJECT_CAST (allocator));
+}
 
 void           gst_allocator_register        (const gchar *name, GstAllocator *allocator);
 GstAllocator * gst_allocator_find            (const gchar *name);