docs/random/ds/0.9-suggested-changes: Make note about renaming fixed-list to array.

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.
This commit is contained in:
Ronald S. Bultje 2004-07-20 19:35:15 +00:00
parent feca9eac03
commit 8b895dadce
5 changed files with 86 additions and 0 deletions

View file

@ -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

View 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:)

View 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);

View 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;
}

View 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;
}