mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
basesrc: getters for pool and allocator
Sometimes the sources would use the buffer pool or the memory allocator for something else than just allocating output buffers; for example, querying for different parameters, such as a bigger number of buffers to allocate by the 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:
parent
f42fb841f8
commit
65cfafb3b9
2 changed files with 51 additions and 0 deletions
|
@ -3626,3 +3626,48 @@ failure:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_base_src_get_buffer_pool:
|
||||||
|
* @src: a #GstBaseSrc
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the instance of the #GstBufferPool used
|
||||||
|
* by the src; free it after use it
|
||||||
|
*/
|
||||||
|
GstBufferPool *
|
||||||
|
gst_base_src_get_buffer_pool (GstBaseSrc * src)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_BASE_SRC (src), NULL);
|
||||||
|
|
||||||
|
if (src->priv->pool)
|
||||||
|
return gst_object_ref (src->priv->pool);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_base_src_get_allocator:
|
||||||
|
* @src: a #GstBaseSrc
|
||||||
|
* @allocator: (out) (allow-none) (transfer full): the #GstAllocator
|
||||||
|
* used
|
||||||
|
* @params: (out) (allow-none) (transfer full): the
|
||||||
|
* #GstAllocatorParams of @allocator
|
||||||
|
*
|
||||||
|
* Lets #GstBaseSrc sub-classes to know the memory @allocator
|
||||||
|
* used by the base class and its @params.
|
||||||
|
*
|
||||||
|
* Unref the @allocator after use it.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_base_src_get_allocator (GstBaseSrc * src,
|
||||||
|
GstAllocator ** allocator, GstAllocationParams * params)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GST_IS_BASE_SRC (src));
|
||||||
|
|
||||||
|
if (allocator)
|
||||||
|
*allocator = src->priv->allocator ?
|
||||||
|
gst_object_ref (src->priv->allocator) : NULL;
|
||||||
|
|
||||||
|
if (params)
|
||||||
|
*params = src->priv->params;
|
||||||
|
}
|
||||||
|
|
|
@ -259,6 +259,12 @@ gboolean gst_base_src_new_seamless_segment (GstBaseSrc *src, gint64 start
|
||||||
|
|
||||||
gboolean gst_base_src_set_caps (GstBaseSrc *src, GstCaps *caps);
|
gboolean gst_base_src_set_caps (GstBaseSrc *src, GstCaps *caps);
|
||||||
|
|
||||||
|
GstBufferPool * gst_base_src_get_buffer_pool (GstBaseSrc *src);
|
||||||
|
void gst_base_src_get_allocator (GstBaseSrc *src,
|
||||||
|
GstAllocator **allocator,
|
||||||
|
GstAllocationParams *params);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_BASE_SRC_H__ */
|
#endif /* __GST_BASE_SRC_H__ */
|
||||||
|
|
Loading…
Reference in a new issue