f148b4ae123211176e1459c409d184e78bfe9cd0
[platform/upstream/gstreamer.git] / tests / old / testsuite / caps / intersect2.c
1 #include <gst/gst.h>
2
3 GstStaticCaps rawcaps1 = GST_STATIC_CAPS ("video/x-raw-yuv, "
4     "fourcc:fourcc=\"YUYV\", "
5     "height:int=640, "
6     "width:int=480, "
7     "framerate:float=30.0; "
8     "video/x-raw-yuv, "
9     "fourcc:fourcc=\"I420\", "
10     "height:int=640, " "width:int=480, " "framerate:float=30.0");
11
12 GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/x-raw-yuv");
13
14 GstStaticCaps rawcaps3 =
15 GST_STATIC_CAPS ("video/x-raw-yuv, height=(int) [ 0, MAX ]");
16
17 GstStaticCaps rawcaps4 =
18     GST_STATIC_CAPS
19     ("video/x-raw-yuv, format=(fourcc)YUY2; video/x-raw-yuv, format=(fourcc)UYVY");
20
21 GstStaticCaps rawcaps5 =
22     GST_STATIC_CAPS
23     ("video/x-raw-yuv, format=(fourcc)YUY2, framerate=(double)[0,1.79769e+308], width=(int)[0,2147483647], height=(int)[0,2147483647]; video/x-raw-yuv, format=(fourcc)UYVY, framerate=(double)[0,1.79769e+308], width=(int)[0,2147483647], height=(int)[0,2147483647]");
24
25 GstStaticCaps rawcaps6 =
26 GST_STATIC_CAPS
27     ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240");
28
29 GstStaticCaps rawcaps7 =
30 GST_STATIC_CAPS
31     ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[0,2147483647], height=(int)[0,2147483647], framerate=(double)[0,1.79769e+308]");
32
33 GstStaticCaps rawcaps8 =
34 GST_STATIC_CAPS
35     ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240");
36
37
38 int
39 main (int argc, char *argv[])
40 {
41   GstCaps *caps1;
42   GstCaps *caps2;
43   GstCaps *caps3;
44   GstCaps *caps4;
45   GstCaps *caps;
46
47   gst_init (&argc, &argv);
48
49   caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps1));
50   caps2 =
51       gst_caps_new_full (gst_structure_copy (gst_caps_get_structure
52           (gst_static_caps_get (&rawcaps1), 0)), NULL);
53
54 #if 0
55   gst_caps_set (caps1, "height", GST_PROPS_INT (640));
56   gst_caps_set (caps1, "width", GST_PROPS_INT (480));
57   gst_caps_set (caps1, "framerate", GST_PROPS_FLOAT (30.0));
58 #endif
59
60   caps = gst_caps_intersect (caps1, caps2);
61   g_print ("caps %s\n", gst_caps_to_string (caps));
62   if (gst_caps_is_empty (caps))
63     return 1;
64   gst_caps_free (caps1);
65   gst_caps_free (caps2);
66
67   caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps2));
68   caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps3));
69   caps = gst_caps_intersect (caps1, caps2);
70   g_print ("caps %s\n", gst_caps_to_string (caps));
71   if (gst_caps_is_empty (caps))
72     return 1;
73   gst_caps_free (caps1);
74   gst_caps_free (caps2);
75
76   caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps4));
77   caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps5));
78   caps3 = gst_caps_copy (gst_static_caps_get (&rawcaps6));
79   caps4 = gst_caps_intersect (caps1, caps2);
80   caps = gst_caps_intersect (caps3, caps4);
81   g_print ("caps4 %s\n", gst_caps_to_string (caps4));
82   g_print ("caps %s\n", gst_caps_to_string (caps));
83   gst_caps_free (caps1);
84   gst_caps_free (caps2);
85   gst_caps_free (caps3);
86   gst_caps_free (caps4);
87
88   caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps7));
89   caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps8));
90   caps = gst_caps_intersect (caps1, caps2);
91   g_print ("caps %s\n", gst_caps_to_string (caps));
92   if (gst_caps_is_empty (caps))
93     return 1;
94   gst_caps_free (caps1);
95   gst_caps_free (caps2);
96
97   return 0;
98 }