|
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 #include <gst/glib-compat.h> |
|
26 |
|
27 G_BEGIN_DECLS |
|
28 |
|
29 #define GST_TYPE_CAPS (gst_caps_get_type()) |
|
30 #define GST_CAPS(object) ((GstCaps*)object) |
|
31 #define GST_IS_CAPS(object) ((object) && (GST_CAPS(object)->type == GST_TYPE_CAPS)) |
|
32 |
|
33 #define GST_TYPE_STATIC_CAPS (gst_static_caps_get_type()) |
|
34 |
|
35 /** |
|
36 * GstCapsFlags: |
|
37 * @GST_CAPS_FLAGS_ANY: Caps has no specific content, but can contain |
|
38 * anything. |
|
39 * |
|
40 * Extra flags for a caps. |
|
41 */ |
|
42 typedef enum { |
|
43 GST_CAPS_FLAGS_ANY = (1 << 0) |
|
44 } GstCapsFlags; |
|
45 |
|
46 /** |
|
47 * GST_CAPS_ANY: |
|
48 * |
|
49 * Means that the element/pad can output 'anything'. Useful for elements |
|
50 * that output unknown media, such as filesrc. |
|
51 */ |
|
52 #define GST_CAPS_ANY gst_caps_new_any() |
|
53 /** |
|
54 * GST_CAPS_NONE: |
|
55 * |
|
56 * The opposite of %GST_CAPS_ANY: it means that the pad/element outputs an |
|
57 * undefined media type that can not be detected. |
|
58 */ |
|
59 #define GST_CAPS_NONE gst_caps_new_empty() |
|
60 |
|
61 /** |
|
62 * GST_STATIC_CAPS_ANY: |
|
63 * |
|
64 * Creates a new #GstCaps static caps that matches anything. |
|
65 * This can be used in pad templates. |
|
66 */ |
|
67 #define GST_STATIC_CAPS_ANY GST_STATIC_CAPS("ANY") |
|
68 /** |
|
69 * GST_STATIC_CAPS_NONE: |
|
70 * |
|
71 * Creates a new #GstCaps static caps that matches nothing. |
|
72 * This can be used in pad templates. |
|
73 */ |
|
74 #define GST_STATIC_CAPS_NONE GST_STATIC_CAPS("NONE") |
|
75 |
|
76 /** |
|
77 * GST_CAPS_IS_SIMPLE: |
|
78 * @caps: the #GstCaps instance to check |
|
79 * |
|
80 * Convenience macro that checks if the number of structures in the given caps |
|
81 * is exactly one. |
|
82 */ |
|
83 #define GST_CAPS_IS_SIMPLE(caps) (gst_caps_get_size(caps) == 1) |
|
84 |
|
85 #ifndef GST_DISABLE_DEPRECATED |
|
86 /** |
|
87 * GST_DEBUG_CAPS: |
|
88 * @string: a string that should be prepended to the caps data. |
|
89 * @caps: the #GstCaps instance to print |
|
90 * |
|
91 * Convenience macro for printing out the contents of caps with GST_DEBUG(). |
|
92 * |
|
93 * Deprecated: do not use anymore |
|
94 */ |
|
95 #define GST_DEBUG_CAPS(string, caps) \ |
|
96 GST_DEBUG ( string "%s: " GST_PTR_FORMAT, caps) |
|
97 |
|
98 #endif /* GST_DISABLE_DEPRECATED */ |
|
99 |
|
100 /** |
|
101 * GST_STATIC_CAPS: |
|
102 * @string: the string describing the caps |
|
103 * |
|
104 * Creates a new #GstCaps static caps from an input string. |
|
105 * This can be used in pad templates. |
|
106 */ |
|
107 #define GST_STATIC_CAPS(string) \ |
|
108 { \ |
|
109 /* caps */ { 0, 0, (GstCapsFlags) 0, NULL, GST_PADDING_INIT }, \ |
|
110 /* string */ string, \ |
|
111 GST_PADDING_INIT \ |
|
112 } |
|
113 |
|
114 typedef struct _GstCaps GstCaps; |
|
115 typedef struct _GstStaticCaps GstStaticCaps; |
|
116 |
|
117 /* refcount */ |
|
118 /** |
|
119 * GST_CAPS_REFCOUNT: |
|
120 * @caps: a #GstCaps |
|
121 * |
|
122 * Get access to the reference count field of the caps |
|
123 */ |
|
124 #define GST_CAPS_REFCOUNT(caps) ((GST_CAPS(caps))->refcount) |
|
125 /** |
|
126 * GST_CAPS_REFCOUNT_VALUE: |
|
127 * @caps: a #GstCaps |
|
128 * |
|
129 * Get the reference count value of the caps. |
|
130 */ |
|
131 #define GST_CAPS_REFCOUNT_VALUE(caps) (g_atomic_int_get (&(GST_CAPS(caps))->refcount)) |
|
132 |
|
133 /** |
|
134 * GstCaps: |
|
135 * @type: GType of the caps |
|
136 * @refcount: the atomic refcount value |
|
137 * @flags: extra flags for the caps, read only. |
|
138 * |
|
139 * Object describing media types. |
|
140 */ |
|
141 struct _GstCaps { |
|
142 GType type; |
|
143 |
|
144 /*< public >*/ /* with COW */ |
|
145 /* refcounting */ |
|
146 gint refcount; |
|
147 |
|
148 /*< public >*/ /* read only */ |
|
149 GstCapsFlags flags; |
|
150 |
|
151 /*< private >*/ |
|
152 GPtrArray *structs; |
|
153 |
|
154 /*< private >*/ |
|
155 gpointer _gst_reserved[GST_PADDING]; |
|
156 }; |
|
157 |
|
158 /** |
|
159 * GstStaticCaps: |
|
160 * @caps: the cached #GstCaps |
|
161 * @string: a string describing a caps |
|
162 * |
|
163 * Datastructure to initialize #GstCaps from a string description usually |
|
164 * used in conjunction with GST_STATIC_CAPS() and gst_static_caps_get() to |
|
165 * instantiate a #GstCaps. |
|
166 */ |
|
167 struct _GstStaticCaps { |
|
168 /*< public >*/ |
|
169 GstCaps caps; |
|
170 const char *string; |
|
171 |
|
172 /*< private >*/ |
|
173 gpointer _gst_reserved[GST_PADDING]; |
|
174 }; |
|
175 #ifdef __SYMBIAN32__ |
|
176 IMPORT_C |
|
177 #endif |
|
178 |
|
179 |
|
180 GType gst_caps_get_type (void); |
|
181 #ifdef __SYMBIAN32__ |
|
182 IMPORT_C |
|
183 #endif |
|
184 |
|
185 GstCaps * gst_caps_new_empty (void); |
|
186 #ifdef __SYMBIAN32__ |
|
187 IMPORT_C |
|
188 #endif |
|
189 |
|
190 GstCaps * gst_caps_new_any (void); |
|
191 #ifdef __SYMBIAN32__ |
|
192 IMPORT_C |
|
193 #endif |
|
194 |
|
195 GstCaps * gst_caps_new_simple (const char *media_type, |
|
196 const char *fieldname, |
|
197 ...); |
|
198 #ifdef __SYMBIAN32__ |
|
199 IMPORT_C |
|
200 #endif |
|
201 |
|
202 GstCaps * gst_caps_new_full (GstStructure *struct1, ...); |
|
203 #ifdef __SYMBIAN32__ |
|
204 IMPORT_C |
|
205 #endif |
|
206 |
|
207 GstCaps * gst_caps_new_full_valist (GstStructure *structure, |
|
208 va_list var_args); |
|
209 |
|
210 /* reference counting */ |
|
211 #ifdef __SYMBIAN32__ |
|
212 IMPORT_C |
|
213 #endif |
|
214 |
|
215 GstCaps * gst_caps_ref (GstCaps *caps); |
|
216 #ifdef __SYMBIAN32__ |
|
217 IMPORT_C |
|
218 #endif |
|
219 |
|
220 GstCaps * gst_caps_copy (const GstCaps *caps); |
|
221 #ifdef __SYMBIAN32__ |
|
222 IMPORT_C |
|
223 #endif |
|
224 |
|
225 GstCaps * gst_caps_make_writable (GstCaps *caps); |
|
226 #ifdef __SYMBIAN32__ |
|
227 IMPORT_C |
|
228 #endif |
|
229 |
|
230 void gst_caps_unref (GstCaps *caps); |
|
231 #ifdef __SYMBIAN32__ |
|
232 IMPORT_C |
|
233 #endif |
|
234 |
|
235 |
|
236 GType gst_static_caps_get_type (void); |
|
237 #ifdef __SYMBIAN32__ |
|
238 IMPORT_C |
|
239 #endif |
|
240 |
|
241 GstCaps * gst_static_caps_get (GstStaticCaps *static_caps); |
|
242 |
|
243 /* manipulation */ |
|
244 #ifdef __SYMBIAN32__ |
|
245 IMPORT_C |
|
246 #endif |
|
247 |
|
248 void gst_caps_append (GstCaps *caps1, |
|
249 GstCaps *caps2); |
|
250 #ifdef __SYMBIAN32__ |
|
251 IMPORT_C |
|
252 #endif |
|
253 |
|
254 void gst_caps_merge (GstCaps *caps1, |
|
255 GstCaps *caps2); |
|
256 #ifdef __SYMBIAN32__ |
|
257 IMPORT_C |
|
258 #endif |
|
259 |
|
260 void gst_caps_append_structure (GstCaps *caps, |
|
261 GstStructure *structure); |
|
262 #ifdef __SYMBIAN32__ |
|
263 IMPORT_C |
|
264 #endif |
|
265 |
|
266 void gst_caps_remove_structure (GstCaps *caps, guint idx); |
|
267 #ifdef __SYMBIAN32__ |
|
268 IMPORT_C |
|
269 #endif |
|
270 |
|
271 void gst_caps_merge_structure (GstCaps *caps, |
|
272 GstStructure *structure); |
|
273 #ifdef __SYMBIAN32__ |
|
274 IMPORT_C |
|
275 #endif |
|
276 |
|
277 guint gst_caps_get_size (const GstCaps *caps); |
|
278 #ifdef __SYMBIAN32__ |
|
279 IMPORT_C |
|
280 #endif |
|
281 |
|
282 GstStructure * gst_caps_get_structure (const GstCaps *caps, |
|
283 guint index); |
|
284 #ifdef __SYMBIAN32__ |
|
285 IMPORT_C |
|
286 #endif |
|
287 |
|
288 GstCaps * gst_caps_copy_nth (const GstCaps *caps, guint nth); |
|
289 #ifdef __SYMBIAN32__ |
|
290 IMPORT_C |
|
291 #endif |
|
292 |
|
293 void gst_caps_truncate (GstCaps *caps); |
|
294 #ifdef __SYMBIAN32__ |
|
295 IMPORT_C |
|
296 #endif |
|
297 |
|
298 void gst_caps_set_simple (GstCaps *caps, |
|
299 char *field, ...) G_GNUC_NULL_TERMINATED; |
|
300 #ifdef __SYMBIAN32__ |
|
301 IMPORT_C |
|
302 #endif |
|
303 |
|
304 void gst_caps_set_simple_valist (GstCaps *caps, |
|
305 char *field, |
|
306 va_list varargs); |
|
307 |
|
308 /* tests */ |
|
309 #ifdef __SYMBIAN32__ |
|
310 IMPORT_C |
|
311 #endif |
|
312 |
|
313 gboolean gst_caps_is_any (const GstCaps *caps); |
|
314 #ifdef __SYMBIAN32__ |
|
315 IMPORT_C |
|
316 #endif |
|
317 |
|
318 gboolean gst_caps_is_empty (const GstCaps *caps); |
|
319 #ifdef __SYMBIAN32__ |
|
320 IMPORT_C |
|
321 #endif |
|
322 |
|
323 gboolean gst_caps_is_fixed (const GstCaps *caps); |
|
324 #ifdef __SYMBIAN32__ |
|
325 IMPORT_C |
|
326 #endif |
|
327 |
|
328 gboolean gst_caps_is_always_compatible (const GstCaps *caps1, |
|
329 const GstCaps *caps2); |
|
330 #ifdef __SYMBIAN32__ |
|
331 IMPORT_C |
|
332 #endif |
|
333 |
|
334 gboolean gst_caps_is_subset (const GstCaps *subset, |
|
335 const GstCaps *superset); |
|
336 #ifdef __SYMBIAN32__ |
|
337 IMPORT_C |
|
338 #endif |
|
339 |
|
340 gboolean gst_caps_is_equal (const GstCaps *caps1, |
|
341 const GstCaps *caps2); |
|
342 #ifdef __SYMBIAN32__ |
|
343 IMPORT_C |
|
344 #endif |
|
345 |
|
346 gboolean gst_caps_is_equal_fixed (const GstCaps *caps1, |
|
347 const GstCaps *caps2); |
|
348 |
|
349 |
|
350 /* operations */ |
|
351 #ifdef __SYMBIAN32__ |
|
352 IMPORT_C |
|
353 #endif |
|
354 |
|
355 GstCaps * gst_caps_intersect (const GstCaps *caps1, |
|
356 const GstCaps *caps2); |
|
357 #ifdef __SYMBIAN32__ |
|
358 IMPORT_C |
|
359 #endif |
|
360 |
|
361 GstCaps * gst_caps_subtract (const GstCaps *minuend, |
|
362 const GstCaps *subtrahend); |
|
363 #ifdef __SYMBIAN32__ |
|
364 IMPORT_C |
|
365 #endif |
|
366 |
|
367 GstCaps * gst_caps_union (const GstCaps *caps1, |
|
368 const GstCaps *caps2); |
|
369 #ifdef __SYMBIAN32__ |
|
370 IMPORT_C |
|
371 #endif |
|
372 |
|
373 GstCaps * gst_caps_normalize (const GstCaps *caps); |
|
374 #ifdef __SYMBIAN32__ |
|
375 IMPORT_C |
|
376 #endif |
|
377 |
|
378 gboolean gst_caps_do_simplify (GstCaps *caps); |
|
379 |
|
380 #ifndef GST_DISABLE_LOADSAVE |
|
381 xmlNodePtr gst_caps_save_thyself (const GstCaps *caps, |
|
382 xmlNodePtr parent); |
|
383 GstCaps * gst_caps_load_thyself (xmlNodePtr parent); |
|
384 #endif |
|
385 |
|
386 /* utility */ |
|
387 #ifdef __SYMBIAN32__ |
|
388 IMPORT_C |
|
389 #endif |
|
390 |
|
391 void gst_caps_replace (GstCaps **caps, |
|
392 GstCaps *newcaps); |
|
393 #ifdef __SYMBIAN32__ |
|
394 IMPORT_C |
|
395 #endif |
|
396 |
|
397 gchar * gst_caps_to_string (const GstCaps *caps); |
|
398 #ifdef __SYMBIAN32__ |
|
399 IMPORT_C |
|
400 #endif |
|
401 |
|
402 GstCaps * gst_caps_from_string (const gchar *string); |
|
403 |
|
404 G_END_DECLS |
|
405 |
|
406 #endif /* __GST_CAPS_H__ */ |