miniobjects: pass copy, dispose and free function to gst_mini_object_init()
[platform/upstream/gstreamer.git] / gst / gstsample.c
index 3a09460..4e4a36b 100644 (file)
  *
  * A #GstSample is a small object containing data, a type, timing and
  * extra arbitrary information.
+ *
+ * Last reviewed on 2012-03-29 (0.11.3)
  */
 #include "gst_private.h"
 
 #include "gstsample.h"
 
-/**
- * GstSample:
- *
- */
 struct _GstSample
 {
   GstMiniObject mini_object;
@@ -76,11 +74,17 @@ _gst_sample_free (GstSample * sample)
   if (sample->caps)
     gst_caps_unref (sample->caps);
 
-  g_slice_free1 (GST_MINI_OBJECT_SIZE (sample), sample);
+  g_slice_free1 (sizeof (GstSample), sample);
 }
 
 /**
  * gst_sample_new:
+ * @buffer: (transfer none) (allow-none): a #GstBuffer, or NULL
+ * @caps: (transfer none) (allow-none): a #GstCaps, or NULL
+ * @segment: transfer none) (allow-none): a #GstSegment, or NULL
+ * @info: (transfer full) (allow-none): a #GstStructure, or NULL
+ *
+ * Create a new #GstSample with the provided details.
  *
  * Free-function: gst_sample_unref
  *
@@ -100,10 +104,8 @@ gst_sample_new (GstBuffer * buffer, GstCaps * caps, const GstSegment * segment,
   GST_LOG ("new %p", sample);
 
   gst_mini_object_init (GST_MINI_OBJECT_CAST (sample), _gst_sample_type,
-      sizeof (GstSample));
-
-  sample->mini_object.copy = (GstMiniObjectCopyFunction) _gst_sample_copy;
-  sample->mini_object.free = (GstMiniObjectFreeFunction) _gst_sample_free;
+      (GstMiniObjectCopyFunction) _gst_sample_copy, NULL,
+      (GstMiniObjectFreeFunction) _gst_sample_free);
 
   sample->buffer = buffer ? gst_buffer_ref (buffer) : NULL;
   sample->caps = caps ? gst_caps_ref (caps) : NULL;