docs/random/ds/0.9-suggested-changes: Make note about renaming fixed-list to array.
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Tue, 20 Jul 2004 19:35:15 +0000 (19:35 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Tue, 20 Jul 2004 19:35:15 +0000 (19:35 +0000)
Original commit message from CVS:
* docs/random/ds/0.9-suggested-changes:
Make note about renaming fixed-list to array.
* gst/gstvalue.c: (gst_value_intersect_fixed_list),
(_gst_value_initialize):
Add array intersections.
* testsuite/caps/intersect2.c: (main):
Add test for array intersections.

ChangeLog
docs/random/ds/0.9-suggested-changes
gst/gstvalue.c
tests/old/testsuite/caps/intersect2.c
testsuite/caps/intersect2.c

index 34d9955..a88c9d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-07-20  Ronald Bultje  <rbultje@ronald.bitfreak.net>
+
+       * docs/random/ds/0.9-suggested-changes:
+         Make note about renaming fixed-list to array.
+       * gst/gstvalue.c: (gst_value_intersect_fixed_list),
+       (_gst_value_initialize):
+         Add array intersections.
+       * testsuite/caps/intersect2.c: (main):
+         Add test for array intersections.
+
 2004-07-20  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * configure.ac: back to cvs
index e5dae51..e12ee78 100644 (file)
@@ -69,6 +69,8 @@ API:
    so that you can search a GstPlay for an element implementing the interface
    (right now gstplay has added a gst_play_get_by_interface)
 
+ - rename GST_TYPE_FIXED_LIST to GST_TYPE_ARRAY
+
 caps:
 
   (Company:)
index ad05310..59a04b8 100644 (file)
@@ -1525,6 +1525,32 @@ gst_value_intersect_list (GValue * dest, const GValue * value1,
   return ret;
 }
 
+static gboolean
+gst_value_intersect_fixed_list (GValue * dest, const GValue * src1,
+    const GValue * src2)
+{
+  gint size, n;
+  GValue val = { 0 };
+
+  /* only works on similar-sized arrays */
+  size = gst_value_list_get_size (src1);
+  if (size != gst_value_list_get_size (src2))
+    return FALSE;
+  g_value_init (dest, GST_TYPE_FIXED_LIST);
+
+  for (n = 0; n < size; n++) {
+    if (!gst_value_intersect (&val, gst_value_list_get_value (src1, n),
+            gst_value_list_get_value (src2, n))) {
+      g_value_unset (dest);
+      return FALSE;
+    }
+    gst_value_list_append_value (dest, &val);
+    g_value_unset (&val);
+  }
+
+  return TRUE;
+}
+
 /***************
  * subtraction *
  ***************/
@@ -2800,6 +2826,8 @@ _gst_value_initialize (void)
       gst_value_intersect_double_double_range);
   gst_value_register_intersect_func (GST_TYPE_DOUBLE_RANGE,
       GST_TYPE_DOUBLE_RANGE, gst_value_intersect_double_range_double_range);
+  gst_value_register_intersect_func (GST_TYPE_FIXED_LIST,
+      GST_TYPE_FIXED_LIST, gst_value_intersect_fixed_list);
 
   gst_value_register_subtract_func (G_TYPE_INT, GST_TYPE_INT_RANGE,
       gst_value_subtract_int_int_range);
index 7eef6dd..e43bc63 100644 (file)
@@ -34,6 +34,20 @@ GstStaticCaps rawcaps8 =
     GST_STATIC_CAPS
     ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240");
 
+GstStaticCaps rawcaps9 =
+    GST_STATIC_CAPS
+    ("audio/x-raw-float, "
+    "channel-positions=(int)< "
+    "{ 1, 2, 3, 4, 5, 6 }, "
+    "{ 1, 2 }, "
+    "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 4, 5, 6 }, " "6 >");
+
+GstStaticCaps rawcaps10 =
+    GST_STATIC_CAPS
+    ("audio/x-raw-float, "
+    "channel-positions=(int)< 1, { 2, 3, 4, 5, 6 }, 3, 4, {4, 5, 6 }, "
+    "{ 4, 5, 6 } >");
+
 
 int
 main (int argc, char *argv[])
@@ -94,5 +108,14 @@ main (int argc, char *argv[])
   gst_caps_free (caps1);
   gst_caps_free (caps2);
 
+  caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps9));
+  caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps10));
+  caps = gst_caps_intersect (caps1, caps2);
+  g_print ("caps %s\n", gst_caps_to_string (caps));
+  if (gst_caps_is_empty (caps))
+    return 1;
+  gst_caps_free (caps1);
+  gst_caps_free (caps2);
+
   return 0;
 }
index 7eef6dd..e43bc63 100644 (file)
@@ -34,6 +34,20 @@ GstStaticCaps rawcaps8 =
     GST_STATIC_CAPS
     ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240");
 
+GstStaticCaps rawcaps9 =
+    GST_STATIC_CAPS
+    ("audio/x-raw-float, "
+    "channel-positions=(int)< "
+    "{ 1, 2, 3, 4, 5, 6 }, "
+    "{ 1, 2 }, "
+    "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 4, 5, 6 }, " "6 >");
+
+GstStaticCaps rawcaps10 =
+    GST_STATIC_CAPS
+    ("audio/x-raw-float, "
+    "channel-positions=(int)< 1, { 2, 3, 4, 5, 6 }, 3, 4, {4, 5, 6 }, "
+    "{ 4, 5, 6 } >");
+
 
 int
 main (int argc, char *argv[])
@@ -94,5 +108,14 @@ main (int argc, char *argv[])
   gst_caps_free (caps1);
   gst_caps_free (caps2);
 
+  caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps9));
+  caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps10));
+  caps = gst_caps_intersect (caps1, caps2);
+  g_print ("caps %s\n", gst_caps_to_string (caps));
+  if (gst_caps_is_empty (caps))
+    return 1;
+  gst_caps_free (caps1);
+  gst_caps_free (caps2);
+
   return 0;
 }