mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
utils: use new _caps_can_intersect()
This commit is contained in:
parent
aee208ff30
commit
50fbc34f3f
1 changed files with 10 additions and 15 deletions
|
@ -635,6 +635,7 @@ gst_element_get_compatible_pad_template (GstElement * element,
|
||||||
GstPadTemplate *newtempl = NULL;
|
GstPadTemplate *newtempl = NULL;
|
||||||
GList *padlist;
|
GList *padlist;
|
||||||
GstElementClass *class;
|
GstElementClass *class;
|
||||||
|
gboolean compatible;
|
||||||
|
|
||||||
g_return_val_if_fail (element != NULL, NULL);
|
g_return_val_if_fail (element != NULL, NULL);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||||
|
@ -650,7 +651,6 @@ gst_element_get_compatible_pad_template (GstElement * element,
|
||||||
|
|
||||||
while (padlist) {
|
while (padlist) {
|
||||||
GstPadTemplate *padtempl = (GstPadTemplate *) padlist->data;
|
GstPadTemplate *padtempl = (GstPadTemplate *) padlist->data;
|
||||||
GstCaps *intersection;
|
|
||||||
|
|
||||||
/* Ignore name
|
/* Ignore name
|
||||||
* Ignore presence
|
* Ignore presence
|
||||||
|
@ -670,17 +670,16 @@ gst_element_get_compatible_pad_template (GstElement * element,
|
||||||
GST_CAT_DEBUG (GST_CAT_CAPS,
|
GST_CAT_DEBUG (GST_CAT_CAPS,
|
||||||
"..and %" GST_PTR_FORMAT, GST_PAD_TEMPLATE_CAPS (padtempl));
|
"..and %" GST_PTR_FORMAT, GST_PAD_TEMPLATE_CAPS (padtempl));
|
||||||
|
|
||||||
intersection = gst_caps_intersect (GST_PAD_TEMPLATE_CAPS (compattempl),
|
compatible = gst_caps_can_intersect (GST_PAD_TEMPLATE_CAPS (compattempl),
|
||||||
GST_PAD_TEMPLATE_CAPS (padtempl));
|
GST_PAD_TEMPLATE_CAPS (padtempl));
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible %" GST_PTR_FORMAT,
|
GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible",
|
||||||
(intersection ? "" : "not "), intersection);
|
(compatible ? "" : "not "));
|
||||||
|
|
||||||
if (!gst_caps_is_empty (intersection))
|
if (compatible) {
|
||||||
newtempl = padtempl;
|
newtempl = padtempl;
|
||||||
gst_caps_unref (intersection);
|
|
||||||
if (newtempl)
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
padlist = g_list_next (padlist);
|
padlist = g_list_next (padlist);
|
||||||
|
@ -894,7 +893,8 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
|
||||||
peer = gst_pad_get_peer (current);
|
peer = gst_pad_get_peer (current);
|
||||||
|
|
||||||
if (peer == NULL && gst_pad_check_link (pad, current)) {
|
if (peer == NULL && gst_pad_check_link (pad, current)) {
|
||||||
GstCaps *temp, *temp2, *intersection;
|
GstCaps *temp, *intersection;
|
||||||
|
gboolean compatible;
|
||||||
|
|
||||||
/* Now check if the two pads' caps are compatible */
|
/* Now check if the two pads' caps are compatible */
|
||||||
temp = gst_pad_get_caps (pad);
|
temp = gst_pad_get_caps (pad);
|
||||||
|
@ -906,15 +906,11 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = gst_pad_get_caps (current);
|
temp = gst_pad_get_caps (current);
|
||||||
temp2 = gst_caps_intersect (temp, intersection);
|
compatible = gst_caps_can_intersect (temp, intersection);
|
||||||
gst_caps_unref (temp);
|
gst_caps_unref (temp);
|
||||||
gst_caps_unref (intersection);
|
gst_caps_unref (intersection);
|
||||||
|
|
||||||
intersection = temp2;
|
if (compatible) {
|
||||||
|
|
||||||
if (!gst_caps_is_empty (intersection)) {
|
|
||||||
gst_caps_unref (intersection);
|
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
||||||
"found existing unlinked compatible pad %s:%s",
|
"found existing unlinked compatible pad %s:%s",
|
||||||
GST_DEBUG_PAD_NAME (current));
|
GST_DEBUG_PAD_NAME (current));
|
||||||
|
@ -924,7 +920,6 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
|
||||||
} else {
|
} else {
|
||||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "incompatible pads");
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "incompatible pads");
|
||||||
}
|
}
|
||||||
gst_caps_unref (intersection);
|
|
||||||
} else {
|
} else {
|
||||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
||||||
"already linked or cannot be linked (peer = %p)", peer);
|
"already linked or cannot be linked (peer = %p)", peer);
|
||||||
|
|
Loading…
Reference in a new issue