/**
* SECTION:gstbufferpool
+ * @title: GstBufferPool
* @short_description: Pool for buffers
* @see_also: #GstBuffer
*
GST_DEBUG_CATEGORY_STATIC (gst_buffer_pool_debug);
#define GST_CAT_DEFAULT gst_buffer_pool_debug
-#define GST_BUFFER_POOL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BUFFER_POOL, GstBufferPoolPrivate))
-
#define GST_BUFFER_POOL_LOCK(pool) (g_rec_mutex_lock(&pool->priv->rec_lock))
#define GST_BUFFER_POOL_UNLOCK(pool) (g_rec_mutex_unlock(&pool->priv->rec_lock))
static void gst_buffer_pool_finalize (GObject * object);
-G_DEFINE_TYPE (GstBufferPool, gst_buffer_pool, GST_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GstBufferPool, gst_buffer_pool, GST_TYPE_OBJECT);
static gboolean default_start (GstBufferPool * pool);
static gboolean default_stop (GstBufferPool * pool);
{
GObjectClass *gobject_class = (GObjectClass *) klass;
- g_type_class_add_private (klass, sizeof (GstBufferPoolPrivate));
-
gobject_class->finalize = gst_buffer_pool_finalize;
klass->start = default_start;
{
GstBufferPoolPrivate *priv;
- priv = pool->priv = GST_BUFFER_POOL_GET_PRIVATE (pool);
+ priv = pool->priv = gst_buffer_pool_get_instance_private (pool);
g_rec_mutex_init (&priv->rec_lock);
*
* Creates a new #GstBufferPool instance.
*
- * Returns: (transfer floating): a new #GstBufferPool instance
+ * Returns: (transfer full): a new #GstBufferPool instance
*/
GstBufferPool *
gst_buffer_pool_new (void)
{
GstBufferPool *result;
- result = g_object_newv (GST_TYPE_BUFFER_POOL, 0, NULL);
+ result = g_object_new (GST_TYPE_BUFFER_POOL, NULL);
GST_DEBUG_OBJECT (result, "created new buffer pool");
+ /* Clear floating flag */
+ gst_object_ref_sink (result);
+
return result;
}
*
* Get the @allocator and @params from @config.
*
- * Returns: %TRUE, if the values are set.
+ * Returns: %TRUE, if the values are set.
*/
gboolean
gst_buffer_pool_config_get_allocator (GstStructure * config,
}
} else {
/* We're the first thread waiting, we got the wait token and have to
- * write it again later
+ * write it again later
* OR
* We're a second thread and just consumed the flush token and block all
* other threads, in which case we must not wait and give it back
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
+ /* if the memory is intact reset the size to the full size */
+ if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY))
+ gst_buffer_resize (buffer, 0, pool->priv->size);
+
/* remove all metadata without the POOLED flag */
gst_buffer_foreach_meta (buffer, remove_meta_unpooled, pool);
}