Index: gst/gstvalue.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstvalue.c,v
retrieving revision 1.120
diff -u -p -u -r1.120 gstvalue.c
--- gst/gstvalue.c	13 Jun 2006 08:20:24 -0000	1.120
+++ gst/gstvalue.c	11 Jul 2006 16:49:51 -0000
@@ -456,8 +456,9 @@ gst_value_transform_array_string (const 
   gst_value_transform_any_list_string (src_value, dest_value, "< ", " >");
 }
 
+/* Do an unordered compare of the contents of a list */
 static int
-gst_value_compare_list_or_array (const GValue * value1, const GValue * value2)
+gst_value_compare_list (const GValue * value1, const GValue * value2)
 {
   guint i, j;
   GArray *array1 = value1->data[0].v_pointer;
@@ -483,6 +484,29 @@ gst_value_compare_list_or_array (const G
   return GST_VALUE_EQUAL;
 }
 
+/* Perform an ordered comparison of the contents of an array */
+static int
+gst_value_compare_array (const GValue * value1, const GValue * value2)
+{
+  guint i;
+  GArray *array1 = value1->data[0].v_pointer;
+  GArray *array2 = value2->data[0].v_pointer;
+  GValue *v1;
+  GValue *v2;
+
+  if (array1->len != array2->len)
+    return GST_VALUE_UNORDERED;
+
+  for (i = 0; i < array1->len; i++) {
+    v1 = &g_array_index (array1, GValue, i);
+    v2 = &g_array_index (array2, GValue, i);
+    if (gst_value_compare (v1, v2) != GST_VALUE_EQUAL)
+      return GST_VALUE_UNORDERED;
+  }
+
+  return GST_VALUE_EQUAL;
+}
+
 static gchar *
 gst_value_serialize_list (const GValue * value)
 {
@@ -3879,7 +3903,7 @@ _gst_value_initialize (void)
   {
     static GstValueTable gst_value = {
       0,
-      gst_value_compare_list_or_array,
+      gst_value_compare_list,
       gst_value_serialize_list,
       gst_value_deserialize_list,
     };
@@ -3891,7 +3915,7 @@ _gst_value_initialize (void)
   {
     static GstValueTable gst_value = {
       0,
-      gst_value_compare_list_or_array,
+      gst_value_compare_array,
       gst_value_serialize_array,
       gst_value_deserialize_array,
     };
Index: tests/check/gst/gstvalue.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/tests/check/gst/gstvalue.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 gstvalue.c
--- tests/check/gst/gstvalue.c	1 Jul 2006 20:56:55 -0000	1.22
+++ tests/check/gst/gstvalue.c	11 Jul 2006 16:49:52 -0000
@@ -470,6 +470,7 @@ GST_START_TEST (test_value_compare)
 {
   GValue value1 = { 0 };
   GValue value2 = { 0 };
+  GValue tmp = { 0 };
 
   g_value_init (&value1, G_TYPE_INT);
   g_value_set_int (&value1, 10);
@@ -552,6 +553,91 @@ GST_START_TEST (test_value_compare)
   g_value_unset (&value1);
   g_value_unset (&value2);
 
+  /* Check that lists are equal regardless of order */
+  g_value_init (&value1, GST_TYPE_LIST);
+  g_value_init (&tmp, G_TYPE_INT);
+  g_value_set_int (&tmp, 1);
+  gst_value_list_append_value (&value1, &tmp);
+  g_value_set_int (&tmp, 2);
+  gst_value_list_append_value (&value1, &tmp);
+  g_value_set_int (&tmp, 3);
+  gst_value_list_append_value (&value1, &tmp);
+  g_value_set_int (&tmp, 4);
+  gst_value_list_append_value (&value1, &tmp);
+
+  g_value_init (&value2, GST_TYPE_LIST);
+  g_value_set_int (&tmp, 4);
+  gst_value_list_append_value (&value2, &tmp);
+  g_value_set_int (&tmp, 3);
+  gst_value_list_append_value (&value2, &tmp);
+  g_value_set_int (&tmp, 2);
+  gst_value_list_append_value (&value2, &tmp);
+  g_value_set_int (&tmp, 1);
+  gst_value_list_append_value (&value2, &tmp);
+
+  fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL,
+      "value lists with different order were not equal when they should be");
+  fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL,
+      "value lists with same order were not equal when they should be");
+  fail_unless (gst_value_compare (&value2, &value2) == GST_VALUE_EQUAL,
+      "value lists with same order were not equal when they should be");
+  
+  /* Carry over the lists to this next check: */
+  /* Lists with different sizes are unequal */
+  g_value_set_int (&tmp, 1);
+  gst_value_list_append_value (&value2, &tmp);
+
+  fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL,
+      "Value lists with different size were equal when they shouldn't be");
+
+  g_value_unset (&value1);
+  g_value_unset (&value2);
+  g_value_unset (&tmp);
+
+  /* Arrays are only equal when in the same order */
+  g_value_init (&value1, GST_TYPE_ARRAY);
+  g_value_init (&tmp, G_TYPE_INT);
+  g_value_set_int (&tmp, 1);
+  gst_value_array_append_value (&value1, &tmp);
+  g_value_set_int (&tmp, 2);
+  gst_value_array_append_value (&value1, &tmp);
+  g_value_set_int (&tmp, 3);
+  gst_value_array_append_value (&value1, &tmp);
+  g_value_set_int (&tmp, 4);
+  gst_value_array_append_value (&value1, &tmp);
+
+  g_value_init (&value2, GST_TYPE_ARRAY);
+  g_value_set_int (&tmp, 4);
+  gst_value_array_append_value (&value2, &tmp);
+  g_value_set_int (&tmp, 3);
+  gst_value_array_append_value (&value2, &tmp);
+  g_value_set_int (&tmp, 2);
+  gst_value_array_append_value (&value2, &tmp);
+  g_value_set_int (&tmp, 1);
+  gst_value_array_append_value (&value2, &tmp);
+
+  fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL,
+      "Value arrays with different order were equal when they shouldn't be");
+  fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL,
+      "Identical value arrays were not equal when they should be");
+  fail_unless (gst_value_compare (&value2, &value2) == GST_VALUE_EQUAL,
+      "Identical value arrays were not equal when they should be");
+  
+  /* Carry over the arrays to this next check: */
+  /* Arrays with different sizes are unequal */
+  g_value_unset (&value2);
+  g_value_init (&value2, GST_TYPE_ARRAY);
+  g_value_copy (&value1, &value2);
+
+  g_value_set_int (&tmp, 1);
+  gst_value_array_append_value (&value2, &tmp);
+
+  fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL,
+      "Value arrays with different size were equal when they shouldn't be");
+
+  g_value_unset (&value1);
+  g_value_unset (&value2);
+  g_value_unset (&tmp);
 }
 
 GST_END_TEST;
