summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorAurélien Zanelli <aurelien.zanelli@parrot.com>2016-01-11 15:46:16 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-01-28 10:02:54 -0500
commit354f16a5cafbb2b543b7873cf30bedcc8935523a (patch)
tree693570158ee1e1bdb8ff0efd5fab576fbf0f19dc /gst
parent6e8278c51e8bcbc72e1269b1be30f8d1258c036c (diff)
downloadgstreamer-plugins-bad-354f16a5cafbb2b543b7873cf30bedcc8935523a.tar.gz
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
Diffstat (limited to 'gst')
-rw-r--r--gst/rawparse/gstrawparse.c16
-rw-r--r--gst/rawparse/gstrawparse.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/gst/rawparse/gstrawparse.c b/gst/rawparse/gstrawparse.c
index 3d043fd49..a6468d932 100644
--- a/gst/rawparse/gstrawparse.c
+++ b/gst/rawparse/gstrawparse.c
@@ -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;
diff --git a/gst/rawparse/gstrawparse.h b/gst/rawparse/gstrawparse.h
index 944240bbc..2327dc6fb 100644
--- a/gst/rawparse/gstrawparse.h
+++ b/gst/rawparse/gstrawparse.h
@@ -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;
};