Add test for a bug in GstValueList

Original commit message from CVS:
Add test for a bug in GstValueList
This commit is contained in:
David Schleef 2003-12-22 03:03:31 +00:00
parent da9896d40a
commit d100e0b489
4 changed files with 76 additions and 0 deletions

View file

@ -62,6 +62,14 @@ GstStaticCaps rawcaps6 = GST_STATIC_CAPS (
"framerate=(double)30.0"
);
GstStaticCaps rawcaps7 = GST_STATIC_CAPS (
"video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]"
);
GstStaticCaps rawcaps8 = GST_STATIC_CAPS (
"video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]"
);
int
main (int argc, char *argv[])
{
@ -108,6 +116,10 @@ main (int argc, char *argv[])
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7),
gst_static_caps_get (&rawcaps8));
g_print("intersection: %s\n", gst_caps_to_string (caps));
xmlDocDump(stdout, doc);
return 0;

View file

@ -13,8 +13,33 @@ void test1(void)
g_value_init(&src2, G_TYPE_INT);
g_value_set_int(&src1, 20);
ret = gst_value_intersect(&dest, &src1, &src2);
g_assert(ret == 0);
g_print("ret = %d\n",ret);
}
void test2(void)
{
GValue dest = { 0 };
GValue src1 = { 0 };
GValue src2 = { 0 };
GValue item = { 0 };
gboolean ret;
g_value_init(&src1, GST_TYPE_FOURCC);
gst_value_set_fourcc(&src1, GST_MAKE_FOURCC('Y','U','Y','2'));
g_value_init(&src2, GST_TYPE_LIST);
g_value_init(&item, GST_TYPE_FOURCC);
gst_value_set_fourcc(&item, GST_MAKE_FOURCC('Y','U','Y','2'));
gst_value_list_append_value (&src2, &item);
gst_value_set_fourcc(&item, GST_MAKE_FOURCC('I','4','2','0'));
gst_value_list_append_value (&src2, &item);
gst_value_set_fourcc(&item, GST_MAKE_FOURCC('A','B','C','D'));
gst_value_list_append_value (&src2, &item);
ret = gst_value_intersect(&dest, &src1, &src2);
g_print("ret = %d\n",ret);
g_print("type = %s\n", g_type_name(G_VALUE_TYPE(&dest)));
g_print("value = %s\n", g_strdup_value_contents(&dest));
}
int main(int argc, char *argv[])
@ -23,6 +48,7 @@ int main(int argc, char *argv[])
gst_init(&argc, &argv);
test1();
test2();
return 0;

View file

@ -62,6 +62,14 @@ GstStaticCaps rawcaps6 = GST_STATIC_CAPS (
"framerate=(double)30.0"
);
GstStaticCaps rawcaps7 = GST_STATIC_CAPS (
"video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]"
);
GstStaticCaps rawcaps8 = GST_STATIC_CAPS (
"video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]"
);
int
main (int argc, char *argv[])
{
@ -108,6 +116,10 @@ main (int argc, char *argv[])
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
gst_caps_save_thyself (caps, parent);
caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7),
gst_static_caps_get (&rawcaps8));
g_print("intersection: %s\n", gst_caps_to_string (caps));
xmlDocDump(stdout, doc);
return 0;

View file

@ -13,8 +13,33 @@ void test1(void)
g_value_init(&src2, G_TYPE_INT);
g_value_set_int(&src1, 20);
ret = gst_value_intersect(&dest, &src1, &src2);
g_assert(ret == 0);
g_print("ret = %d\n",ret);
}
void test2(void)
{
GValue dest = { 0 };
GValue src1 = { 0 };
GValue src2 = { 0 };
GValue item = { 0 };
gboolean ret;
g_value_init(&src1, GST_TYPE_FOURCC);
gst_value_set_fourcc(&src1, GST_MAKE_FOURCC('Y','U','Y','2'));
g_value_init(&src2, GST_TYPE_LIST);
g_value_init(&item, GST_TYPE_FOURCC);
gst_value_set_fourcc(&item, GST_MAKE_FOURCC('Y','U','Y','2'));
gst_value_list_append_value (&src2, &item);
gst_value_set_fourcc(&item, GST_MAKE_FOURCC('I','4','2','0'));
gst_value_list_append_value (&src2, &item);
gst_value_set_fourcc(&item, GST_MAKE_FOURCC('A','B','C','D'));
gst_value_list_append_value (&src2, &item);
ret = gst_value_intersect(&dest, &src1, &src2);
g_print("ret = %d\n",ret);
g_print("type = %s\n", g_type_name(G_VALUE_TYPE(&dest)));
g_print("value = %s\n", g_strdup_value_contents(&dest));
}
int main(int argc, char *argv[])
@ -23,6 +48,7 @@ int main(int argc, char *argv[])
gst_init(&argc, &argv);
test1();
test2();
return 0;