caps: fix nested caps
- Fixes #4534 - Fix gst_caps_is_fixed(), fix gst_caps_fixate () for caps-in-caps Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9378>
This commit is contained in:
parent
66880012c5
commit
a97757d6a9
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user