+
+static gboolean
+gst_structure_is_equal_foreach (GQuark field_id, const GValue * val2,
+ gpointer data)
+{
+ GstStructure *struct1 = (GstStructure *) data;
+ const GValue *val1 = gst_structure_id_get_value (struct1, field_id);
+
+ if (G_UNLIKELY (val1 == NULL))
+ return FALSE;
+ if (gst_value_compare (val1, val2) == GST_VALUE_EQUAL) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ * gst_structure_is_equal:
+ * @struct1: a #GstStructure
+ * @struct2: another #GstStructure
+ *
+ * Tests if two #GstStructure are equal.
+ *
+ * Returns: TRUE if the arguments represent the same structure
+ */
+gboolean
+gst_structure_is_equal (GstStructure * struct1, GstStructure * struct2)
+{
+ if (struct1->name != struct2->name)
+ return FALSE;
+
+ if (GST_STRUCTURE_FIELDS (struct1)->len !=
+ GST_STRUCTURE_FIELDS (struct2)->len)
+ return FALSE;
+
+ return gst_structure_foreach (struct1, gst_structure_is_equal_foreach,
+ struct2);
+}
+