diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 56fd861503..ab0ff084bd 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -3626,3 +3626,48 @@ failure: 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; +} diff --git a/libs/gst/base/gstbasesrc.h b/libs/gst/base/gstbasesrc.h index 289b77a674..b0ae337c46 100644 --- a/libs/gst/base/gstbasesrc.h +++ b/libs/gst/base/gstbasesrc.h @@ -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); +GstBufferPool * gst_base_src_get_buffer_pool (GstBaseSrc *src); +void gst_base_src_get_allocator (GstBaseSrc *src, + GstAllocator **allocator, + GstAllocationParams *params); + + G_END_DECLS #endif /* __GST_BASE_SRC_H__ */