GstCaps *caps;
GstQuery *query;
GstBufferPool *pool = NULL;
- guint size, min, max, prefix, alignment;
+ guint size, min, max, prefix, padding, alignment;
caps = gst_pad_query_caps (visual->srcpad, NULL);
if (gst_pad_peer_query (visual->srcpad, query)) {
/* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &alignment, &pool);
+ &padding, &alignment, &pool);
} else {
size = visual->outsize;
min = max = 0;
prefix = 0;
+ padding = 0;
alignment = 0;
}
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
- alignment);
+ padding, alignment);
gst_buffer_pool_set_config (pool, config);
}
GstVideoFormat format;
GstQuery *query;
GstBufferPool *pool;
- guint size, min, max, prefix, alignment;
+ guint size, min, max, prefix, padding, alignment;
GstStructure *config;
GstCaps *caps;
GstVideoInfo info, cinfo;
GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
/* we got configuration from our peer, parse them */
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &alignment, &pool);
+ &padding, &alignment, &pool);
/* check if downstream supports cropping */
dec->has_cropping =
size = 0;
min = max = 0;
prefix = 0;
+ padding = 0;
alignment = 0;
pool = NULL;
dec->has_cropping = FALSE;
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, prefix, alignment);
+ gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
+ alignment);
gst_caps_unref (caps);
/* just set the option, if the pool can support it we will transparently use
pool = gst_video_buffer_pool_new ();
structure = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (structure, caps, size, 0, 0, 0, 15);
+ gst_buffer_pool_config_set (structure, caps, size, 0, 0, 0, 0, 15);
if (!gst_buffer_pool_set_config (pool, structure))
goto config_failed;
} else
pool = NULL;
- gst_query_set_allocation_params (query, size, 0, 0, 0, 15, pool);
+ gst_query_set_allocation_params (query, size, 0, 0, 0, 0, 15, pool);
gst_object_unref (pool);
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
gst_video_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query)
{
GstBufferPool *pool = NULL;
- guint size, min, max, prefix, alignment;
+ guint size, min, max, prefix, padding, alignment;
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &alignment, &pool);
+ &padding, &alignment, &pool);
if (pool) {
GstStructure *config;
gboolean add_videometa;
gboolean need_alignment;
guint prefix;
+ guint padding;
guint align;
};
GstVideoInfo info;
const GstCaps *caps;
gint width, height;
- guint prefix, align;
+ guint prefix, padding, align;
if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, &prefix,
- &align))
+ &padding, &align))
goto wrong_config;
if (caps == NULL)
gst_caps_unref (priv->caps);
priv->caps = gst_caps_copy (caps);
priv->prefix = prefix;
+ priv->padding = padding;
priv->align = align;
/* enable metadata based on config of the pool */
GstVideoBufferPoolPrivate *priv = vpool->priv;
GstVideoInfo *info;
GstMemory *mem;
+ gint maxsize;
info = &priv->info;
GST_DEBUG_OBJECT (pool, "alloc %" G_GSIZE_FORMAT, info->size);
- mem =
- gst_allocator_alloc (priv->allocator, info->size + priv->prefix,
- priv->align);
+ maxsize = info->size + priv->prefix + priv->padding;
+ mem = gst_allocator_alloc (priv->allocator, maxsize, priv->align);
if (mem == NULL)
goto no_memory;
*buffer = gst_buffer_new ();
- gst_memory_resize (mem, priv->prefix, info->size);
+ if (priv->prefix != 0 || priv->padding != 0)
+ gst_memory_resize (mem, priv->prefix, info->size);
gst_buffer_take_memory (*buffer, -1, mem);
if (priv->add_videometa) {
{
GstVideoTestSrc *videotestsrc;
GstBufferPool *pool;
- guint size, min, max, prefix, alignment;
+ guint size, min, max, prefix, padding, alignment;
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &alignment, &pool);
+ &padding, &alignment, &pool);
/* adjust size */
size = MAX (size, videotestsrc->info.size);
gst_buffer_pool_set_config (pool, config);
}
gst_query_set_allocation_params (query, size, min, max, prefix,
- alignment, pool);
+ padding, alignment, pool);
if (pool)
gst_object_unref (pool);
GstVideoInfo info;
const GstCaps *caps;
- if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL))
+ if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
+ NULL))
goto wrong_config;
if (caps == NULL)
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, 15);
+ gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 0, 15);
if (!gst_buffer_pool_set_config (newpool, structure))
goto config_failed;
oldpool = ximagesink->pool;
+ /* we don't activate the pool yet, this will be done by downstream after it
+ * has configured the pool. If downstream does not want our pool we will
+ * activate it when we render into it */
ximagesink->pool = newpool;
+ g_mutex_unlock (ximagesink->flow_lock);
/* unref the old sink */
if (oldpool) {
* deactivated when the last ref is gone */
gst_object_unref (oldpool);
}
- g_mutex_unlock (ximagesink->flow_lock);
return TRUE;
/* 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);
+ gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, 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);
+ gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0, 0);
if (!gst_buffer_pool_set_config (pool, config))
goto config_failed;
}
/* we need at least 2 buffer because we hold on to the last one */
- gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
+ gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, pool);
/* we also support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
GstVideoInfo info;
const GstCaps *caps;
- if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL))
+ if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
+ NULL))
goto wrong_config;
if (caps == NULL)
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, 15);
+ gst_buffer_pool_config_set (structure, caps, size, 2, 0, 0, 0, 15);
if (!gst_buffer_pool_set_config (newpool, structure))
goto config_failed;
oldpool = xvimagesink->pool;
+ /* we don't activate the pool yet, this will be done by downstream after it
+ * has configured the pool. If downstream does not want our pool we will
+ * activate it when we render into it */
xvimagesink->pool = newpool;
g_mutex_unlock (xvimagesink->flow_lock);
/* 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);
+ gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, 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);
+ gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0, 0);
if (!gst_buffer_pool_set_config (pool, config))
goto config_failed;
}
/* we need at least 2 buffer because we hold on to the last one */
- gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
+ gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, pool);
/* we also support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);