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

Revision 21005, 1.3 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
2#include <gst/gst.h>
3
4void
5test1 (void)
6{
7  GValue dest = { 0 };
8  GValue src1 = { 0 };
9  GValue src2 = { 0 };
10  gboolean ret;
11
12  g_value_init (&src1, G_TYPE_INT);
13  g_value_set_int (&src1, 10);
14  g_value_init (&src2, G_TYPE_INT);
15  g_value_set_int (&src1, 20);
16  ret = gst_value_intersect (&dest, &src1, &src2);
17  g_assert (ret == 0);
18  g_print ("ret = %d\n", ret);
19}
20
21void
22test2 (void)
23{
24  GValue dest = { 0 };
25  GValue src1 = { 0 };
26  GValue src2 = { 0 };
27  GValue item = { 0 };
28  gboolean ret;
29
30  g_value_init (&src1, GST_TYPE_FOURCC);
31  gst_value_set_fourcc (&src1, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
32  g_value_init (&src2, GST_TYPE_LIST);
33  g_value_init (&item, GST_TYPE_FOURCC);
34  gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
35  gst_value_list_append_value (&src2, &item);
36  gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('I', '4', '2', '0'));
37  gst_value_list_append_value (&src2, &item);
38  gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('A', 'B', 'C', 'D'));
39  gst_value_list_append_value (&src2, &item);
40  ret = gst_value_intersect (&dest, &src1, &src2);
41  g_print ("ret = %d\n", ret);
42
43  g_print ("type = %s\n", g_type_name (G_VALUE_TYPE (&dest)));
44  g_print ("value = %s\n", g_strdup_value_contents (&dest));
45}
46
47int
48main (int argc, char *argv[])
49{
50
51  gst_init (&argc, &argv);
52
53  test1 ();
54  test2 ();
55
56  return 0;
57
58}
Note: See TracBrowser for help on using the repository browser.