basetransform: remove metadata tagged with the memory tag

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.
This commit is contained in:
Wim Taymans 2012-03-01 15:18:04 +01:00
parent faae1d9ff2
commit bdcf1dc3cd
2 changed files with 18 additions and 2 deletions

View file

@ -802,6 +802,21 @@ static gboolean
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;
}

View file

@ -141,8 +141,9 @@ struct _GstBaseTransform {
* @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