basetransform: Minor refactoring

Move checks related to peerfilter in one place. No impact except for logic.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/484>
This commit is contained in:
Edward Hervey 2020-05-14 12:13:07 +02:00 committed by Edward Hervey
parent 3c7db917dd
commit 8076051a19

View file

@ -652,28 +652,31 @@ gst_base_transform_query_caps (GstBaseTransform * trans, GstPad * pad,
GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, peerfilter); GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, peerfilter);
gst_caps_unref (temp); gst_caps_unref (temp);
if (peerfilter && !gst_caps_is_empty (peerfilter)) { if (peerfilter) {
/* and filter against the template of the other pad */ if (!gst_caps_is_empty (peerfilter)) {
GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, otempl); /* and filter against the template of the other pad */
/* We keep the caps sorted like the returned caps */ GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, otempl);
temp = /* We keep the caps sorted like the returned caps */
gst_caps_intersect_full (peerfilter, otempl, temp =
GST_CAPS_INTERSECT_FIRST); gst_caps_intersect_full (peerfilter, otempl,
GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peerfilter); GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp);
peerfilter = temp; gst_caps_unref (peerfilter);
peerfilter = temp;
}
/* If we filter out everything, bail out */
if (peerfilter && gst_caps_is_empty (peerfilter)) {
GST_DEBUG_OBJECT (pad, "peer filter caps are empty");
caps = peerfilter;
peerfilter = NULL;
goto done;
}
} }
} }
GST_DEBUG_OBJECT (pad, "peer filter caps %" GST_PTR_FORMAT, peerfilter); GST_DEBUG_OBJECT (pad, "peer filter caps %" GST_PTR_FORMAT, peerfilter);
if (peerfilter && gst_caps_is_empty (peerfilter)) {
GST_DEBUG_OBJECT (pad, "peer filter caps are empty");
caps = peerfilter;
peerfilter = NULL;
goto done;
}
/* query the peer with the transformed filter */ /* query the peer with the transformed filter */
peercaps = gst_pad_peer_query_caps (otherpad, peerfilter); peercaps = gst_pad_peer_query_caps (otherpad, peerfilter);