mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-06 08:09:56 +00:00
value: Lists with all equal elements are equal to a single value
Otherwise caps containing f={X, X} are not compatible with f=X https://bugzilla.gnome.org/show_bug.cgi?id=709253
This commit is contained in:
parent
e30eab99a2
commit
5286479467
2 changed files with 55 additions and 7 deletions
|
@ -4466,24 +4466,51 @@ gst_value_compare (const GValue * value1, const GValue * value2)
|
|||
as well as lists and ranges ("{ 1, 2 }" and "[ 1, 2 ]" are equal) */
|
||||
ltype = gst_value_list_get_type ();
|
||||
if (G_VALUE_HOLDS (value1, ltype) && !G_VALUE_HOLDS (value2, ltype)) {
|
||||
gint i, n, ret;
|
||||
|
||||
if (gst_value_list_equals_range (value1, value2)) {
|
||||
return GST_VALUE_EQUAL;
|
||||
} else if (gst_value_list_get_size (value1) == 1) {
|
||||
}
|
||||
|
||||
n = gst_value_list_get_size (value1);
|
||||
if (n == 0)
|
||||
return GST_VALUE_UNORDERED;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
const GValue *elt;
|
||||
|
||||
elt = gst_value_list_get_value (value1, 0);
|
||||
return gst_value_compare (elt, value2);
|
||||
elt = gst_value_list_get_value (value1, i);
|
||||
ret = gst_value_compare (elt, value2);
|
||||
if (ret != GST_VALUE_EQUAL && n == 1)
|
||||
return ret;
|
||||
else if (ret != GST_VALUE_EQUAL)
|
||||
return GST_VALUE_UNORDERED;
|
||||
}
|
||||
|
||||
return GST_VALUE_EQUAL;
|
||||
} else if (G_VALUE_HOLDS (value2, ltype) && !G_VALUE_HOLDS (value1, ltype)) {
|
||||
gint i, n, ret;
|
||||
|
||||
if (gst_value_list_equals_range (value2, value1)) {
|
||||
return GST_VALUE_EQUAL;
|
||||
} else if (gst_value_list_get_size (value2) == 1) {
|
||||
}
|
||||
|
||||
n = gst_value_list_get_size (value2);
|
||||
if (n == 0)
|
||||
return GST_VALUE_UNORDERED;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
const GValue *elt;
|
||||
|
||||
elt = gst_value_list_get_value (value2, 0);
|
||||
return gst_value_compare (elt, value1);
|
||||
elt = gst_value_list_get_value (value2, i);
|
||||
ret = gst_value_compare (elt, value1);
|
||||
if (ret != GST_VALUE_EQUAL && n == 1)
|
||||
return ret;
|
||||
else if (ret != GST_VALUE_EQUAL)
|
||||
return GST_VALUE_UNORDERED;
|
||||
}
|
||||
|
||||
return GST_VALUE_EQUAL;
|
||||
}
|
||||
|
||||
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
|
||||
|
|
|
@ -340,9 +340,30 @@ GST_START_TEST (test_subset_duplication)
|
|||
GstCaps *c1, *c2;
|
||||
|
||||
c1 = gst_caps_from_string ("audio/x-raw, format=(string)F32LE");
|
||||
c2 = gst_caps_from_string ("audio/x-raw, format=(string)F32LE");
|
||||
|
||||
fail_unless (gst_caps_is_subset (c1, c2));
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
|
||||
gst_caps_unref (c2);
|
||||
c2 = gst_caps_from_string ("audio/x-raw, format=(string){ F32LE }");
|
||||
|
||||
fail_unless (gst_caps_is_subset (c1, c2));
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
|
||||
gst_caps_unref (c2);
|
||||
c2 = gst_caps_from_string ("audio/x-raw, format=(string){ F32LE, F32LE }");
|
||||
|
||||
fail_unless (gst_caps_is_subset (c1, c2));
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
|
||||
gst_caps_unref (c2);
|
||||
c2 = gst_caps_from_string
|
||||
("audio/x-raw, format=(string){ F32LE, F32LE, F32LE }");
|
||||
|
||||
fail_unless (gst_caps_is_subset (c1, c2));
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
}
|
||||
|
@ -1111,7 +1132,7 @@ gst_caps_suite (void)
|
|||
tcase_add_test (tc_chain, test_simplify);
|
||||
tcase_add_test (tc_chain, test_truncate);
|
||||
tcase_add_test (tc_chain, test_subset);
|
||||
tcase_skip_broken_test (tc_chain, test_subset_duplication);
|
||||
tcase_add_test (tc_chain, test_subset_duplication);
|
||||
tcase_add_test (tc_chain, test_merge_fundamental);
|
||||
tcase_add_test (tc_chain, test_merge_same);
|
||||
tcase_add_test (tc_chain, test_merge_subset);
|
||||
|
|
Loading…
Reference in a new issue