From 9d80fbac23ee79e5411514a295b5285d223a5b8b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 May 2011 11:09:52 +0200 Subject: [PATCH] query: improve allocation parameters query Use the same parameters as those used for the bufferpool. Make sure we can pass a minimum and maximum amount of buffers needed. --- gst/gstquery.c | 22 ++++++++++++++-------- gst/gstquery.h | 10 ++++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gst/gstquery.c b/gst/gstquery.c index 553dde3..a06e244 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -1519,15 +1519,18 @@ gst_query_parse_allocation (GstQuery * query, GstCaps ** caps, * Set the allocation parameters in @query. */ void -gst_query_set_allocation_params (GstQuery * query, guint alignment, - guint prefix, guint size, GstBufferPool * pool) +gst_query_set_allocation_params (GstQuery * query, guint size, + guint min_buffers, guint max_buffers, guint prefix, + guint alignment, GstBufferPool * pool) { g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION); gst_structure_id_set (query->structure, - GST_QUARK (ALIGN), G_TYPE_UINT, alignment, - GST_QUARK (PREFIX), G_TYPE_UINT, prefix, 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, + GST_QUARK (PREFIX), G_TYPE_UINT, prefix, + GST_QUARK (ALIGN), G_TYPE_UINT, alignment, GST_QUARK (POOL), GST_TYPE_BUFFER_POOL, pool, NULL); } @@ -1542,15 +1545,18 @@ gst_query_set_allocation_params (GstQuery * query, guint alignment, * Get the allocation parameters in @query. */ void -gst_query_parse_allocation_params (GstQuery * query, guint * alignment, - guint * prefix, guint * size, GstBufferPool ** pool) +gst_query_parse_allocation_params (GstQuery * query, guint * size, + guint * min_buffers, guint * max_buffers, guint * prefix, + guint * alignment, GstBufferPool ** pool) { g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION); gst_structure_id_get (query->structure, - GST_QUARK (ALIGN), G_TYPE_UINT, alignment, - GST_QUARK (PREFIX), G_TYPE_UINT, prefix, 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, + GST_QUARK (PREFIX), G_TYPE_UINT, prefix, + GST_QUARK (ALIGN), G_TYPE_UINT, alignment, GST_QUARK (POOL), GST_TYPE_BUFFER_POOL, pool, NULL); } diff --git a/gst/gstquery.h b/gst/gstquery.h index e6feb66..3776a8c 100644 --- a/gst/gstquery.h +++ b/gst/gstquery.h @@ -332,10 +332,12 @@ void gst_query_set_uri (GstQuery *query, const gchar GstQuery * gst_query_new_allocation (GstCaps *caps, gboolean need_pool); void gst_query_parse_allocation (GstQuery *query, GstCaps **caps, gboolean *need_pool); -void gst_query_set_allocation_params (GstQuery *query, guint alignment, guint prefix, - guint size, GstBufferPool *pool); -void gst_query_parse_allocation_params (GstQuery *query, guint *alignment, guint *prefix, - guint *size, GstBufferPool **pool); +void gst_query_set_allocation_params (GstQuery *query, guint size, guint min_buffers, + guint max_buffers, guint prefix, guint alignment, + GstBufferPool *pool); +void gst_query_parse_allocation_params (GstQuery *query, guint *size, guint *min_buffers, + guint *max_buffers, guint *prefix, guint *alignment, + GstBufferPool **pool); void gst_query_add_allocation_meta (GstQuery *query, const gchar *api); guint gst_query_get_n_allocation_meta (GstQuery *query); -- 2.7.4