mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
gststructure: early out when we know a value cannot be a subset
If two values can be ordered, but are unequal, they are necessarily distinct, thus one cannot be a subset of the other. https://bugzilla.gnome.org/show_bug.cgi?id=662777
This commit is contained in:
parent
29c97fe780
commit
afc80c10d1
1 changed files with 8 additions and 1 deletions
|
@ -3109,15 +3109,22 @@ gst_caps_structure_is_subset_field (GQuark field_id, const GValue * value,
|
|||
{
|
||||
GstStructure *superset = user_data;
|
||||
const GValue *other;
|
||||
int comparison;
|
||||
|
||||
if (!(other = gst_structure_id_get_value (superset, field_id)))
|
||||
/* field is missing in the superset => is subset */
|
||||
return TRUE;
|
||||
|
||||
comparison = gst_value_compare (other, value);
|
||||
|
||||
/* equal values are subset */
|
||||
if (gst_value_compare (other, value) == GST_VALUE_EQUAL)
|
||||
if (comparison == GST_VALUE_EQUAL)
|
||||
return TRUE;
|
||||
|
||||
/* ordered, but unequal, values are not */
|
||||
if (comparison != GST_VALUE_UNORDERED)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* 1 - [1,2] = empty
|
||||
* -> !subset
|
||||
|
|
Loading…
Reference in a new issue