From: Wim Taymans Date: Tue, 3 Dec 2013 20:46:19 +0000 (+0100) Subject: pad: add ACCEPT_INTERCEPT flag X-Git-Tag: 1.3.1~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=34db3528792a36e1befdd415c8df0db8b0b1ebb1;p=platform%2Fupstream%2Fgstreamer.git pad: add ACCEPT_INTERCEPT flag Make a new flag on the pad that tweaks the default behaviour of the accept-caps function. By default it will check for a subset of the query-caps result but this is not always desirable. The query-caps result contains all the constraints to make a good caps decision upstream but sometimes, like for parsers, not all the constrained caps fields are known upstream and then a subset check would fail. Switching to an intersection makes this work again. See https://bugzilla.gnome.org/show_bug.cgi?id=705024 https://bugzilla.gnome.org/show_bug.cgi?id=677401 --- diff --git a/gst/gstpad.c b/gst/gstpad.c index 8a1cb48..d3c0444 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2830,8 +2830,16 @@ gst_pad_query_accept_caps_default (GstPad * pad, GstQuery * query) allowed = gst_pad_query_caps (pad, caps); if (allowed) { - GST_DEBUG_OBJECT (pad, "allowed caps %" GST_PTR_FORMAT, allowed); - result = gst_caps_is_subset (caps, allowed); + if (GST_PAD_IS_ACCEPT_INTERSECT (pad)) { + GST_DEBUG_OBJECT (pad, + "allowed caps intersect %" GST_PTR_FORMAT ", caps %" GST_PTR_FORMAT, + allowed, caps); + result = gst_caps_can_intersect (caps, allowed); + } else { + GST_DEBUG_OBJECT (pad, "allowed caps subset %" GST_PTR_FORMAT ", caps %" + GST_PTR_FORMAT, allowed, caps); + result = gst_caps_is_subset (caps, allowed); + } gst_caps_unref (allowed); } else { GST_DEBUG_OBJECT (pad, "no compatible caps allowed on the pad"); diff --git a/gst/gstpad.h b/gst/gstpad.h index a784835..367d4a5 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -622,6 +622,10 @@ typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent ** * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward * scheduling queries to the internally linked pads * instead of discarding them. + * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check + * it the caps intersect the query-caps result instead + * of checking for a subset. This is interesting for + * parsers that can accept incompletely specified caps. * @GST_PAD_FLAG_LAST: offset to define more flags * * Pad state flags @@ -638,6 +642,7 @@ typedef enum { GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 8), GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9), GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10), + GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11), /* padding */ GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16) } GstPadFlags; @@ -791,6 +796,10 @@ struct _GstPadClass { #define GST_PAD_SET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING)) #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING)) +#define GST_PAD_IS_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT)) +#define GST_PAD_SET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT)) +#define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT)) + /** * GST_PAD_GET_STREAM_LOCK: * @pad: a #GstPad