From: Wim Taymans Date: Thu, 1 Mar 2012 14:18:04 +0000 (+0100) Subject: basetransform: remove metadata tagged with the memory tag X-Git-Tag: RELEASE-0.11.3~91 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bdcf1dc3cd10952986847e90f91951542928deda;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 53027a5..4b67ed7 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -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; } diff --git a/libs/gst/base/gstbasetransform.h b/libs/gst/base/gstbasetransform.h index 1ae2ade..9a664ad 100644 --- a/libs/gst/base/gstbasetransform.h +++ b/libs/gst/base/gstbasetransform.h @@ -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