Remove metadata that describes the particular memory of the buffer it is
attached to. We need to do this because in non-passthrough mode we will allocate
new memory for our output buffer.
gst_base_transform_default_decide_allocation (GstBaseTransform * trans,
GstQuery * query)
{
+ guint i, n_metas;
+
+ n_metas = gst_query_get_n_allocation_metas (query);
+ for (i = 0; i < n_metas; i++) {
+ GType api;
+
+ api = gst_query_parse_nth_allocation_meta (query, i);
+ /* remove all memory dependent metadata because we are going to have to
+ * allocate different memory for input and output. */
+ if (gst_meta_api_type_has_tag (api, GST_META_TAG_MEMORY)) {
+ gst_query_remove_nth_allocation_meta (query, i);
+ i--;
+ }
+ }
+
return TRUE;
}
* @decide_allocation: Setup the allocation parameters for allocating output
* buffers. The passed in query contains the result of the
* downstream allocation query. This function is only called
- * when not operating in passthrough mode. The default
- * implementation is NULL.
+ * when not operating in passthrough mode. the default
+ * implementation will remove metadata that depends on the
+ * memory.
* @propose_allocation: Propose buffer allocation parameters for upstream elements.
* This function must be implemented if the element reads or
* writes the buffer content. The query that was passed to