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