summaryrefslogtreecommitdiff
path: root/testsuite/caps/intersection.c
blob: 536042b8cf6e1af3c292295ece993743682bdf22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <gst/gst.h>

/* these caps all have a non empty intersection */
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
  "video/mpeg, "
    "mpegtype=(int)1, "
    "foo1=(int)[20,40], "
    "foo2=(int)[20,40], "
    "foo3=(int)[10,20]"
);

GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
  "video/mpeg, "
    "mpegtype=(int)1, "
    "foo1=(int)30, "
    "foo2=(int)[20,30], "
    "foo3=(int)[20,30]"
);



GstStaticCaps2 rawcaps = GST_STATIC_CAPS (
  "video/raw, "
    "width=(int)[16,4096], "
    "height=(int)[16,4096]"
);

GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS (
  "video/raw, "
    "height=(int)[16,256], "
    "depth=(int)16"
);

GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS (
  "video/raw, "
    "fourcc=(fourcc){\"YUY2\", \"YV12\" }, "
    "height=(int)[16,4096]"
);

GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS (
  "video/raw, "
    "fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, "
    "height=(int)[16,4096]"
);

GstStaticCaps2 rawcaps5 = GST_STATIC_CAPS (
  "video/raw, "
    "fourcc=(fourcc){\"YUYV\",\"YUY2\"}, "
    "height=(int)[16,4096]"
);

GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS (
  "video/raw, "
    "fourcc=(fourcc)\"YUYV\", "
    "height=(int)640, "
    "width=(int)480, "
    "framerate=(double)30.0; "
  "video/raw, "
    "fourcc=(fourcc)\"I420\", "
    "height=(int)640, "
    "width=(int)480, "
    "framerate=(double)30.0"
);

int 
main (int argc, char *argv[]) 
{
  xmlDocPtr doc;
  xmlNodePtr parent;
  GstCaps2 *caps;

  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_caps2_intersect (gst_static_caps2_get (rawcaps3), GST_CAPS_GET (rawcaps4));
    gst_caps2_unref (caps);
  }
  g_mem_chunk_info ();
  */

  caps = gst_caps2_intersect (gst_static_caps2_get (&sinkcaps),
      gst_static_caps2_get (&mp1parsecaps));
  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
  gst_caps2_save_thyself (caps, parent);

  caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps),
      gst_static_caps2_get (&rawcaps2));
  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
  gst_caps2_save_thyself (caps, parent);

  caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps3),
      gst_static_caps2_get (&rawcaps4));
  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
  gst_caps2_save_thyself (caps, parent);

  caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps3),
      gst_static_caps2_get (&rawcaps5));
  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
  gst_caps2_save_thyself (caps, parent);

  caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps6),
      gst_caps2_copy_1(gst_static_caps2_get (&rawcaps6)));
  parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
  gst_caps2_save_thyself (caps, parent);

  xmlDocDump(stdout, doc);

  return 0;
}