Merge remote-tracking branch 'origin/master' into 0.11
[platform/upstream/gstreamer.git] / gst / gstbufferpool.c
index bb91167..66b6e05 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #include "gst_private.h"
+#include "glib-compat-private.h"
 
 #include <errno.h>
 #ifdef HAVE_UNISTD_H
@@ -116,7 +117,7 @@ gst_buffer_pool_init (GstBufferPool * pool)
   pool->active = FALSE;
   pool->configured = FALSE;
   pool->started = FALSE;
-  pool->config = gst_structure_id_empty_new (GST_QUARK (BUFFER_POOL_CONFIG));
+  pool->config = gst_structure_new_id_empty (GST_QUARK (BUFFER_POOL_CONFIG));
   gst_buffer_pool_config_set (pool->config, NULL, 0, 0, 0, 0, 0);
   gst_poll_write_control (pool->poll);
 
@@ -146,7 +147,7 @@ gst_buffer_pool_finalize (GObject * object)
  *
  * Creates a new #GstBufferPool instance.
  *
- * Returns: a new #GstBufferPool instance
+ * Returns: (transfer full): a new #GstBufferPool instance
  */
 GstBufferPool *
 gst_buffer_pool_new (void)
@@ -429,7 +430,7 @@ wrong_config:
 /**
  * gst_buffer_pool_set_config:
  * @pool: a #GstBufferPool
- * @config: a #GstStructure
+ * @config: (transfer full): a #GstStructure
  *
  * Set the configuration of the pool. The pool must be inactive and all buffers
  * allocated form this pool must be returned or else this function will do
@@ -502,7 +503,7 @@ have_outstanding:
  * can either be modified and used for the gst_buffer_pool_set_config() call
  * or it must be freed after usage.
  *
- * Returns: a copy of the current configuration of @pool. use
+ * Returns: (transfer full): a copy of the current configuration of @pool. use
  * gst_structure_free() after usage or gst_buffer_pool_set_config().
  */
 GstStructure *
@@ -529,7 +530,7 @@ static const gchar *empty_option[] = { NULL };
  * @pool. An option would typically be enabled with
  * gst_buffer_pool_config_add_option().
  *
- * Returns: a NULL terminated array of strings.
+ * Returns: (array zero-terminated=1) (transfer none): a NULL terminated array of strings.
  */
 const gchar **
 gst_buffer_pool_get_options (GstBufferPool * pool)
@@ -747,13 +748,13 @@ gst_buffer_pool_config_has_option (GstStructure * config, const gchar * option)
 
 /**
  * gst_buffer_pool_config_get:
- * @config: a #GstBufferPool configuration
- * @caps: the caps of buffers
- * @size: the size of each buffer, not including prefix
- * @min_buffers: the minimum amount of buffers to allocate.
- * @max_buffers: the maximum amount of buffers to allocate or 0 for unlimited.
- * @prefix: prefix each buffer with this many bytes
- * @align: alignment of the buffer data.
+ * @config: (transfer none): a #GstBufferPool configuration
+ * @caps: (out): the caps of buffers
+ * @size: (out): the size of each buffer, not including prefix
+ * @min_buffers: (out): the minimum amount of buffers to allocate.
+ * @max_buffers: (out): the maximum amount of buffers to allocate or 0 for unlimited.
+ * @prefix: (out): prefix each buffer with this many bytes
+ * @align: (out): alignment of the buffer data.
  *
  * Get the configuration values from @config.
  */
@@ -810,7 +811,7 @@ default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
     /* check if we need to wait */
     if (params && (params->flags & GST_BUFFER_POOL_FLAG_DONTWAIT)) {
       GST_LOG_OBJECT (pool, "no more buffers");
-      result = GST_FLOW_UNEXPECTED;
+      result = GST_FLOW_EOS;
       break;
     }
 
@@ -853,7 +854,8 @@ default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer,
 {
   GST_BUFFER_FLAGS (buffer) = 0;
 
-  GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
+  GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
+  GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
   GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
   GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
   GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
@@ -862,8 +864,8 @@ default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer,
 /**
  * gst_buffer_pool_acquire_buffer:
  * @pool: a #GstBufferPool
- * @buffer: a location for a #GstBuffer
- * @params: parameters.
+ * @buffer: (out): a location for a #GstBuffer
+ * @params: (transfer none) (allow-none) parameters.
  *
  * Acquire a buffer from @pool. @buffer should point to a memory location that
  * can hold a pointer to the new buffer.
@@ -920,7 +922,7 @@ default_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
 /**
  * gst_buffer_pool_release_buffer:
  * @pool: a #GstBufferPool
- * @buffer: a #GstBuffer
+ * @buffer: (transfer none): a #GstBuffer
  *
  * Release @buffer to @pool. @buffer should have previously been allocated from
  * @pool with gst_buffer_pool_acquire_buffer().
@@ -938,8 +940,7 @@ gst_buffer_pool_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
 
   /* check that the buffer is ours, all buffers returned to the pool have the
    * pool member set to NULL and the pool refcount decreased */
-  if (!g_atomic_pointer_compare_and_exchange ((gpointer *) & buffer->pool,
-          pool, NULL))
+  if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&buffer->pool, pool, NULL))
     return;
 
   pclass = GST_BUFFER_POOL_GET_CLASS (pool);