From 08f33d8d934bbe450b6771ab8b066c2f1590b0b7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 27 Mar 2012 12:40:36 +0200 Subject: [PATCH] bufferpool: remove const from get/set_param Remove the const from the GstCaps in get/set_param. set_param modifies the refcount of the caps. Don't increment the refcount of the caps result of get_param like we do with other objects. Update some annotiations. --- gst/gstbufferpool.c | 21 +++++++++++++-------- gst/gstbufferpool.h | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c index c12534f..d1d14c5 100644 --- a/gst/gstbufferpool.c +++ b/gst/gstbufferpool.c @@ -434,7 +434,7 @@ static gboolean default_set_config (GstBufferPool * pool, GstStructure * config) { GstBufferPoolPrivate *priv = pool->priv; - const GstCaps *caps; + GstCaps *caps; guint size, min_buffers, max_buffers; GstAllocator *allocator; GstAllocationParams params; @@ -641,7 +641,7 @@ gst_buffer_pool_has_option (GstBufferPool * pool, const gchar * option) * Configure @config with the given parameters. */ void -gst_buffer_pool_config_set_params (GstStructure * config, const GstCaps * caps, +gst_buffer_pool_config_set_params (GstStructure * config, GstCaps * caps, guint size, guint min_buffers, guint max_buffers) { g_return_if_fail (config != NULL); @@ -812,21 +812,26 @@ gst_buffer_pool_config_has_option (GstStructure * config, const gchar * option) /** * gst_buffer_pool_config_get_params: * @config: (transfer none): a #GstBufferPool configuration - * @caps: (out): the caps of buffers - * @size: (out): the size of each buffer, not including prefix and padding - * @min_buffers: (out): the minimum amount of buffers to allocate. - * @max_buffers: (out): the maximum amount of buffers to allocate or 0 for unlimited. + * @caps: (out) (transfer none) (allow-none): the caps of buffers + * @size: (out) (allow-none): the size of each buffer, not including prefix and padding + * @min_buffers: (out) (allow-none): the minimum amount of buffers to allocate. + * @max_buffers: (out) (allow-none): the maximum amount of buffers to allocate or 0 for unlimited. * * Get the configuration values from @config. + * + * Returns: %TRUE if all parameters could be fetched. */ gboolean -gst_buffer_pool_config_get_params (GstStructure * config, const GstCaps ** caps, +gst_buffer_pool_config_get_params (GstStructure * config, GstCaps ** caps, guint * size, guint * min_buffers, guint * max_buffers) { g_return_val_if_fail (config != NULL, FALSE); + if (caps) { + *caps = g_value_get_boxed (gst_structure_id_get_value (config, + GST_QUARK (CAPS))); + } return gst_structure_id_get (config, - GST_QUARK (CAPS), GST_TYPE_CAPS, caps, GST_QUARK (SIZE), G_TYPE_UINT, size, GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers, GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers, NULL); diff --git a/gst/gstbufferpool.h b/gst/gstbufferpool.h index f7ff22f..b1917c3 100644 --- a/gst/gstbufferpool.h +++ b/gst/gstbufferpool.h @@ -181,9 +181,9 @@ gboolean gst_buffer_pool_has_option (GstBufferPool *pool, const gch /* helpers for configuring the config structure */ -void gst_buffer_pool_config_set_params (GstStructure *config, const GstCaps *caps, +void gst_buffer_pool_config_set_params (GstStructure *config, GstCaps *caps, guint size, guint min_buffers, guint max_buffers); -gboolean gst_buffer_pool_config_get_params (GstStructure *config, const GstCaps **caps, +gboolean gst_buffer_pool_config_get_params (GstStructure *config, GstCaps **caps, guint *size, guint *min_buffers, guint *max_buffers); void gst_buffer_pool_config_set_allocator (GstStructure *config, GstAllocator *allocator, const GstAllocationParams *params); -- 2.7.4