Merge CAPS branch
[platform/upstream/gstreamer.git] / tests / old / testsuite / caps / intersection.c
1 #include <gst/gst.h>
2
3 /* these caps all have a non empty intersection */
4 GstStaticCaps sinkcaps = GST_STATIC_CAPS (
5   "video/mpeg, "
6     "mpegtype=(int)1, "
7     "foo1=(int)[20,40], "
8     "foo2=(int)[20,40], "
9     "foo3=(int)[10,20]"
10 );
11
12 GstStaticCaps mp1parsecaps = GST_STATIC_CAPS (
13   "video/mpeg, "
14     "mpegtype=(int)1, "
15     "foo1=(int)30, "
16     "foo2=(int)[20,30], "
17     "foo3=(int)[20,30]"
18 );
19
20
21
22 GstStaticCaps rawcaps = GST_STATIC_CAPS (
23   "video/raw, "
24     "width=(int)[16,4096], "
25     "height=(int)[16,4096]"
26 );
27
28 GstStaticCaps rawcaps2 = GST_STATIC_CAPS (
29   "video/raw, "
30     "height=(int)[16,256], "
31     "depth=(int)16"
32 );
33
34 GstStaticCaps rawcaps3 = GST_STATIC_CAPS (
35   "video/raw, "
36     "fourcc=(fourcc){\"YUY2\", \"YV12\" }, "
37     "height=(int)[16,4096]"
38 );
39
40 GstStaticCaps rawcaps4 = GST_STATIC_CAPS (
41   "video/raw, "
42     "fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, "
43     "height=(int)[16,4096]"
44 );
45
46 GstStaticCaps rawcaps5 = GST_STATIC_CAPS (
47   "video/raw, "
48     "fourcc=(fourcc){\"YUYV\",\"YUY2\"}, "
49     "height=(int)[16,4096]"
50 );
51
52 GstStaticCaps rawcaps6 = GST_STATIC_CAPS (
53   "video/raw, "
54     "fourcc=(fourcc)\"YUYV\", "
55     "height=(int)640, "
56     "width=(int)480, "
57     "framerate=(double)30.0; "
58   "video/raw, "
59     "fourcc=(fourcc)\"I420\", "
60     "height=(int)640, "
61     "width=(int)480, "
62     "framerate=(double)30.0"
63 );
64
65 int 
66 main (int argc, char *argv[]) 
67 {
68   xmlDocPtr doc;
69   xmlNodePtr parent;
70   GstCaps *caps;
71
72   gst_init (&argc, &argv);
73
74   doc = xmlNewDoc ("1.0");
75   doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
76
77   /*
78   g_mem_chunk_info ();
79   for (i = 0; i<100000; i++) {
80     caps = gst_caps_intersect (gst_static_caps_get (rawcaps3), GST_CAPS_GET (rawcaps4));
81     gst_caps_unref (caps);
82   }
83   g_mem_chunk_info ();
84   */
85
86   caps = gst_caps_intersect (gst_static_caps_get (&sinkcaps),
87       gst_static_caps_get (&mp1parsecaps));
88   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
89   gst_caps_save_thyself (caps, parent);
90
91   caps = gst_caps_intersect (gst_static_caps_get (&rawcaps),
92       gst_static_caps_get (&rawcaps2));
93   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
94   gst_caps_save_thyself (caps, parent);
95
96   caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3),
97       gst_static_caps_get (&rawcaps4));
98   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
99   gst_caps_save_thyself (caps, parent);
100
101   caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3),
102       gst_static_caps_get (&rawcaps5));
103   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
104   gst_caps_save_thyself (caps, parent);
105
106   caps = gst_caps_intersect (gst_static_caps_get (&rawcaps6),
107       gst_caps_copy_1(gst_static_caps_get (&rawcaps6)));
108   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
109   gst_caps_save_thyself (caps, parent);
110
111   xmlDocDump(stdout, doc);
112
113   return 0;
114 }