diff --git a/subprojects/gstreamer/gst/gstvalue.c b/subprojects/gstreamer/gst/gstvalue.c index 4358616172..88ce4cbf30 100644 --- a/subprojects/gstreamer/gst/gstvalue.c +++ b/subprojects/gstreamer/gst/gstvalue.c @@ -7084,6 +7084,8 @@ gst_value_is_fixed (const GValue * value) } else if (GST_VALUE_HOLDS_STRUCTURE (value)) { return gst_structure_foreach_id_str (gst_value_get_structure (value), structure_field_is_fixed, NULL); + } else if (type == GST_TYPE_CAPS) { + return gst_caps_is_fixed (gst_value_get_caps (value)); } return gst_type_is_fixed (type); } @@ -7172,6 +7174,13 @@ gst_value_fixate (GValue * dest, const GValue * src) gst_value_set_structure (dest, kid); gst_structure_free (kid); return TRUE; + } else if (G_VALUE_TYPE (src) == GST_TYPE_CAPS) { + g_value_init (dest, GST_TYPE_CAPS); + GstCaps *caps = gst_caps_copy (gst_value_get_caps (src)); + caps = gst_caps_fixate (caps); + gst_value_set_caps (dest, caps); + gst_caps_unref (caps); + return TRUE; } else { return FALSE; } diff --git a/subprojects/gstreamer/tests/check/gst/gstcaps.c b/subprojects/gstreamer/tests/check/gst/gstcaps.c index 02b829417f..0191dab13b 100644 --- a/subprojects/gstreamer/tests/check/gst/gstcaps.c +++ b/subprojects/gstreamer/tests/check/gst/gstcaps.c @@ -343,6 +343,19 @@ GST_START_TEST (test_fixate) fail_if (caps == NULL); fail_unless (gst_caps_is_empty (caps)); gst_caps_unref (caps); + + caps = + gst_caps_from_string + ("video/x-raw, tensor = (GstCaps)[tensor/strided, dims=<0, [5, MAX]>]"); + caps = gst_caps_fixate (caps); + expected = + gst_caps_from_string + ("video/x-raw, tensor = (GstCaps)[tensor/strided, dims=<0, 5>]"); + + fail_unless (gst_caps_is_equal (caps, expected)); + gst_caps_unref (caps); + gst_caps_unref (expected); + } GST_END_TEST; @@ -1857,6 +1870,22 @@ GST_START_TEST (test_fixed) caps = gst_caps_from_string ("video/x-raw, format=I420"); fail_unless (gst_caps_is_fixed (caps)); gst_caps_unref (caps); + + caps = gst_caps_from_string ("video/x-raw, f=<0, [5, MAX]>"); + fail_if (gst_caps_is_fixed (caps)); + gst_caps_unref (caps); + + caps = + gst_caps_from_string + ("video/x-raw, tensor=(GstCaps)[tensor/strided, dims=<0, [5, MAX]>]"); + fail_if (gst_caps_is_fixed (caps)); + gst_caps_unref (caps); + + caps = + gst_caps_from_string + ("video/x-raw, tensor = (GstCaps)[tensor/strided, dims=<0, 5>]"); + fail_unless (gst_caps_is_fixed (caps)); + gst_caps_unref (caps); } GST_END_TEST;