g_array_index (array, AllocationPool, index) = ap;
}
+typedef struct
+{
+ GType api;
+ guint flags;
+} AllocationMeta;
+
/**
* gst_query_add_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @api: the metadata API
+ * @flags: API specific flags
*
- * Add @api as aone of the supported metadata API to @query.
+ * Add @api with @flags as one of the supported metadata API to @query.
*/
void
-gst_query_add_allocation_meta (GstQuery * query, GType api)
+gst_query_add_allocation_meta (GstQuery * query, GType api, guint flags)
{
GArray *array;
GstStructure *structure;
+ AllocationMeta am;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (api != 0);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
- array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
+ array =
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
+
+ am.api = api;
+ am.flags = flags;
- g_array_append_val (array, api);
+ g_array_append_val (array, am);
}
/**
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query);
- array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
+ array =
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
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
*
* Parse an available query and get the metadata API
* at @index of the metadata API array.
* Returns: a #GType of the metadata API at @index.
*/
GType
-gst_query_parse_nth_allocation_meta (GstQuery * query, guint index)
+gst_query_parse_nth_allocation_meta (GstQuery * query, guint index,
+ guint * flags)
{
GArray *array;
GstStructure *structure;
+ AllocationMeta *am;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query);
- array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
+ array =
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
g_return_val_if_fail (index < array->len, 0);
- return g_array_index (array, GType, index);
+ am = &g_array_index (array, AllocationMeta, index);
+
+ if (flags)
+ *flags = am->flags;
+
+ return am->api;
}
/**
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
- array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
+ array =
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
g_return_if_fail (index < array->len);
g_array_remove_index (array, index);
g_return_val_if_fail (api != 0, FALSE);
structure = GST_QUERY_STRUCTURE (query);
- array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
+ array =
+ ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta), NULL);
len = array->len;
for (i = 0; i < len; i++) {
- if (g_array_index (array, GType, i) == api)
+ AllocationMeta *am = &g_array_index (array, AllocationMeta, i);
+ if (am->api == api)
return TRUE;
}
return FALSE;
n_metas = gst_query_get_n_allocation_metas (query);
for (i = 0; i < n_metas; i++) {
GType api;
+ guint flags;
gboolean remove;
- api = gst_query_parse_nth_allocation_meta (query, i);
+ api = gst_query_parse_nth_allocation_meta (query, i, &flags);
/* 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);
+ remove = !klass->filter_meta (trans, query, api, flags);
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;
- api = gst_query_parse_nth_allocation_meta (decide_query, i);
+ api = gst_query_parse_nth_allocation_meta (decide_query, i, &flags);
GST_DEBUG_OBJECT (trans, "proposing metadata %s", g_type_name (api));
- gst_query_add_allocation_meta (query, api);
+ gst_query_add_allocation_meta (query, api, flags);
}
ret = TRUE;
}