typedef struct
{
GType api;
- guint flags;
+ GstStructure *params;
} AllocationMeta;
+static void
+allocation_meta_free (AllocationMeta * am)
+{
+ if (am->params)
+ gst_structure_free (am->params);
+}
+
/**
* gst_query_add_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @api: the metadata API
- * @flags: API specific flags
+ * @params: (transfer full) (allow-none): API specific parameters
*
- * Add @api with @flags as one of the supported metadata API to @query.
+ * Add @api with @params as one of the supported metadata API to @query.
*/
void
-gst_query_add_allocation_meta (GstQuery * query, GType api, guint flags)
+gst_query_add_allocation_meta (GstQuery * query, GType api,
+ GstStructure * params)
{
GArray *array;
GstStructure *structure;
structure = GST_QUERY_STRUCTURE (query);
array =
- ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
+ (GDestroyNotify) allocation_meta_free);
am.api = api;
- am.flags = flags;
+ am.params = params;
g_array_append_val (array, am);
}
structure = GST_QUERY_STRUCTURE (query);
array =
- ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
+ (GDestroyNotify) allocation_meta_free);
return array->len;
}
* gst_query_parse_nth_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the metadata API array to read
- * @flags: (out) (allow-none): API specific flags
+ * @params: (out) (allow-none): API specific flags
*
* Parse an available query and get the metadata API
* at @index of the metadata API array.
*/
GType
gst_query_parse_nth_allocation_meta (GstQuery * query, guint index,
- guint * flags)
+ const GstStructure ** params)
{
GArray *array;
GstStructure *structure;
structure = GST_QUERY_STRUCTURE (query);
array =
- ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
+ (GDestroyNotify) allocation_meta_free);
g_return_val_if_fail (index < array->len, 0);
am = &g_array_index (array, AllocationMeta, index);
- if (flags)
- *flags = am->flags;
+ if (params)
+ *params = am->params;
return am->api;
}
structure = GST_QUERY_STRUCTURE (query);
array =
- ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
+ (GDestroyNotify) allocation_meta_free);
g_return_if_fail (index < array->len);
g_array_remove_index (array, index);
structure = GST_QUERY_STRUCTURE (query);
array =
- ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
+ (GDestroyNotify) allocation_meta_free);
len = array->len;
for (i = 0; i < len; i++) {
/**
* gst_query_add_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
- * @allocator: the memory allocator
- * @params: a #GstAllocationParams
+ * @allocator: (transfer none) (allow-none): the memory allocator
+ * @params: (transfer none) (allow-none): a #GstAllocationParams
*
* Add @allocator and its @params as a supported memory allocator.
*/
* gst_query_parse_nth_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the allocator array to read
- * @allocator: (transfer none): variable to hold the result
- * @params: parameters for the allocator
+ * @allocator: (out) (transfer none) (allow-none): variable to hold the result
+ * @params: (out) (allow-none): parameters for the allocator
*
* Parse an available query and get the alloctor and its params
* at @index of the allocator array.
* gst_query_set_nth_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the allocator array to set
- * @allocator: (transfer full): new allocator to set
- * @params: parameters for the allocator
+ * @allocator: (transfer none) (allow-none): new allocator to set
+ * @params: (transfer none) (allow-none): parameters for the allocator
*
* Parse an available query and get the alloctor and its params
* at @index of the allocator array.
n_metas = gst_query_get_n_allocation_metas (query);
for (i = 0; i < n_metas; i++) {
GType api;
- guint flags;
+ const GstStructure *params;
gboolean remove;
- api = gst_query_parse_nth_allocation_meta (query, i, &flags);
+ api = gst_query_parse_nth_allocation_meta (query, i, ¶ms);
/* by default we remove all metadata, subclasses should implement a
* filter_meta function */
remove = TRUE;
} else if (G_LIKELY (klass->filter_meta)) {
/* remove if the subclass said so */
- remove = !klass->filter_meta (trans, query, api, flags);
+ remove = !klass->filter_meta (trans, query, api, params);
GST_LOG_OBJECT (trans, "filter_meta for api %s returned: %s",
g_type_name (api), (remove ? "remove" : "keep"));
} else {
n_metas = gst_query_get_n_allocation_metas (decide_query);
for (i = 0; i < n_metas; i++) {
GType api;
- guint flags;
+ const GstStructure *params;
- api = gst_query_parse_nth_allocation_meta (decide_query, i, &flags);
+ api = gst_query_parse_nth_allocation_meta (decide_query, i, ¶ms);
GST_DEBUG_OBJECT (trans, "proposing metadata %s", g_type_name (api));
- gst_query_add_allocation_meta (query, api, flags);
+ gst_query_add_allocation_meta (query, api, gst_structure_copy (params));
}
ret = TRUE;
}