/* and configure */
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
+ gst_buffer_pool_config_set_params (config, target, size, min, max);
gst_buffer_pool_set_config (pool, config);
if (visual->pool)
size = MAX (size, GST_VIDEO_INFO_SIZE (&dec->vinfo));
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
+ gst_buffer_pool_config_set_params (config, caps, size, min, max);
gst_caps_unref (caps);
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
if (need_pool) {
GstStructure *structure;
+ static GstAllocationParams params = { 0, 0, 0, 15, };
pool = gst_video_buffer_pool_new ();
structure = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (structure, caps, size, 0, 0, 0, 0, 15);
+ gst_buffer_pool_config_set_params (structure, caps, size, 0, 0);
+ gst_buffer_pool_config_set_allocator (structure, NULL, ¶ms);
+
if (!gst_buffer_pool_set_config (pool, structure))
goto config_failed;
} else
/* bufferpool */
struct _GstVideoBufferPoolPrivate
{
- GstAllocator *allocator;
GstCaps *caps;
GstVideoInfo info;
GstVideoAlignment video_align;
gboolean add_videometa;
gboolean need_alignment;
+ GstAllocator *allocator;
GstAllocationParams params;
};
GstVideoInfo info;
const GstCaps *caps;
gint width, height;
- guint prefix, padding, align;
+ GstAllocator *allocator;
+ GstAllocationParams params;
- if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, &prefix,
- &padding, &align))
+ if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
goto wrong_config;
if (caps == NULL)
if (!gst_video_info_from_caps (&info, caps))
goto wrong_caps;
+ if (!gst_buffer_pool_config_get_allocator (config, &allocator, ¶ms))
+ goto wrong_config;
+
width = info.width;
height = info.height;
if (priv->caps)
gst_caps_unref (priv->caps);
priv->caps = gst_caps_copy (caps);
- gst_allocation_params_init (&priv->params);
- priv->params.prefix = prefix;
- priv->params.padding = padding;
- priv->params.align = align;
+
+ priv->params = params;
+ if (priv->allocator)
+ gst_allocator_unref (priv->allocator);
+ if ((priv->allocator = allocator))
+ gst_allocator_ref (allocator);
/* enable metadata based on config of the pool */
priv->add_videometa =
G_OBJECT_CLASS (gst_video_buffer_pool_parent_class)->finalize (object);
}
-
-/**
- * gst_video_buffer_pool_get_allocator:
- * @pool: a #GstVideoBufferPool
- *
- * Get the allocator used by @pool to allocate the video memory.
- *
- * Returns: (transfer full) the allocator used for allocating video memory.
- * gst_allocator_unref() after usage.
- */
-GstAllocator *
-gst_video_buffer_pool_get_allocator (GstVideoBufferPool * pool)
-{
- GstAllocator *alloc;
-
- g_return_val_if_fail (GST_IS_VIDEO_BUFFER_POOL (pool), NULL);
-
- if ((alloc = pool->priv->allocator))
- gst_allocator_ref (alloc);
-
- return alloc;
-}
-
-/**
- * gst_video_buffer_pool_set_allocator:
- * @pool: a #GstVideoBufferPool
- * @allocator: (transfer none): a #GstAllocator
- *
- * Set the allocator used to allocate video memory in @pool. The allocator
- * should only be changed by subclasses.
- */
-void
-gst_video_buffer_pool_set_allocator (GstVideoBufferPool * pool,
- GstAllocator * allocator)
-{
- GstAllocator *oldalloc;
- GstVideoBufferPoolPrivate *priv;
-
- g_return_if_fail (GST_IS_VIDEO_BUFFER_POOL (pool));
-
- priv = pool->priv;
-
- if (allocator)
- gst_allocator_ref (allocator);
-
- oldalloc = priv->allocator;
- priv->allocator = allocator;
-
- if (oldalloc)
- gst_allocator_unref (oldalloc);
-}
GstBufferPool * gst_video_buffer_pool_new (void);
-GstAllocator * gst_video_buffer_pool_get_allocator (GstVideoBufferPool *pool);
-void gst_video_buffer_pool_set_allocator (GstVideoBufferPool *pool,
- GstAllocator *allocator);
-
G_END_DECLS
#endif /* __GST_VIDEO_POOL_H__ */
GstVideoInfo info;
const GstCaps *caps;
- if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
- NULL))
+ if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
goto wrong_config;
if (caps == NULL)
GstBufferPool *newpool, *oldpool;
const GValue *par;
gint size;
+ static GstAllocationParams params = { 0, 0, 0, 15, };
ximagesink = GST_XIMAGESINK (bsink);
newpool = gst_ximage_buffer_pool_new (ximagesink);
structure = gst_buffer_pool_get_config (newpool);
- gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 0, 15);
+ gst_buffer_pool_config_set_params (structure, caps, size, 2, 0);
+ gst_buffer_pool_config_set_allocator (structure, NULL, ¶ms);
if (!gst_buffer_pool_set_config (newpool, structure))
goto config_failed;
/* we had a pool, check caps */
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
- NULL);
+ gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
GST_DEBUG_OBJECT (ximagesink,
"we had a pool with caps %" GST_PTR_FORMAT, pcaps);
size = info.size;
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0, 0);
+ gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
if (!gst_buffer_pool_set_config (pool, config))
goto config_failed;
}
GstVideoInfo info;
const GstCaps *caps;
- if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
- NULL))
+ if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
goto wrong_config;
if (caps == NULL)
gint display_par_n, display_par_d; /* display's PAR */
guint num, den;
gint size;
+ static GstAllocationParams params = { 0, 0, 0, 15, };
xvimagesink = GST_XVIMAGESINK (bsink);
newpool = gst_xvimage_buffer_pool_new (xvimagesink);
structure = gst_buffer_pool_get_config (newpool);
- gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 0, 15);
+ gst_buffer_pool_config_set_params (structure, caps, size, 2, 0);
+ gst_buffer_pool_config_set_allocator (structure, NULL, ¶ms);
if (!gst_buffer_pool_set_config (newpool, structure))
goto config_failed;
/* we had a pool, check caps */
GST_DEBUG_OBJECT (xvimagesink, "check existing pool caps");
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
- NULL);
+ gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
if (!gst_caps_is_equal (caps, pcaps)) {
GST_DEBUG_OBJECT (xvimagesink, "pool has different caps");
size = info.size;
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0, 0);
+ gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
if (!gst_buffer_pool_set_config (pool, config))
goto config_failed;
}