1 | /* |
---|
2 | * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU General Public |
---|
6 | * License as published by the Free Software Foundation; either |
---|
7 | * version 2 of the License, or (at your option) any later version. |
---|
8 | * |
---|
9 | * This library is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | * General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public |
---|
15 | * License along with this library; if not, write to the Free |
---|
16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
17 | */ |
---|
18 | |
---|
19 | #include <gst/gst.h> |
---|
20 | |
---|
21 | static void |
---|
22 | check_caps (const gchar * set, const gchar * subset) |
---|
23 | { |
---|
24 | GstCaps *one, *two, *test, *test2; |
---|
25 | |
---|
26 | g_print (" A = %s\n", set); |
---|
27 | one = gst_caps_from_string (set); |
---|
28 | g_print (" B = %s\n", subset); |
---|
29 | two = gst_caps_from_string (subset); |
---|
30 | /* basics */ |
---|
31 | test = gst_caps_subtract (one, one); |
---|
32 | g_assert (gst_caps_is_empty (test)); |
---|
33 | gst_caps_free (test); |
---|
34 | test = gst_caps_subtract (two, two); |
---|
35 | g_assert (gst_caps_is_empty (test)); |
---|
36 | gst_caps_free (test); |
---|
37 | test = gst_caps_subtract (two, one); |
---|
38 | g_assert (gst_caps_is_empty (test)); |
---|
39 | gst_caps_free (test); |
---|
40 | /* now the nice part */ |
---|
41 | test = gst_caps_subtract (one, two); |
---|
42 | g_assert (!gst_caps_is_empty (test)); |
---|
43 | g_print (" A - B = %s\n", gst_caps_to_string (test)); |
---|
44 | test2 = gst_caps_union (test, two); |
---|
45 | g_print ("A - B + B = %s\n", gst_caps_to_string (test2)); |
---|
46 | gst_caps_free (test); |
---|
47 | test = gst_caps_subtract (test2, one); |
---|
48 | g_assert (gst_caps_is_empty (test)); |
---|
49 | gst_caps_free (test); |
---|
50 | } |
---|
51 | |
---|
52 | gint |
---|
53 | main (gint argc, gchar ** argv) |
---|
54 | { |
---|
55 | gst_init (&argc, &argv); |
---|
56 | |
---|
57 | check_caps ("some/mime, _int = [ 1, 2 ], list = { \"A\", \"B\", \"C\" }", |
---|
58 | "some/mime, _int = 1, list = \"A\""); |
---|
59 | check_caps ("some/mime, _double = (double) 1.0; other/mime, _int = { 1, 2 }", |
---|
60 | "some/mime, _double = (double) 1.0"); |
---|
61 | |
---|
62 | return 0; |
---|
63 | } |
---|