core: gstvalue: fix ANY/EMPTY caps (features) hash
They should be special cases as both do not have any actual caps/features. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9037>
This commit is contained in:
parent
8f627b1f9c
commit
328b6bc55d
@ -8365,6 +8365,14 @@ gst_hash_caps_features (const GstCapsFeatures * features, guint * res)
|
||||
{
|
||||
guint i;
|
||||
|
||||
if (gst_caps_features_is_any (features)) {
|
||||
*res = g_str_hash ("ANY");
|
||||
return TRUE;
|
||||
} else if (gst_caps_features_get_size (features) == 0) {
|
||||
*res = g_str_hash ("EMPTY");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*res = 0;
|
||||
|
||||
for (i = 0; i < gst_caps_features_get_size (features); i++) {
|
||||
@ -8389,6 +8397,14 @@ gst_value_hash_caps (const GValue * v, guint * res)
|
||||
guint i;
|
||||
guint n = gst_caps_get_size (caps);
|
||||
|
||||
if (gst_caps_is_any (caps)) {
|
||||
*res = g_str_hash ("ANY");
|
||||
return TRUE;
|
||||
} else if (n == 0) {
|
||||
*res = g_str_hash ("EMPTY");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*res = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
GstCapsFeatures *features = gst_caps_get_features (caps, i);
|
||||
|
@ -4168,6 +4168,7 @@ GST_START_TEST (test_hash)
|
||||
{GST_TYPE_CAPS, "video/x-raw", "audio/x-raw", TRUE},
|
||||
{GST_TYPE_CAPS, "video/x-raw,width=1920", "video/x-raw,width=800", TRUE},
|
||||
{GST_TYPE_CAPS, "video/x-raw", "video/x-raw(memory:DMABuf)", TRUE},
|
||||
{GST_TYPE_CAPS, "ANY", "EMPTY", TRUE},
|
||||
{GST_TYPE_TAG_LIST, "taglist, title=(string)Title, artist=(string)Artist",
|
||||
"taglist, title=(string)Title2, artist=(string)Artist", TRUE},
|
||||
{G_TYPE_DATE, "1984-11-30", "1985-11-30", TRUE},
|
||||
@ -4180,6 +4181,7 @@ GST_START_TEST (test_hash)
|
||||
TRUE},
|
||||
{GST_TYPE_LIST, "{1, 2}", "{1, 3}", TRUE},
|
||||
{GST_TYPE_CAPS_FEATURES, "memory:DMABuf", "memory:GLMemory", FALSE},
|
||||
{GST_TYPE_CAPS_FEATURES, "ANY", "", FALSE},
|
||||
};
|
||||
|
||||
/* check that a and b are equal */
|
||||
|
Loading…
x
Reference in New Issue
Block a user