rawparse: add 'decide_allocation' vfunc to let subclass parse an allocation query

And so send an allocation query. This could be used to check whether
downstream element supports some metas or not.

https://bugzilla.gnome.org/show_bug.cgi?id=760270
This commit is contained in:
Aurélien Zanelli 2016-01-11 15:46:16 +01:00 committed by Nicolas Dufresne
parent 6e8278c51e
commit 354f16a5ca
2 changed files with 17 additions and 0 deletions

View file

@ -222,6 +222,22 @@ gst_raw_parse_set_src_caps (GstRawParse * rp)
}
rp->negotiated = gst_pad_set_caps (rp->srcpad, caps);
/* if subclass inplement decide_allocation, send an allocation
* query, pass result to subclass and let it handle allocation if needed. */
if (rp_class->decide_allocation) {
GstQuery *query;
query = gst_query_new_allocation (caps, TRUE);
if (!gst_pad_peer_query (rp->srcpad, query)) {
/* not a problem, just debug a little */
GST_DEBUG_OBJECT (rp, "peer ALLOCATION query failed");
}
rp_class->decide_allocation (rp, query);
gst_query_unref (query);
}
gst_caps_unref (caps);
return rp->negotiated;

View file

@ -78,6 +78,7 @@ struct _GstRawParseClass
GstCaps * (*get_caps) (GstRawParse *rp);
void (*pre_push_buffer) (GstRawParse *rp, GstBuffer *buffer);
void (*decide_allocation) (GstRawParse *rp, GstQuery *query);
gboolean multiple_frames_per_buffer;
};