From: Víctor Manuel Jáquez Leal Date: Tue, 7 Aug 2012 15:19:05 +0000 (+0200) Subject: videoencoder: getter for allocator X-Git-Tag: 1.19.3~511^2~6024 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c02dcda88565b2386194fc7c6e874ccaa657b370;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index bfff440..605ebf5 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -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; +} diff --git a/gst-libs/gst/video/gstvideoencoder.h b/gst-libs/gst/video/gstvideoencoder.h index 933e080..ffc45db 100644 --- a/gst-libs/gst/video/gstvideoencoder.h +++ b/gst-libs/gst/video/gstvideoencoder.h @@ -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