From d54fbe677f4f112ca304d360502592d5f6da3833 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Feb 2012 12:05:37 +0100 Subject: [PATCH] pad: add flag to proxy allocation query Add a flag to force the default query handler to forward the allocation query instead of discarding it. Reorder the pad flags a bit. --- gst/gstpad.c | 7 +++++-- gst/gstpad.h | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index 9bd9d56681..f900acf6c5 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2769,13 +2769,15 @@ done: gboolean gst_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query) { - gboolean forward = TRUE, ret = FALSE; + gboolean forward, ret = FALSE; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_SCHEDULING: - case GST_QUERY_ALLOCATION: forward = FALSE; break; + case GST_QUERY_ALLOCATION: + forward = GST_PAD_IS_PROXY_ALLOCATION (pad); + break; case GST_QUERY_ACCEPT_CAPS: ret = gst_pad_query_accept_caps_default (pad, query); forward = FALSE; @@ -2792,6 +2794,7 @@ gst_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query) case GST_QUERY_RATE: case GST_QUERY_CONVERT: default: + forward = TRUE; break; } diff --git a/gst/gstpad.h b/gst/gstpad.h index 26b2d3ff14..c71281eb02 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -587,10 +587,11 @@ typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent ** * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked * @GST_PAD_FLAG_FLUSHING: is pad refusing buffers * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event + * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling + * into the pad callbacks. * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated. * The flag has to be unset manually after * reconfiguration happened. - * Since: 0.10.34. * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps this means that once the * caps are set on the pad, the caps query function only @@ -598,8 +599,9 @@ typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent ** * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward * all events and queries to the internally linked pads * instead of discarding them. - * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling - * into the pad callbacks. + * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward + * allocation queries to the internally linked pads + * instead of discarding them. * @GST_PAD_FLAG_LAST: offset to define more flags * * Pad state flags @@ -608,11 +610,12 @@ typedef enum { GST_PAD_FLAG_BLOCKED = (GST_OBJECT_FLAG_LAST << 0), GST_PAD_FLAG_FLUSHING = (GST_OBJECT_FLAG_LAST << 1), GST_PAD_FLAG_BLOCKING = (GST_OBJECT_FLAG_LAST << 2), - GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 3), - GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 4), - GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 5), - GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 6), - GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 7), + GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 3), + GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 4), + GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 5), + GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 6), + GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 7), + GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 8), /* padding */ GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16) } GstPadFlags; @@ -756,6 +759,10 @@ struct _GstPadClass { #define GST_PAD_SET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS)) #define GST_PAD_UNSET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS)) +#define GST_PAD_IS_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION)) +#define GST_PAD_SET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION)) +#define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION)) + /** * GST_PAD_GET_STREAM_LOCK: * @pad: a #GstPad