videodecoder: getters for pool and allocator

Sometimes the decoder would need to use the pool or the allocator for
something else than just allocating output buffers. For example, the querying
for different parameters, such as asking for a bigger number of buffers to
allocate in 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:
Víctor Manuel Jáquez Leal 2012-08-06 20:18:30 +02:00 committed by Sebastian Dröge
parent 2ff4d2efe3
commit efe9e31b34
2 changed files with 49 additions and 0 deletions

View file

@ -3141,3 +3141,48 @@ gst_video_decoder_merge_tags (GstVideoDecoder * decoder,
decoder->priv->tags_changed = TRUE;
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
}
/**
* gst_video_decoder_get_buffer_pool:
* @decoder: a #GstVideoDecoder
*
* Returns: (transfer full): the instance of the #GstBufferPool used
* by the decoder; free it after use it
*/
GstBufferPool *
gst_video_decoder_get_buffer_pool (GstVideoDecoder * decoder)
{
g_return_val_if_fail (GST_IS_VIDEO_DECODER (decoder), NULL);
if (decoder->priv->pool)
return gst_object_ref (decoder->priv->pool);
return NULL;
}
/**
* gst_video_decoder_get_allocator:
* @decoder: a #GstVideoDecoder
* @allocator: (out) (allow-none) (transfer full): the #GstAllocator
* used
* @params: (out) (allow-none) (transfer full): the
* #GstAllocatorParams of @allocator
*
* Lets #GstVideoDecoder sub-classes to know the memory @allocator
* used by the base class and its @params.
*
* Unref the @allocator after use it.
*/
void
gst_video_decoder_get_allocator (GstVideoDecoder * decoder,
GstAllocator ** allocator, GstAllocationParams * params)
{
g_return_if_fail (GST_IS_VIDEO_DECODER (decoder));
if (allocator)
*allocator = decoder->priv->allocator ?
gst_object_ref (decoder->priv->allocator) : NULL;
if (params)
*params = decoder->priv->params;
}

View file

@ -309,6 +309,10 @@ void gst_video_decoder_get_latency (GstVideoDecoder *decoder,
GstClockTime *min_latency,
GstClockTime *max_latency);
void gst_video_decoder_get_allocator (GstVideoDecoder *decoder,
GstAllocator **allocator,
GstAllocationParams *params);
GstBufferPool *gst_video_decoder_get_buffer_pool (GstVideoDecoder *decoder);
/* Object methods */