From dcfb86bb73bf039ff684ef4815a716bbd50dc824 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 13 Jan 2002 22:46:34 +0000 Subject: [PATCH] Added caps testsuite. Original commit message from CVS: Added caps testsuite. --- configure.ac | 1 + tests/old/testsuite/caps/Makefile.am | 14 +++ tests/old/testsuite/caps/compatibility.c | 123 +++++++++++++++++++++++++ tests/old/testsuite/caps/intersection.c | 125 ++++++++++++++++++++++++++ tests/old/testsuite/caps/normalisation.c | 149 +++++++++++++++++++++++++++++++ testsuite/caps/Makefile.am | 14 +++ testsuite/caps/compatibility.c | 123 +++++++++++++++++++++++++ testsuite/caps/intersection.c | 125 ++++++++++++++++++++++++++ testsuite/caps/normalisation.c | 149 +++++++++++++++++++++++++++++++ 9 files changed, 823 insertions(+) create mode 100644 tests/old/testsuite/caps/Makefile.am create mode 100644 tests/old/testsuite/caps/compatibility.c create mode 100644 tests/old/testsuite/caps/intersection.c create mode 100644 tests/old/testsuite/caps/normalisation.c create mode 100644 testsuite/caps/Makefile.am create mode 100644 testsuite/caps/compatibility.c create mode 100644 testsuite/caps/intersection.c create mode 100644 testsuite/caps/normalisation.c diff --git a/configure.ac b/configure.ac index 2649f64..dd9d3e0 100644 --- a/configure.ac +++ b/configure.ac @@ -698,6 +698,7 @@ tests/muxing/Makefile tests/sched/Makefile testsuite/Makefile testsuite/bytestream/Makefile +testsuite/caps/Makefile testsuite/capsnego/Makefile testsuite/cleanup/Makefile testsuite/plugin/Makefile diff --git a/tests/old/testsuite/caps/Makefile.am b/tests/old/testsuite/caps/Makefile.am new file mode 100644 index 0000000..887d141 --- /dev/null +++ b/tests/old/testsuite/caps/Makefile.am @@ -0,0 +1,14 @@ +testprogs = intersection compatibility normalisation + +TESTS = $(testprogs) + +check_PROGRAMS = $(testprogs) + +# we have nothing but apps here, we can do this safely +intersection_LDADD = $(GST_LIBS) +intersection_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +compatibility_LDADD = $(GST_LIBS) +compatibility_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +normalisation_LDADD = $(GST_LIBS) +normalisation_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) + diff --git a/tests/old/testsuite/caps/compatibility.c b/tests/old/testsuite/caps/compatibility.c new file mode 100644 index 0000000..752cc0d --- /dev/null +++ b/tests/old/testsuite/caps/compatibility.c @@ -0,0 +1,123 @@ +#include + +/* these caps all have a non empty intersection */ +GST_CAPS_FACTORY (sinkcaps, + GST_CAPS_NEW ( + "mpeg2dec_sink", + "video/mpeg", + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT (1), + GST_PROPS_INT (2) + ) + ) +); + +GST_CAPS_FACTORY (mp1parsecaps, + GST_CAPS_NEW ( + "mp1parse_src", + "video/mpeg", + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT (1) + ) + ) +); + + + +GST_CAPS_FACTORY (rawcaps, + GST_CAPS_NEW ( + "mpeg2dec_src", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps2, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")) + ), + "height", GST_PROPS_INT_RANGE (16, 256) + ) +); + +GST_CAPS_FACTORY (rawcaps3, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + + +GST_CAPS_FACTORY (rawcaps4, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps5, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +int +main (int argc, char *argv[]) +{ + gboolean testret; + + gst_init (&argc, &argv); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps)); + g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps)); + g_print ("4 <-> 1 == %d (valid, subset)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps)); + g_print ("1 <-> 4 == %d (invalid, superset)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2)); + g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3)); + g_print ("2 <-> 5 == %d (valid)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps)); + g_print ("5 <-> 2 == %d (invalid)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3)); + g_print ("3 <-> 5 == %d (valid)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps)); + g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps)); + g_print ("2 <-> 2 == %d (valid, same caps)\n", testret); + + return 0; +} diff --git a/tests/old/testsuite/caps/intersection.c b/tests/old/testsuite/caps/intersection.c new file mode 100644 index 0000000..5536ed5 --- /dev/null +++ b/tests/old/testsuite/caps/intersection.c @@ -0,0 +1,125 @@ +#include + +/* these caps all have a non empty intersection */ +GST_CAPS_FACTORY (sinkcaps, + GST_CAPS_NEW ( + "mpeg2dec_sink", + "video/mpeg", + "mpegtype", GST_PROPS_INT (1), + "foo1", GST_PROPS_INT_RANGE (20,40), + "foo2", GST_PROPS_INT_RANGE (20,40), + "foo3", GST_PROPS_INT_RANGE (10,20) + ) +); + +GST_CAPS_FACTORY (mp1parsecaps, + GST_CAPS_NEW ( + "mp1parse_src", + "video/mpeg", + "mpegtype", GST_PROPS_INT (1), + "foo1", GST_PROPS_INT (30), + "foo2", GST_PROPS_INT_RANGE (20,30), + "foo3", GST_PROPS_INT_RANGE (20,30) + ) +); + + + +GST_CAPS_FACTORY (rawcaps, + GST_CAPS_NEW ( + "mpeg2dec_src", + "video/raw", + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps2, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ) +); + +GST_CAPS_FACTORY (rawcaps3, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + + +GST_CAPS_FACTORY (rawcaps4, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps5, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); +int +main (int argc, char *argv[]) +{ + gboolean testret; + xmlDocPtr doc; + xmlNodePtr parent; + GstCaps *caps; + gint i; + + gst_init (&argc, &argv); + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); + + /* + g_mem_chunk_info (); + for (i = 0; i<100000; i++) { + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4)); + gst_caps_unref (caps); + } + g_mem_chunk_info (); + */ + + caps = gst_caps_intersect (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps5)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL); + gst_caps_save_thyself (caps, parent); + + xmlDocDump(stdout, doc); + + return 0; +} diff --git a/tests/old/testsuite/caps/normalisation.c b/tests/old/testsuite/caps/normalisation.c new file mode 100644 index 0000000..1a34ce9 --- /dev/null +++ b/tests/old/testsuite/caps/normalisation.c @@ -0,0 +1,149 @@ +#include + +/* these caps all have a non empty intersection */ +GST_CAPS_FACTORY (sinkcaps, + GST_CAPS_NEW ( + "mpeg2dec_sink", + "video/mpeg", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "foo1", GST_PROPS_INT_RANGE (20,40), + "foo2", GST_PROPS_INT_RANGE (20,40), + "foo3", GST_PROPS_INT_RANGE (10,20) + ) +); + +GST_CAPS_FACTORY (mp1parsecaps, + GST_CAPS_NEW ( + "mp1parse_src", + "video/mpeg", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "foo4", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ) + ) +); + + + +GST_CAPS_FACTORY (rawcaps, + GST_CAPS_NEW ( + "mpeg2dec_src", + "video/raw", + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096), + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ) + ) +); + +GST_CAPS_FACTORY (rawcaps2, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ), + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ) +); + +GST_CAPS_FACTORY (rawcaps3, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ), + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ), + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + + +GST_CAPS_FACTORY (rawcaps4, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps5, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); +int +main (int argc, char *argv[]) +{ + gboolean testret; + xmlDocPtr doc; + xmlNodePtr parent; + GstCaps *caps; + gint i; + + gst_init (&argc, &argv); + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); + + caps = gst_caps_normalize (GST_CAPS_GET (sinkcaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (mp1parsecaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (rawcaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (rawcaps2)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (rawcaps3)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + xmlDocDump(stdout, doc); + + return 0; +} diff --git a/testsuite/caps/Makefile.am b/testsuite/caps/Makefile.am new file mode 100644 index 0000000..887d141 --- /dev/null +++ b/testsuite/caps/Makefile.am @@ -0,0 +1,14 @@ +testprogs = intersection compatibility normalisation + +TESTS = $(testprogs) + +check_PROGRAMS = $(testprogs) + +# we have nothing but apps here, we can do this safely +intersection_LDADD = $(GST_LIBS) +intersection_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +compatibility_LDADD = $(GST_LIBS) +compatibility_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +normalisation_LDADD = $(GST_LIBS) +normalisation_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) + diff --git a/testsuite/caps/compatibility.c b/testsuite/caps/compatibility.c new file mode 100644 index 0000000..752cc0d --- /dev/null +++ b/testsuite/caps/compatibility.c @@ -0,0 +1,123 @@ +#include + +/* these caps all have a non empty intersection */ +GST_CAPS_FACTORY (sinkcaps, + GST_CAPS_NEW ( + "mpeg2dec_sink", + "video/mpeg", + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT (1), + GST_PROPS_INT (2) + ) + ) +); + +GST_CAPS_FACTORY (mp1parsecaps, + GST_CAPS_NEW ( + "mp1parse_src", + "video/mpeg", + "mpegtype", GST_PROPS_LIST ( + GST_PROPS_INT (1) + ) + ) +); + + + +GST_CAPS_FACTORY (rawcaps, + GST_CAPS_NEW ( + "mpeg2dec_src", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps2, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")) + ), + "height", GST_PROPS_INT_RANGE (16, 256) + ) +); + +GST_CAPS_FACTORY (rawcaps3, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + + +GST_CAPS_FACTORY (rawcaps4, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps5, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +int +main (int argc, char *argv[]) +{ + gboolean testret; + + gst_init (&argc, &argv); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps)); + g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps)); + g_print ("4 <-> 1 == %d (valid, subset)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps)); + g_print ("1 <-> 4 == %d (invalid, superset)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2)); + g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3)); + g_print ("2 <-> 5 == %d (valid)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps)); + g_print ("5 <-> 2 == %d (invalid)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3)); + g_print ("3 <-> 5 == %d (valid)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps)); + g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret); + + testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps)); + g_print ("2 <-> 2 == %d (valid, same caps)\n", testret); + + return 0; +} diff --git a/testsuite/caps/intersection.c b/testsuite/caps/intersection.c new file mode 100644 index 0000000..5536ed5 --- /dev/null +++ b/testsuite/caps/intersection.c @@ -0,0 +1,125 @@ +#include + +/* these caps all have a non empty intersection */ +GST_CAPS_FACTORY (sinkcaps, + GST_CAPS_NEW ( + "mpeg2dec_sink", + "video/mpeg", + "mpegtype", GST_PROPS_INT (1), + "foo1", GST_PROPS_INT_RANGE (20,40), + "foo2", GST_PROPS_INT_RANGE (20,40), + "foo3", GST_PROPS_INT_RANGE (10,20) + ) +); + +GST_CAPS_FACTORY (mp1parsecaps, + GST_CAPS_NEW ( + "mp1parse_src", + "video/mpeg", + "mpegtype", GST_PROPS_INT (1), + "foo1", GST_PROPS_INT (30), + "foo2", GST_PROPS_INT_RANGE (20,30), + "foo3", GST_PROPS_INT_RANGE (20,30) + ) +); + + + +GST_CAPS_FACTORY (rawcaps, + GST_CAPS_NEW ( + "mpeg2dec_src", + "video/raw", + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps2, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ) +); + +GST_CAPS_FACTORY (rawcaps3, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + + +GST_CAPS_FACTORY (rawcaps4, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps5, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); +int +main (int argc, char *argv[]) +{ + gboolean testret; + xmlDocPtr doc; + xmlNodePtr parent; + GstCaps *caps; + gint i; + + gst_init (&argc, &argv); + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); + + /* + g_mem_chunk_info (); + for (i = 0; i<100000; i++) { + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4)); + gst_caps_unref (caps); + } + g_mem_chunk_info (); + */ + + caps = gst_caps_intersect (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps5)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL); + gst_caps_save_thyself (caps, parent); + + xmlDocDump(stdout, doc); + + return 0; +} diff --git a/testsuite/caps/normalisation.c b/testsuite/caps/normalisation.c new file mode 100644 index 0000000..1a34ce9 --- /dev/null +++ b/testsuite/caps/normalisation.c @@ -0,0 +1,149 @@ +#include + +/* these caps all have a non empty intersection */ +GST_CAPS_FACTORY (sinkcaps, + GST_CAPS_NEW ( + "mpeg2dec_sink", + "video/mpeg", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "foo1", GST_PROPS_INT_RANGE (20,40), + "foo2", GST_PROPS_INT_RANGE (20,40), + "foo3", GST_PROPS_INT_RANGE (10,20) + ) +); + +GST_CAPS_FACTORY (mp1parsecaps, + GST_CAPS_NEW ( + "mp1parse_src", + "video/mpeg", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "foo4", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ) + ) +); + + + +GST_CAPS_FACTORY (rawcaps, + GST_CAPS_NEW ( + "mpeg2dec_src", + "video/raw", + "width", GST_PROPS_INT_RANGE (16, 4096), + "height", GST_PROPS_INT_RANGE (16, 4096), + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ) + ) +); + +GST_CAPS_FACTORY (rawcaps2, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ), + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ) +); + +GST_CAPS_FACTORY (rawcaps3, + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ), + GST_CAPS_NEW ( + "raw_sink_caps", + "video/raw", + "height", GST_PROPS_INT_RANGE (16, 256), + "depth", GST_PROPS_INT (16) + ), + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + + +GST_CAPS_FACTORY (rawcaps4, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); + +GST_CAPS_FACTORY (rawcaps5, + GST_CAPS_NEW ( + "raw2_sink_caps", + "video/raw", + "fourcc", GST_PROPS_LIST ( + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), + GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) + ), + "height", GST_PROPS_INT_RANGE (16, 4096) + ) +); +int +main (int argc, char *argv[]) +{ + gboolean testret; + xmlDocPtr doc; + xmlNodePtr parent; + GstCaps *caps; + gint i; + + gst_init (&argc, &argv); + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); + + caps = gst_caps_normalize (GST_CAPS_GET (sinkcaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (mp1parsecaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (rawcaps)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (rawcaps2)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + caps = gst_caps_normalize (GST_CAPS_GET (rawcaps3)); + parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL); + gst_caps_save_thyself (caps, parent); + + xmlDocDump(stdout, doc); + + return 0; +} -- 2.7.4