mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
switchbin: When collecting srcpad caps, don't intersect with path caps.
The path caps describe the input caps that will select each path, don't intersect those with the srcpad caps, which could be completely different. Instead, when querying allowed caps for the srcpad, just construct the union of all possible output caps from all path srcpads. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2018>
This commit is contained in:
parent
1f865246c1
commit
bd9f675318
1 changed files with 14 additions and 5 deletions
|
@ -824,6 +824,8 @@ gst_switch_bin_get_allowed_caps (GstSwitchBin * switch_bin,
|
||||||
|
|
||||||
guint i;
|
guint i;
|
||||||
GstCaps *total_path_caps;
|
GstCaps *total_path_caps;
|
||||||
|
gboolean is_sink_pad =
|
||||||
|
(gst_pad_get_direction (switch_bin_pad) == GST_PAD_SINK);
|
||||||
|
|
||||||
/* The allowed caps are a combination of the caps of all paths, the
|
/* The allowed caps are a combination of the caps of all paths, the
|
||||||
* filter caps, and the allowed caps as indicated by the result
|
* filter caps, and the allowed caps as indicated by the result
|
||||||
|
@ -859,14 +861,21 @@ gst_switch_bin_get_allowed_caps (GstSwitchBin * switch_bin,
|
||||||
caps_query = gst_query_new_caps (NULL);
|
caps_query = gst_query_new_caps (NULL);
|
||||||
|
|
||||||
/* Query the path element for allowed caps. If this is
|
/* Query the path element for allowed caps. If this is
|
||||||
* successful, intersect the returned caps with the path caps,
|
* successful, intersect the returned caps with the path caps for the sink pad,
|
||||||
* and append the result of the intersection to the total_path_caps. */
|
* and append the result of the intersection to the total_path_caps,
|
||||||
|
* or just append the result to the total_path_caps if collecting srcpad caps. */
|
||||||
if (gst_pad_query (pad, caps_query)) {
|
if (gst_pad_query (pad, caps_query)) {
|
||||||
gst_query_parse_caps_result (caps_query, &caps);
|
gst_query_parse_caps_result (caps_query, &caps);
|
||||||
|
if (is_sink_pad) {
|
||||||
intersected_caps = gst_caps_intersect (caps, path->caps);
|
intersected_caps = gst_caps_intersect (caps, path->caps);
|
||||||
|
} else {
|
||||||
|
intersected_caps = gst_caps_copy (caps);
|
||||||
|
}
|
||||||
gst_caps_append (total_path_caps, intersected_caps);
|
gst_caps_append (total_path_caps, intersected_caps);
|
||||||
} else
|
} else if (is_sink_pad) {
|
||||||
|
/* Just assume the sink pad has the path caps if the query failed */
|
||||||
gst_caps_append (total_path_caps, gst_caps_ref (path->caps));
|
gst_caps_append (total_path_caps, gst_caps_ref (path->caps));
|
||||||
|
}
|
||||||
|
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
gst_query_unref (caps_query);
|
gst_query_unref (caps_query);
|
||||||
|
@ -874,7 +883,7 @@ gst_switch_bin_get_allowed_caps (GstSwitchBin * switch_bin,
|
||||||
/* This is a path with no element (= is a dropping path),
|
/* This is a path with no element (= is a dropping path),
|
||||||
* If querying the sink caps, append the path
|
* If querying the sink caps, append the path
|
||||||
* input caps, otherwise the output caps can be ANY */
|
* input caps, otherwise the output caps can be ANY */
|
||||||
if (gst_pad_get_direction (switch_bin_pad) == GST_PAD_SINK)
|
if (is_sink_pad)
|
||||||
gst_caps_append (total_path_caps, gst_caps_ref (path->caps));
|
gst_caps_append (total_path_caps, gst_caps_ref (path->caps));
|
||||||
else
|
else
|
||||||
gst_caps_append (total_path_caps, gst_caps_new_any ());
|
gst_caps_append (total_path_caps, gst_caps_new_any ());
|
||||||
|
|
Loading…
Reference in a new issue