From 0f279cdb86641a039950ca1bfc12d5fc4fe14475 Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Thu, 4 May 2023 21:18:28 +0200 Subject: [PATCH] switchbin: Improve filter caps application Part-of: --- subprojects/gst-plugins-bad/gst/switchbin/gstswitchbin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/gst/switchbin/gstswitchbin.c b/subprojects/gst-plugins-bad/gst/switchbin/gstswitchbin.c index 2f370a1f11..7ed4b3c193 100644 --- a/subprojects/gst-plugins-bad/gst/switchbin/gstswitchbin.c +++ b/subprojects/gst-plugins-bad/gst/switchbin/gstswitchbin.c @@ -882,7 +882,12 @@ gst_switch_bin_get_allowed_caps (GstSwitchBin * switch_bin, /* Apply filter caps if present */ if (filter != NULL) { GstCaps *tmp_caps = total_path_caps; - total_path_caps = gst_caps_intersect (tmp_caps, filter); + /* Use filter caps as first caps in intersection along with the + * GST_CAPS_INTERSECT_FIRST mode. This makes it possible to + * define the order of the resulting caps by making it follow + * the order of the filter caps. */ + total_path_caps = gst_caps_intersect_full (filter, tmp_caps, + GST_CAPS_INTERSECT_FIRST); gst_caps_unref (tmp_caps); }