query: improve allocation parameters query
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 2 May 2011 09:09:52 +0000 (11:09 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 2 May 2011 09:09:52 +0000 (11:09 +0200)
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
gst/gstquery.h

index 553dde33e547ab7fa7a6a91a78f4da99aacce4d4..a06e2440739ee3e64050960463b10a7e2eed8b8c 100644 (file)
@@ -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);
 }
 
index e6feb66308cf3925787806d3d89460fc067febfb..3776a8c4f64c12fd860f930f473ea423e008ca43 100644 (file)
@@ -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);