basetransform: getters for pool and allocator

Sometimes a transform filter would need the buffer pool or the memory
allocator negotiated by the base class, for example, for querying different
parameters, such as a bigger number of buffers to allocate by the buffer pool.

This patch expose a two getters accessors: one for the buffer pool and the
other for the memory allocator.
This commit is contained in:
Víctor Manuel Jáquez Leal 2012-08-07 17:38:53 +02:00 committed by Sebastian Dröge
parent 65cfafb3b9
commit fee7080dff
2 changed files with 50 additions and 0 deletions

View file

@ -2619,3 +2619,48 @@ gst_base_transform_reconfigure_src (GstBaseTransform * trans)
gst_pad_mark_reconfigure (trans->srcpad);
}
/**
* gst_base_transform_get_buffer_pool:
* @trans: a #GstBaseTransform
*
* Returns: (transfer full): the instance of the #GstBufferPool used
* by @trans; free it after use it
*/
GstBufferPool *
gst_base_transform_get_buffer_pool (GstBaseTransform * trans)
{
g_return_val_if_fail (GST_IS_BASE_TRANSFORM (trans), NULL);
if (trans->priv->pool)
return gst_object_ref (trans->priv->pool);
return NULL;
}
/**
* gst_base_transform_get_allocator:
* @trans: a #GstBaseTransform
* @allocator: (out) (allow-none) (transfer full): the #GstAllocator
* used
* @params: (out) (allow-none) (transfer full): the
* #GstAllocatorParams of @allocator
*
* Lets #GstBaseTransform sub-classes to know the memory @allocator
* used by the base class and its @params.
*
* Unref the @allocator after use it.
*/
void
gst_base_transform_get_allocator (GstBaseTransform * trans,
GstAllocator ** allocator, GstAllocationParams * params)
{
g_return_if_fail (GST_IS_BASE_TRANSFORM (trans));
if (allocator)
*allocator = trans->priv->allocator ?
gst_object_ref (trans->priv->allocator) : NULL;
if (params)
*params = trans->priv->params;
}

View file

@ -283,6 +283,11 @@ gboolean gst_base_transform_is_qos_enabled (GstBaseTransform *trans);
void gst_base_transform_set_gap_aware (GstBaseTransform *trans,
gboolean gap_aware);
GstBufferPool * gst_base_transform_get_buffer_pool (GstBaseTransform *trans);
void gst_base_transform_get_allocator (GstBaseTransform *trans,
GstAllocator **allocator,
GstAllocationParams *params);
void gst_base_transform_reconfigure_sink (GstBaseTransform *trans);
void gst_base_transform_reconfigure_src (GstBaseTransform *trans);
G_END_DECLS