mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
videoencoder: getter for allocator
Sometimes the encoder would need to use the allocator for something else than just allocating output buffers, for example, querying different parameters. This patch expose a getter accessor for the negotiated memory allocator.
This commit is contained in:
parent
efe9e31b34
commit
c02dcda885
2 changed files with 31 additions and 0 deletions
|
@ -2039,3 +2039,30 @@ gst_video_encoder_merge_tags (GstVideoEncoder * encoder,
|
|||
encoder->priv->tags_changed = TRUE;
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_encoder_get_allocator:
|
||||
* @encoder: a #GstVideoEncoder
|
||||
* @allocator: (out) (allow-none) (transfer full): the #GstAllocator
|
||||
* used
|
||||
* @params: (out) (allow-none) (transfer full): the
|
||||
* #GstAllocatorParams of @allocator
|
||||
*
|
||||
* Lets #GstVideoEncoder sub-classes to know the memory @allocator
|
||||
* used by the base class and its @params.
|
||||
*
|
||||
* Unref the @allocator after use it.
|
||||
*/
|
||||
void
|
||||
gst_video_encoder_get_allocator (GstVideoEncoder * encoder,
|
||||
GstAllocator ** allocator, GstAllocationParams * params)
|
||||
{
|
||||
g_return_if_fail (GST_IS_VIDEO_ENCODER (encoder));
|
||||
|
||||
if (allocator)
|
||||
*allocator = encoder->priv->allocator ?
|
||||
gst_object_ref (encoder->priv->allocator) : NULL;
|
||||
|
||||
if (params)
|
||||
*params = encoder->priv->params;
|
||||
}
|
||||
|
|
|
@ -298,6 +298,10 @@ void gst_video_encoder_merge_tags (GstVideoEncoder *encoder,
|
|||
const GstTagList *tags,
|
||||
GstTagMergeMode mode);
|
||||
|
||||
void gst_video_encoder_get_allocator (GstVideoEncoder *encoder,
|
||||
GstAllocator **allocator,
|
||||
GstAllocationParams *params);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue