From: Víctor Manuel Jáquez Leal Date: Tue, 7 Aug 2012 15:21:53 +0000 (+0200) Subject: audioencoder: getter for allocator X-Git-Tag: RELEASE-0.11.94~134 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=936ec3eb8fed0d3267dab29aa3308d1a018a340f;p=platform%2Fupstream%2Fgst-plugins-base.git audioencoder: getter for allocator Sometimes the encoder would 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/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c index c8a3f9e..7623c6d 100644 --- a/gst-libs/gst/audio/gstaudioencoder.c +++ b/gst-libs/gst/audio/gstaudioencoder.c @@ -2693,3 +2693,30 @@ done: return buffer; } + +/** + * gst_audio_encoder_get_allocator: + * @enc: a #GstAudioEncoder + * @allocator: (out) (allow-none) (transfer full): the #GstAllocator + * used + * @params: (out) (allow-none) (transfer full): the + * #GstAllocatorParams of @allocator + * + * Lets #GstAudioEncoder sub-classes to know the memory @allocator + * used by the base class and its @params. + * + * Unref the @allocator after use it. + */ +void +gst_audio_encoder_get_allocator (GstAudioEncoder * enc, + GstAllocator ** allocator, GstAllocationParams * params) +{ + g_return_if_fail (GST_IS_AUDIO_ENCODER (enc)); + + if (allocator) + *allocator = enc->priv->ctx.allocator ? + gst_object_ref (enc->priv->ctx.allocator) : NULL; + + if (params) + *params = enc->priv->ctx.params; +} diff --git a/gst-libs/gst/audio/gstaudioencoder.h b/gst-libs/gst/audio/gstaudioencoder.h index 840f02e..b05ab20 100644 --- a/gst-libs/gst/audio/gstaudioencoder.h +++ b/gst-libs/gst/audio/gstaudioencoder.h @@ -293,6 +293,10 @@ void gst_audio_encoder_set_drainable (GstAudioEncoder * enc, gboolean gst_audio_encoder_get_drainable (GstAudioEncoder * enc); +void gst_audio_encoder_get_allocator (GstAudioEncoder * enc, + GstAllocator ** allocator, + GstAllocationParams * params); + void gst_audio_encoder_merge_tags (GstAudioEncoder * enc, const GstTagList * tags, GstTagMergeMode mode);