source: trunk/third/gstreamer/testsuite/caps/compatibility.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, " "mpegtype=(int)[1,2]");
5
6GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int)1");
7
8GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, "
9    "fourcc=(fourcc){YV12,YUY2}, "
10    "width=(int)[16,4096], " "height=(int)[16,4096]");
11
12GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, "
13    "fourcc=(fourcc)YUY2, " "height=(int)[16,256]");
14
15GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, "
16    "fourcc=(fourcc){YV12,YUY2}, " "height=(int)[16,4096]");
17
18#if 0
19/* these caps aren't used yet */
20GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, "
21    "fourcc=(fourcc){\"YV12\", \"YUYV\"}, " "height=(int)[16,4096]");
22
23GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, "
24    "fourcc=(fourcc){\"YUYV\", \"YUY2\"}, " "height=(int)[16,4096]");
25#endif
26
27GstStaticCaps rawcaps6 = GST_STATIC_CAPS ("video/raw, "
28    "format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YUYV\"");
29
30GstStaticCaps rawcaps7 = GST_STATIC_CAPS ("video/raw, "
31    "format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YV12\"");
32
33
34int
35main (int argc, char *argv[])
36{
37  gboolean testret;
38  gint ret = 0;
39
40  gst_init (&argc, &argv);
41
42  testret = gst_caps_is_always_compatible (gst_static_caps_get (&mp1parsecaps),
43      gst_static_caps_get (&rawcaps));
44  g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
45  ret = ret + (testret == FALSE) ? 0 : 1;
46
47  testret = gst_caps_is_always_compatible (gst_static_caps_get (&mp1parsecaps),
48      gst_static_caps_get (&sinkcaps));
49  g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
50  ret = ret + (testret == TRUE) ? 0 : 1;
51
52  testret = gst_caps_is_always_compatible (gst_static_caps_get (&sinkcaps),
53      gst_static_caps_get (&mp1parsecaps));
54  g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
55  ret = ret + (testret == FALSE) ? 0 : 1;
56
57  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps),
58      gst_static_caps_get (&rawcaps2));
59  g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
60  ret = ret + (testret == FALSE) ? 0 : 1;
61
62  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps),
63      gst_static_caps_get (&rawcaps3));
64  g_print ("2 <-> 5 == %d (valid)\n", testret);
65  ret = ret + (testret == TRUE) ? 0 : 1;
66
67  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps3),
68      gst_static_caps_get (&rawcaps));
69  g_print ("5 <-> 2 == %d (invalid)\n", testret);
70  ret = ret + (testret == FALSE) ? 0 : 1;
71
72  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps2),
73      gst_static_caps_get (&rawcaps3));
74  g_print ("3 <-> 5 == %d (valid)\n", testret);
75  ret = ret + (testret == TRUE) ? 0 : 1;
76
77  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps2),
78      gst_static_caps_get (&rawcaps));
79  g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
80  ret = ret + (testret == FALSE) ? 0 : 1;
81
82  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps),
83      gst_static_caps_get (&rawcaps));
84  g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
85  ret = ret + (testret == TRUE) ? 0 : 1;
86
87  testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps6),
88      gst_static_caps_get (&rawcaps7));
89  g_print ("6 <-> 7 == %d (invalid, second caps doesn't fit)\n", testret);
90  ret = ret + (testret == FALSE) ? 0 : 1;
91
92  return ret;
93}
Note: See TracBrowser for help on using the repository browser.