source: trunk/third/gstreamer/testsuite/caps/intersection.c @ 21005

Revision 21005, 3.4 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21004, which included commits to RCS files with non-trunk default branches.
Line 
1#include <gst/gst.h>
2
3/* these caps all have a non empty intersection */
4GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, "
5    "mpegtype=(int)1, "
6    "foo1=(int)[20,40], " "foo2=(int)[20,40], " "foo3=(int)[10,20]");
7
8GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, "
9    "mpegtype=(int)1, "
10    "foo1=(int)30, " "foo2=(int)[20,30], " "foo3=(int)[20,30]");
11
12
13
14GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, "
15    "width=(int)[16,4096], " "height=(int)[16,4096]");
16
17GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, "
18    "height=(int)[16,256], " "depth=(int)16");
19
20GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, "
21    "fourcc=(fourcc){\"YUY2\", \"YV12\" }, " "height=(int)[16,4096]");
22
23GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, "
24    "fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, " "height=(int)[16,4096]");
25
26GstStaticCaps rawcaps5 = GST_STATIC_CAPS ("video/raw, "
27    "fourcc=(fourcc){\"YUYV\",\"YUY2\"}, " "height=(int)[16,4096]");
28
29GstStaticCaps rawcaps6 = GST_STATIC_CAPS ("video/raw, "
30    "fourcc=(fourcc)\"YUYV\", "
31    "height=(int)640, "
32    "width=(int)480, "
33    "framerate=(double)30.0; "
34    "video/raw, "
35    "fourcc=(fourcc)\"I420\", "
36    "height=(int)640, " "width=(int)480, " "framerate=(double)30.0");
37
38GstStaticCaps rawcaps7 =
39    GST_STATIC_CAPS
40    ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]");
41
42GstStaticCaps rawcaps8 =
43    GST_STATIC_CAPS
44    ("video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]");
45
46int
47main (int argc, char *argv[])
48{
49  xmlDocPtr doc;
50  xmlNodePtr parent;
51  GstCaps *caps;
52
53  gst_init (&argc, &argv);
54
55  doc = xmlNewDoc ("1.0");
56  doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
57
58  /*
59     g_mem_chunk_info ();
60     for (i = 0; i<100000; i++) {
61     caps = gst_caps_intersect (gst_static_caps_get (rawcaps3), GST_CAPS_GET (rawcaps4));
62     gst_caps_unref (caps);
63     }
64     g_mem_chunk_info ();
65   */
66
67  caps = gst_caps_intersect (gst_static_caps_get (&sinkcaps),
68      gst_static_caps_get (&mp1parsecaps));
69  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
70  gst_caps_save_thyself (caps, parent);
71
72  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps),
73      gst_static_caps_get (&rawcaps2));
74  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
75  gst_caps_save_thyself (caps, parent);
76
77  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3),
78      gst_static_caps_get (&rawcaps4));
79  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
80  gst_caps_save_thyself (caps, parent);
81
82  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3),
83      gst_static_caps_get (&rawcaps5));
84  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
85  gst_caps_save_thyself (caps, parent);
86
87  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps6),
88      gst_caps_new_full (gst_structure_copy (gst_caps_get_structure
89              (gst_static_caps_get (&rawcaps6), 0)), NULL));
90  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
91  gst_caps_save_thyself (caps, parent);
92
93  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7),
94      gst_static_caps_get (&rawcaps8));
95  g_print ("intersection: %s\n", gst_caps_to_string (caps));
96
97  xmlDocDump (stdout, doc);
98
99  return 0;
100}
Note: See TracBrowser for help on using the repository browser.