summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: 795e836)
raw | patch | inline | side by side (from parent 1: 795e836)
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | |
Thu, 3 Nov 2011 15:35:32 +0000 (15:35 +0000) | ||
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | |
Fri, 4 Nov 2011 17:49:55 +0000 (17:49 +0000) |
gst/gstcaps.c | patch | blob | history | |
gst/gstcaps.h | patch | blob | history |
diff --git a/gst/gstcaps.c b/gst/gstcaps.c
index 3652a445622ddc647f197085173d03926dbb6093..f9ce8005833b337e123464d2e3e7a12945804eba 100644 (file)
--- a/gst/gstcaps.c
+++ b/gst/gstcaps.c
return gst_caps_is_subset (caps1, caps2) && gst_caps_is_subset (caps2, caps1);
}
+/**
+ * gst_caps_is_strictly_equal:
+ * @caps1: a #GstCaps
+ * @caps2: another #GstCaps
+ *
+ * Checks if the given caps are exactly the same set of caps.
+ *
+ * This function deals correctly with passing NULL for any of the caps.
+ *
+ * Returns: TRUE if both caps are strictly equal.
+ *
+ * Since: 0.10.36
+ */
+gboolean
+gst_caps_is_strictly_equal (const GstCaps * caps1, const GstCaps * caps2)
+{
+ int i;
+ /* FIXME 0.11: NULL pointers are no valid Caps but indicate an error
+ * So there should be an assertion that caps1 and caps2 != NULL */
+
+ /* NULL <-> NULL is allowed here */
+ if (G_UNLIKELY (caps1 == caps2))
+ return TRUE;
+
+ /* one of them NULL => they are different (can't be both NULL because
+ * we checked that above) */
+ if (G_UNLIKELY (caps1 == NULL || caps2 == NULL))
+ return FALSE;
+
+ if (caps1->structs->len != caps2->structs->len)
+ return FALSE;
+
+ for (i = 0; i < caps1->structs->len; i++) {
+ if (!gst_structure_is_equal (gst_caps_get_structure_unchecked (caps1, i),
+ gst_caps_get_structure_unchecked (caps2, i)))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* intersect operation */
/**
diff --git a/gst/gstcaps.h b/gst/gstcaps.h
index 47c0d33fdab544cc68fecdc0fae243f4769db0e5..56a8441b402e8f732ef6d283a4f47defb648a339 100644 (file)
--- a/gst/gstcaps.h
+++ b/gst/gstcaps.h
const GstCaps *caps2);
gboolean gst_caps_can_intersect (const GstCaps * caps1,
const GstCaps * caps2);
+gboolean gst_caps_is_strictly_equal (const GstCaps *caps1,
+ const GstCaps *caps2);
/* operations */