1 | /* GStreamer |
---|
2 | * Copyright (C) 2003 David A. Schleef <ds@schleef.org> |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU Library 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 | * Library General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU Library General Public |
---|
15 | * License along with this library; if not, write to the |
---|
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
17 | * Boston, MA 02111-1307, USA. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef __GST_CAPS_H__ |
---|
21 | #define __GST_CAPS_H__ |
---|
22 | |
---|
23 | #include <gst/gstconfig.h> |
---|
24 | #include <gst/gststructure.h> |
---|
25 | |
---|
26 | G_BEGIN_DECLS |
---|
27 | |
---|
28 | #define GST_TYPE_CAPS (gst_caps_get_type()) |
---|
29 | #define GST_CAPS(object) ((GstCaps*)object) |
---|
30 | #define GST_IS_CAPS(object) ((object) && (GST_CAPS(object)->type == GST_TYPE_CAPS)) |
---|
31 | |
---|
32 | #define GST_CAPS_FLAGS_ANY (1 << 0) |
---|
33 | |
---|
34 | #define GST_CAPS_ANY gst_caps_new_any() |
---|
35 | #define GST_CAPS_NONE gst_caps_new_empty() |
---|
36 | |
---|
37 | #define GST_STATIC_CAPS_ANY GST_STATIC_CAPS("ANY") |
---|
38 | #define GST_STATIC_CAPS_NONE GST_STATIC_CAPS("NONE") |
---|
39 | |
---|
40 | #define GST_CAPS_IS_SIMPLE(caps) (gst_caps_get_size(caps) == 1) |
---|
41 | #define gst_caps_is_simple(caps) GST_CAPS_IS_SIMPLE(caps) |
---|
42 | |
---|
43 | #ifndef GST_DISABLE_DEPRECATED |
---|
44 | #define GST_DEBUG_CAPS(string, caps) \ |
---|
45 | GST_DEBUG ( string "%s: " GST_PTR_FORMAT, caps) |
---|
46 | #endif |
---|
47 | |
---|
48 | #define GST_STATIC_CAPS(string) \ |
---|
49 | { \ |
---|
50 | /* caps */ { 0 }, \ |
---|
51 | /* string */ string, \ |
---|
52 | } |
---|
53 | |
---|
54 | typedef struct _GstCaps GstCaps; |
---|
55 | typedef struct _GstStaticCaps GstStaticCaps; |
---|
56 | |
---|
57 | struct _GstCaps { |
---|
58 | GType type; |
---|
59 | |
---|
60 | guint16 flags; |
---|
61 | GPtrArray *structs; |
---|
62 | |
---|
63 | gpointer _gst_reserved[GST_PADDING]; |
---|
64 | }; |
---|
65 | |
---|
66 | struct _GstStaticCaps { |
---|
67 | GstCaps caps; |
---|
68 | const char *string; |
---|
69 | gpointer _gst_reserved[GST_PADDING]; |
---|
70 | }; |
---|
71 | |
---|
72 | GType gst_caps_get_type (void) G_GNUC_CONST; |
---|
73 | GstCaps * gst_caps_new_empty (void); |
---|
74 | GstCaps * gst_caps_new_any (void); |
---|
75 | GstCaps * gst_caps_new_simple (const char *media_type, |
---|
76 | const char *fieldname, |
---|
77 | ...); |
---|
78 | GstCaps * gst_caps_new_full (GstStructure *struct1, |
---|
79 | ...); |
---|
80 | GstCaps * gst_caps_new_full_valist (GstStructure *structure, |
---|
81 | va_list var_args); |
---|
82 | GstCaps * gst_caps_copy (const GstCaps *caps); |
---|
83 | void gst_caps_free (GstCaps *caps); |
---|
84 | G_CONST_RETURN GstCaps * gst_static_caps_get (GstStaticCaps *static_caps); |
---|
85 | |
---|
86 | /* manipulation */ |
---|
87 | void gst_caps_append (GstCaps *caps1, |
---|
88 | GstCaps *caps2); |
---|
89 | void gst_caps_append_structure (GstCaps *caps, |
---|
90 | GstStructure *structure); |
---|
91 | int gst_caps_get_size (const GstCaps *caps); |
---|
92 | GstStructure * gst_caps_get_structure (const GstCaps *caps, |
---|
93 | int index); |
---|
94 | #ifndef GST_DISABLE_DEPRECATED |
---|
95 | GstCaps * gst_caps_split_one (GstCaps *caps); |
---|
96 | GstCaps * gst_caps_copy_1 (const GstCaps *caps); |
---|
97 | #endif |
---|
98 | void gst_caps_set_simple (GstCaps *caps, |
---|
99 | char *field, ...); |
---|
100 | void gst_caps_set_simple_valist (GstCaps *caps, |
---|
101 | char *field, |
---|
102 | va_list varargs); |
---|
103 | |
---|
104 | /* tests */ |
---|
105 | gboolean gst_caps_is_any (const GstCaps *caps); |
---|
106 | gboolean gst_caps_is_empty (const GstCaps *caps); |
---|
107 | #ifndef GST_DISABLE_DEPRECATED |
---|
108 | gboolean gst_caps_is_chained (const GstCaps *caps); |
---|
109 | gboolean gst_caps_is_equal_fixed (const GstCaps *caps1, |
---|
110 | const GstCaps *caps2); |
---|
111 | #endif |
---|
112 | gboolean gst_caps_is_fixed (const GstCaps *caps); |
---|
113 | gboolean gst_caps_is_always_compatible (const GstCaps *caps1, |
---|
114 | const GstCaps *caps2); |
---|
115 | gboolean gst_caps_is_subset (const GstCaps *subset, |
---|
116 | const GstCaps *superset); |
---|
117 | gboolean gst_caps_is_equal (const GstCaps *caps1, |
---|
118 | const GstCaps *caps2); |
---|
119 | |
---|
120 | /* operations */ |
---|
121 | GstCaps * gst_caps_intersect (const GstCaps *caps1, |
---|
122 | const GstCaps *caps2); |
---|
123 | GstCaps * gst_caps_subtract (const GstCaps *minuend, |
---|
124 | const GstCaps *subtrahend); |
---|
125 | GstCaps * gst_caps_union (const GstCaps *caps1, |
---|
126 | const GstCaps *caps2); |
---|
127 | GstCaps * gst_caps_normalize (const GstCaps *caps); |
---|
128 | #ifndef GST_DISABLE_DEPRECATED |
---|
129 | GstCaps * gst_caps_simplify (const GstCaps *caps); |
---|
130 | #endif |
---|
131 | gboolean gst_caps_do_simplify (GstCaps *caps); |
---|
132 | |
---|
133 | #ifndef GST_DISABLE_LOADSAVE |
---|
134 | xmlNodePtr gst_caps_save_thyself (const GstCaps *caps, |
---|
135 | xmlNodePtr parent); |
---|
136 | GstCaps * gst_caps_load_thyself (xmlNodePtr parent); |
---|
137 | #endif |
---|
138 | |
---|
139 | /* utility */ |
---|
140 | void gst_caps_replace (GstCaps **caps, |
---|
141 | GstCaps *newcaps); |
---|
142 | gchar * gst_caps_to_string (const GstCaps *caps); |
---|
143 | GstCaps * gst_caps_from_string (const gchar *string); |
---|
144 | |
---|
145 | gboolean gst_caps_structure_fixate_field_nearest_int (GstStructure *structure, |
---|
146 | const char *field_name, |
---|
147 | int target); |
---|
148 | gboolean gst_caps_structure_fixate_field_nearest_double (GstStructure *structure, |
---|
149 | const char *field_name, |
---|
150 | double target); |
---|
151 | |
---|
152 | G_END_DECLS |
---|
153 | |
---|
154 | #endif /* __GST_CAPS_H__ */ |
---|