mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 15:36:42 +00:00
update for bufferpool changes
This commit is contained in:
parent
7c0e2b5b1e
commit
1e884df1df
9 changed files with 31 additions and 78 deletions
|
@ -486,7 +486,7 @@ gst_vis_src_negotiate (GstVisual * visual)
|
||||||
|
|
||||||
/* and configure */
|
/* and configure */
|
||||||
config = gst_buffer_pool_get_config (pool);
|
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);
|
gst_buffer_pool_set_config (pool, config);
|
||||||
|
|
||||||
if (visual->pool)
|
if (visual->pool)
|
||||||
|
|
|
@ -917,7 +917,7 @@ theora_negotiate (GstTheoraDec * dec)
|
||||||
size = MAX (size, GST_VIDEO_INFO_SIZE (&dec->vinfo));
|
size = MAX (size, GST_VIDEO_INFO_SIZE (&dec->vinfo));
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
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);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
|
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
|
||||||
|
|
|
@ -82,11 +82,14 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans,
|
||||||
|
|
||||||
if (need_pool) {
|
if (need_pool) {
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
static GstAllocationParams params = { 0, 0, 0, 15, };
|
||||||
|
|
||||||
pool = gst_video_buffer_pool_new ();
|
pool = gst_video_buffer_pool_new ();
|
||||||
|
|
||||||
structure = gst_buffer_pool_get_config (pool);
|
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))
|
if (!gst_buffer_pool_set_config (pool, structure))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -138,12 +138,12 @@ gst_video_info_align (GstVideoInfo * info, GstVideoAlignment * align)
|
||||||
/* bufferpool */
|
/* bufferpool */
|
||||||
struct _GstVideoBufferPoolPrivate
|
struct _GstVideoBufferPoolPrivate
|
||||||
{
|
{
|
||||||
GstAllocator *allocator;
|
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
GstVideoAlignment video_align;
|
GstVideoAlignment video_align;
|
||||||
gboolean add_videometa;
|
gboolean add_videometa;
|
||||||
gboolean need_alignment;
|
gboolean need_alignment;
|
||||||
|
GstAllocator *allocator;
|
||||||
GstAllocationParams params;
|
GstAllocationParams params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -172,10 +172,10 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
const GstCaps *caps;
|
const GstCaps *caps;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
guint prefix, padding, align;
|
GstAllocator *allocator;
|
||||||
|
GstAllocationParams params;
|
||||||
|
|
||||||
if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, &prefix,
|
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
|
||||||
&padding, &align))
|
|
||||||
goto wrong_config;
|
goto wrong_config;
|
||||||
|
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
|
@ -185,6 +185,9 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
if (!gst_video_info_from_caps (&info, caps))
|
if (!gst_video_info_from_caps (&info, caps))
|
||||||
goto wrong_caps;
|
goto wrong_caps;
|
||||||
|
|
||||||
|
if (!gst_buffer_pool_config_get_allocator (config, &allocator, ¶ms))
|
||||||
|
goto wrong_config;
|
||||||
|
|
||||||
width = info.width;
|
width = info.width;
|
||||||
height = info.height;
|
height = info.height;
|
||||||
|
|
||||||
|
@ -193,10 +196,12 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
if (priv->caps)
|
if (priv->caps)
|
||||||
gst_caps_unref (priv->caps);
|
gst_caps_unref (priv->caps);
|
||||||
priv->caps = gst_caps_copy (caps);
|
priv->caps = gst_caps_copy (caps);
|
||||||
gst_allocation_params_init (&priv->params);
|
|
||||||
priv->params.prefix = prefix;
|
priv->params = params;
|
||||||
priv->params.padding = padding;
|
if (priv->allocator)
|
||||||
priv->params.align = align;
|
gst_allocator_unref (priv->allocator);
|
||||||
|
if ((priv->allocator = allocator))
|
||||||
|
gst_allocator_ref (allocator);
|
||||||
|
|
||||||
/* enable metadata based on config of the pool */
|
/* enable metadata based on config of the pool */
|
||||||
priv->add_videometa =
|
priv->add_videometa =
|
||||||
|
@ -327,54 +332,3 @@ gst_video_buffer_pool_finalize (GObject * object)
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_video_buffer_pool_parent_class)->finalize (object);
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -100,10 +100,6 @@ GType gst_video_buffer_pool_get_type (void);
|
||||||
|
|
||||||
GstBufferPool * gst_video_buffer_pool_new (void);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_VIDEO_POOL_H__ */
|
#endif /* __GST_VIDEO_POOL_H__ */
|
||||||
|
|
|
@ -483,8 +483,7 @@ ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
const GstCaps *caps;
|
const GstCaps *caps;
|
||||||
|
|
||||||
if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
|
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
|
||||||
NULL))
|
|
||||||
goto wrong_config;
|
goto wrong_config;
|
||||||
|
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
|
|
|
@ -1079,6 +1079,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
GstBufferPool *newpool, *oldpool;
|
GstBufferPool *newpool, *oldpool;
|
||||||
const GValue *par;
|
const GValue *par;
|
||||||
gint size;
|
gint size;
|
||||||
|
static GstAllocationParams params = { 0, 0, 0, 15, };
|
||||||
|
|
||||||
ximagesink = GST_XIMAGESINK (bsink);
|
ximagesink = GST_XIMAGESINK (bsink);
|
||||||
|
|
||||||
|
@ -1148,7 +1149,8 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
newpool = gst_ximage_buffer_pool_new (ximagesink);
|
newpool = gst_ximage_buffer_pool_new (ximagesink);
|
||||||
|
|
||||||
structure = gst_buffer_pool_get_config (newpool);
|
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))
|
if (!gst_buffer_pool_set_config (newpool, structure))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
|
|
||||||
|
@ -1442,8 +1444,7 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
||||||
|
|
||||||
/* we had a pool, check caps */
|
/* we had a pool, check caps */
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
|
gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ximagesink,
|
GST_DEBUG_OBJECT (ximagesink,
|
||||||
"we had a pool with caps %" GST_PTR_FORMAT, pcaps);
|
"we had a pool with caps %" GST_PTR_FORMAT, pcaps);
|
||||||
|
@ -1467,7 +1468,7 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
||||||
size = info.size;
|
size = info.size;
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
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))
|
if (!gst_buffer_pool_set_config (pool, config))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,8 +519,7 @@ xvimage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
const GstCaps *caps;
|
const GstCaps *caps;
|
||||||
|
|
||||||
if (!gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
|
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
|
||||||
NULL))
|
|
||||||
goto wrong_config;
|
goto wrong_config;
|
||||||
|
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
|
|
|
@ -1548,6 +1548,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
gint display_par_n, display_par_d; /* display's PAR */
|
gint display_par_n, display_par_d; /* display's PAR */
|
||||||
guint num, den;
|
guint num, den;
|
||||||
gint size;
|
gint size;
|
||||||
|
static GstAllocationParams params = { 0, 0, 0, 15, };
|
||||||
|
|
||||||
xvimagesink = GST_XVIMAGESINK (bsink);
|
xvimagesink = GST_XVIMAGESINK (bsink);
|
||||||
|
|
||||||
|
@ -1656,7 +1657,8 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
newpool = gst_xvimage_buffer_pool_new (xvimagesink);
|
newpool = gst_xvimage_buffer_pool_new (xvimagesink);
|
||||||
|
|
||||||
structure = gst_buffer_pool_get_config (newpool);
|
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))
|
if (!gst_buffer_pool_set_config (newpool, structure))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
|
|
||||||
|
@ -1957,8 +1959,7 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
||||||
/* we had a pool, check caps */
|
/* we had a pool, check caps */
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "check existing pool caps");
|
GST_DEBUG_OBJECT (xvimagesink, "check existing pool caps");
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL,
|
gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!gst_caps_is_equal (caps, pcaps)) {
|
if (!gst_caps_is_equal (caps, pcaps)) {
|
||||||
GST_DEBUG_OBJECT (xvimagesink, "pool has different caps");
|
GST_DEBUG_OBJECT (xvimagesink, "pool has different caps");
|
||||||
|
@ -1981,7 +1982,7 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
||||||
size = info.size;
|
size = info.size;
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
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))
|
if (!gst_buffer_pool_set_config (pool, config))
|
||||||
goto config_failed;
|
goto config_failed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue