1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gstreamer-GstCaps.html
27  * outPack = gstreamer
28  * outFile = Caps
29  * strct   = GstCaps
30  * realStrct=
31  * ctorStrct=
32  * clss    = Caps
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_caps_
41  * 	- gst_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * 	- gst_caps_new_any
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- gobject.Value
50  * 	- gstreamer.CapsFeatures
51  * 	- gstreamer.Structure
52  * structWrap:
53  * 	- GValue* -> Value
54  * 	- GstCaps* -> Caps
55  * 	- GstCapsFeatures* -> CapsFeatures
56  * 	- GstStructure* -> Structure
57  * module aliases:
58  * local aliases:
59  * overrides:
60  * 	- toString
61  */
62 
63 module gstreamer.Caps;
64 
65 public  import gstreamerc.gstreamertypes;
66 
67 private import gstreamerc.gstreamer;
68 private import glib.ConstructionException;
69 private import gobject.ObjectG;
70 
71 private import glib.Str;
72 private import gobject.Value;
73 private import gstreamer.CapsFeatures;
74 private import gstreamer.Structure;
75 
76 
77 
78 /**
79  * Caps (capabilities) are lightweight refcounted objects describing media types.
80  * They are composed of an array of GstStructure.
81  *
82  * Caps are exposed on GstPadTemplate to describe all possible types a
83  * given pad can handle. They are also stored in the GstRegistry along with
84  * a description of the GstElement.
85  *
86  * Caps are exposed on the element pads using the gst_pad_query_caps() pad
87  * function. This function describes the possible types that the pad can
88  * handle or produce at runtime.
89  *
90  * A GstCaps can be constructed with the following code fragment:
91  *
92  * $(DDOC_COMMENT example)
93  *
94  * A GstCaps is fixed when it has no properties with ranges or lists. Use
95  * gst_caps_is_fixed() to test for fixed caps. Fixed caps can be used in a
96  * caps event to notify downstream elements of the current media type.
97  *
98  * Various methods exist to work with the media types such as subtracting
99  * or intersecting.
100  *
101  * Last reviewed on 2011-03-28 (0.11.3)
102  */
103 public class Caps
104 {
105 	
106 	/** the main Gtk struct */
107 	protected GstCaps* gstCaps;
108 	
109 	
110 	/** Get the main Gtk struct */
111 	public GstCaps* getCapsStruct()
112 	{
113 		return gstCaps;
114 	}
115 	
116 	
117 	/** the main Gtk struct as a void* */
118 	protected void* getStruct()
119 	{
120 		return cast(void*)gstCaps;
121 	}
122 	
123 	/**
124 	 * Sets our main struct and passes it to the parent class
125 	 */
126 	public this (GstCaps* gstCaps)
127 	{
128 		this.gstCaps = gstCaps;
129 	}
130 	
131 	/**
132 	 * Creates a new GstCaps that indicates that it is compatible with
133 	 * any media format.
134 	 * Returns:
135 	 *  the new GstCaps
136 	 */
137 	public static Caps newAny()
138 	{
139 		// GstCaps* gst_caps_new_any (void);
140 		auto p = cast(GstCaps*)gst_caps_new_any();
141 		
142 		if(p is null)
143 		{
144 			throw new ConstructionException("null returned by gst_caps_new_any");
145 		}
146 		
147 		return new Caps(cast(GstCaps*)p );
148 	}
149 	
150 	/**
151 	 */
152 	
153 	/**
154 	 * Creates a new GstCaps that is empty. That is, the returned
155 	 * GstCaps contains no media formats.
156 	 * The GstCaps is guaranteed to be writable.
157 	 * Caller is responsible for unreffing the returned caps.
158 	 * Throws: ConstructionException GTK+ fails to create the object.
159 	 */
160 	public this ()
161 	{
162 		// GstCaps * gst_caps_new_empty (void);
163 		auto p = gst_caps_new_empty();
164 		if(p is null)
165 		{
166 			throw new ConstructionException("null returned by gst_caps_new_empty()");
167 		}
168 		this(cast(GstCaps*) p);
169 	}
170 	
171 	/**
172 	 * Creates a new GstCaps that contains one GstStructure with name
173 	 * media_type.
174 	 * Caller is responsible for unreffing the returned caps.
175 	 * Params:
176 	 * mediaType = the media type of the structure
177 	 * Throws: ConstructionException GTK+ fails to create the object.
178 	 */
179 	public this (string mediaType)
180 	{
181 		// GstCaps * gst_caps_new_empty_simple (const char *media_type);
182 		auto p = gst_caps_new_empty_simple(Str.toStringz(mediaType));
183 		if(p is null)
184 		{
185 			throw new ConstructionException("null returned by gst_caps_new_empty_simple(Str.toStringz(mediaType))");
186 		}
187 		this(cast(GstCaps*) p);
188 	}
189 	
190 	/**
191 	 * Creates a new GstCaps and adds all the structures listed as
192 	 * arguments. The list must be NULL-terminated. The structures
193 	 * are not copied; the returned GstCaps owns the structures.
194 	 * Params:
195 	 * structure = the first structure to add
196 	 * varArgs = additional structures to add
197 	 * Throws: ConstructionException GTK+ fails to create the object.
198 	 */
199 	public this (Structure structure, void* varArgs)
200 	{
201 		// GstCaps * gst_caps_new_full_valist (GstStructure *structure,  va_list var_args);
202 		auto p = gst_caps_new_full_valist((structure is null) ? null : structure.getStructureStruct(), varArgs);
203 		if(p is null)
204 		{
205 			throw new ConstructionException("null returned by gst_caps_new_full_valist((structure is null) ? null : structure.getStructureStruct(), varArgs)");
206 		}
207 		this(cast(GstCaps*) p);
208 	}
209 	
210 	/**
211 	 * Creates a new GstCaps as a copy of the old caps. The new caps will have a
212 	 * refcount of 1, owned by the caller. The structures are copied as well.
213 	 * Note that this function is the semantic equivalent of a gst_caps_ref()
214 	 * followed by a gst_caps_make_writable(). If you only want to hold on to a
215 	 * reference to the data, you should use gst_caps_ref().
216 	 * When you are finished with the caps, call gst_caps_unref() on it.
217 	 * Returns: the new GstCaps
218 	 */
219 	public Caps copy()
220 	{
221 		// GstCaps * gst_caps_copy (const GstCaps *caps);
222 		auto p = gst_caps_copy(gstCaps);
223 		
224 		if(p is null)
225 		{
226 			return null;
227 		}
228 		
229 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
230 	}
231 	
232 	/**
233 	 * Creates a new GstCaps and appends a copy of the nth structure
234 	 * contained in caps.
235 	 * Params:
236 	 * nth = the nth structure to copy
237 	 * Returns: the new GstCaps. [transfer full]
238 	 */
239 	public Caps copyNth(uint nth)
240 	{
241 		// GstCaps * gst_caps_copy_nth (const GstCaps *caps,  guint nth);
242 		auto p = gst_caps_copy_nth(gstCaps, nth);
243 		
244 		if(p is null)
245 		{
246 			return null;
247 		}
248 		
249 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
250 	}
251 	
252 	/**
253 	 * Converts a GstStaticCaps to a GstCaps.
254 	 * Params:
255 	 * staticCaps = the GstStaticCaps to convert
256 	 * Returns: a pointer to the GstCaps. Unref after usage. Since the core holds an additional ref to the returned caps, use gst_caps_make_writable() on the returned caps to modify it. [transfer full]
257 	 */
258 	public static Caps staticCapsGet(GstStaticCaps* staticCaps)
259 	{
260 		// GstCaps * gst_static_caps_get (GstStaticCaps *static_caps);
261 		auto p = gst_static_caps_get(staticCaps);
262 		
263 		if(p is null)
264 		{
265 			return null;
266 		}
267 		
268 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
269 	}
270 	
271 	/**
272 	 * Clean up the cached caps contained in static_caps.
273 	 * Params:
274 	 * staticCaps = the GstStaticCaps to clean
275 	 */
276 	public static void staticCapsCleanup(GstStaticCaps* staticCaps)
277 	{
278 		// void gst_static_caps_cleanup (GstStaticCaps *static_caps);
279 		gst_static_caps_cleanup(staticCaps);
280 	}
281 	
282 	/**
283 	 * Appends the structures contained in caps2 to caps1. The structures in
284 	 * caps2 are not copied -- they are transferred to caps1, and then caps2 is
285 	 * freed. If either caps is ANY, the resulting caps will be ANY.
286 	 * Params:
287 	 * caps2 = the GstCaps to append. [transfer full]
288 	 */
289 	public void append(Caps caps2)
290 	{
291 		// void gst_caps_append (GstCaps *caps1,  GstCaps *caps2);
292 		gst_caps_append(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
293 	}
294 	
295 	/**
296 	 * Appends the structures contained in caps2 to caps1 if they are not yet
297 	 * expressed by caps1. The structures in caps2 are not copied -- they are
298 	 * transferred to a writable copy of caps1, and then caps2 is freed.
299 	 * If either caps is ANY, the resulting caps will be ANY.
300 	 * Params:
301 	 * caps2 = the GstCaps to merge in. [transfer full]
302 	 * Returns: the merged caps. [transfer full]
303 	 */
304 	public Caps merge(Caps caps2)
305 	{
306 		// GstCaps * gst_caps_merge (GstCaps *caps1,  GstCaps *caps2);
307 		auto p = gst_caps_merge(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
308 		
309 		if(p is null)
310 		{
311 			return null;
312 		}
313 		
314 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
315 	}
316 	
317 	/**
318 	 * Appends structure to caps. The structure is not copied; caps
319 	 * becomes the owner of structure.
320 	 * Params:
321 	 * structure = the GstStructure to append. [transfer full]
322 	 */
323 	public void appendStructure(Structure structure)
324 	{
325 		// void gst_caps_append_structure (GstCaps *caps,  GstStructure *structure);
326 		gst_caps_append_structure(gstCaps, (structure is null) ? null : structure.getStructureStruct());
327 	}
328 	
329 	/**
330 	 * Appends structure with features to caps. The structure is not copied; caps
331 	 * becomes the owner of structure.
332 	 * Since 1.2
333 	 * Params:
334 	 * structure = the GstStructure to append. [transfer full]
335 	 * features = the GstCapsFeatures to append. [transfer full][allow-none]
336 	 */
337 	public void appendStructureFull(Structure structure, CapsFeatures features)
338 	{
339 		// void gst_caps_append_structure_full (GstCaps *caps,  GstStructure *structure,  GstCapsFeatures *features);
340 		gst_caps_append_structure_full(gstCaps, (structure is null) ? null : structure.getStructureStruct(), (features is null) ? null : features.getCapsFeaturesStruct());
341 	}
342 	
343 	/**
344 	 * removes the stucture with the given index from the list of structures
345 	 * contained in caps.
346 	 * Params:
347 	 * idx = Index of the structure to remove
348 	 */
349 	public void removeStructure(uint idx)
350 	{
351 		// void gst_caps_remove_structure (GstCaps *caps,  guint idx);
352 		gst_caps_remove_structure(gstCaps, idx);
353 	}
354 	
355 	/**
356 	 * Retrieves the structure with the given index from the list of structures
357 	 * contained in caps. The caller becomes the owner of the returned structure.
358 	 * Params:
359 	 * index = Index of the structure to retrieve
360 	 * Returns: a pointer to the GstStructure corresponding to index. [transfer full]
361 	 */
362 	public Structure stealStructure(uint index)
363 	{
364 		// GstStructure * gst_caps_steal_structure (GstCaps *caps,  guint index);
365 		auto p = gst_caps_steal_structure(gstCaps, index);
366 		
367 		if(p is null)
368 		{
369 			return null;
370 		}
371 		
372 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
373 	}
374 	
375 	/**
376 	 * Appends structure to caps if its not already expressed by caps.
377 	 * Params:
378 	 * structure = the GstStructure to merge. [transfer full]
379 	 * Returns: the merged caps. [transfer full]
380 	 */
381 	public Caps mergeStructure(Structure structure)
382 	{
383 		// GstCaps * gst_caps_merge_structure (GstCaps *caps,  GstStructure *structure);
384 		auto p = gst_caps_merge_structure(gstCaps, (structure is null) ? null : structure.getStructureStruct());
385 		
386 		if(p is null)
387 		{
388 			return null;
389 		}
390 		
391 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
392 	}
393 	
394 	/**
395 	 * Appends structure with features to caps if its not already expressed by caps.
396 	 * Since 1.2
397 	 * Params:
398 	 * structure = the GstStructure to merge. [transfer full]
399 	 * features = the GstCapsFeatures to merge. [transfer full][allow-none]
400 	 * Returns: the merged caps. [transfer full]
401 	 */
402 	public Caps mergeStructureFull(Structure structure, CapsFeatures features)
403 	{
404 		// GstCaps * gst_caps_merge_structure_full (GstCaps *caps,  GstStructure *structure,  GstCapsFeatures *features);
405 		auto p = gst_caps_merge_structure_full(gstCaps, (structure is null) ? null : structure.getStructureStruct(), (features is null) ? null : features.getCapsFeaturesStruct());
406 		
407 		if(p is null)
408 		{
409 			return null;
410 		}
411 		
412 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
413 	}
414 	
415 	/**
416 	 * Gets the number of structures contained in caps.
417 	 * Returns: the number of structures that caps contains
418 	 */
419 	public uint getSize()
420 	{
421 		// guint gst_caps_get_size (const GstCaps *caps);
422 		return gst_caps_get_size(gstCaps);
423 	}
424 	
425 	/**
426 	 * Finds the structure in caps that has the index index, and
427 	 * returns it.
428 	 * WARNING: This function takes a const GstCaps *, but returns a
429 	 * non-const GstStructure *. This is for programming convenience --
430 	 * the caller should be aware that structures inside a constant
431 	 * GstCaps should not be modified. However, if you know the caps
432 	 * are writable, either because you have just copied them or made
433 	 * them writable with gst_caps_make_writable(), you may modify the
434 	 * structure returned in the usual way, e.g. with functions like
435 	 * gst_structure_set().
436 	 * You do not need to free or unref the structure returned, it
437 	 * belongs to the GstCaps.
438 	 * Params:
439 	 * index = the index of the structure
440 	 * Returns: a pointer to the GstStructure corresponding to index. [transfer none]
441 	 */
442 	public Structure getStructure(uint index)
443 	{
444 		// GstStructure * gst_caps_get_structure (const GstCaps *caps,  guint index);
445 		auto p = gst_caps_get_structure(gstCaps, index);
446 		
447 		if(p is null)
448 		{
449 			return null;
450 		}
451 		
452 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
453 	}
454 	
455 	/**
456 	 * Finds the features in caps that has the index index, and
457 	 * returns it.
458 	 * WARNING: This function takes a const GstCaps *, but returns a
459 	 * non-const GstCapsFeatures *. This is for programming convenience --
460 	 * the caller should be aware that structures inside a constant
461 	 * GstCaps should not be modified. However, if you know the caps
462 	 * are writable, either because you have just copied them or made
463 	 * them writable with gst_caps_make_writable(), you may modify the
464 	 * features returned in the usual way, e.g. with functions like
465 	 * gst_caps_features_add().
466 	 * You do not need to free or unref the structure returned, it
467 	 * belongs to the GstCaps.
468 	 * Since 1.2
469 	 * Params:
470 	 * index = the index of the structure
471 	 * Returns: a pointer to the GstCapsFeatures corresponding to index. [transfer none]
472 	 */
473 	public CapsFeatures getFeatures(uint index)
474 	{
475 		// GstCapsFeatures * gst_caps_get_features (const GstCaps *caps,  guint index);
476 		auto p = gst_caps_get_features(gstCaps, index);
477 		
478 		if(p is null)
479 		{
480 			return null;
481 		}
482 		
483 		return ObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) p);
484 	}
485 	
486 	/**
487 	 * Sets the GstCapsFeatures features for the structure at index.
488 	 * Since 1.2
489 	 * Params:
490 	 * index = the index of the structure
491 	 * features = the GstFeatures to set. [allow-none][transfer full]
492 	 */
493 	public void setFeatures(uint index, CapsFeatures features)
494 	{
495 		// void gst_caps_set_features (GstCaps *caps,  guint index,  GstCapsFeatures *features);
496 		gst_caps_set_features(gstCaps, index, (features is null) ? null : features.getCapsFeaturesStruct());
497 	}
498 	
499 	/**
500 	 * Sets the given field on all structures of caps to the given value.
501 	 * This is a convenience function for calling gst_structure_set_value() on
502 	 * all structures of caps.
503 	 * Params:
504 	 * field = name of the field to set
505 	 * value = value to set the field to
506 	 */
507 	public void setValue(string field, Value value)
508 	{
509 		// void gst_caps_set_value (GstCaps *caps,  const char *field,  const GValue *value);
510 		gst_caps_set_value(gstCaps, Str.toStringz(field), (value is null) ? null : value.getValueStruct());
511 	}
512 	
513 	/**
514 	 * Sets fields in a GstCaps. The arguments must be passed in the same
515 	 * manner as gst_structure_set(), and be NULL-terminated.
516 	 * Params:
517 	 * field = first field to set
518 	 * varargs = additional parameters
519 	 */
520 	public void setSimpleValist(string field, void* varargs)
521 	{
522 		// void gst_caps_set_simple_valist (GstCaps *caps,  const char *field,  va_list varargs);
523 		gst_caps_set_simple_valist(gstCaps, Str.toStringz(field), varargs);
524 	}
525 	
526 	/**
527 	 * Determines if caps represents any media format.
528 	 * Returns: TRUE if caps represents any format.
529 	 */
530 	public int isAny()
531 	{
532 		// gboolean gst_caps_is_any (const GstCaps *caps);
533 		return gst_caps_is_any(gstCaps);
534 	}
535 	
536 	/**
537 	 * Determines if caps represents no media formats.
538 	 * Returns: TRUE if caps represents no formats.
539 	 */
540 	public int isEmpty()
541 	{
542 		// gboolean gst_caps_is_empty (const GstCaps *caps);
543 		return gst_caps_is_empty(gstCaps);
544 	}
545 	
546 	/**
547 	 * Fixed GstCaps describe exactly one format, that is, they have exactly
548 	 * one structure, and each field in the structure describes a fixed type.
549 	 * Examples of non-fixed types are GST_TYPE_INT_RANGE and GST_TYPE_LIST.
550 	 * Returns: TRUE if caps is fixed
551 	 */
552 	public int isFixed()
553 	{
554 		// gboolean gst_caps_is_fixed (const GstCaps *caps);
555 		return gst_caps_is_fixed(gstCaps);
556 	}
557 	
558 	/**
559 	 * Checks if the given caps represent the same set of caps.
560 	 * Params:
561 	 * caps2 = another GstCaps
562 	 * Returns: TRUE if both caps are equal.
563 	 */
564 	public int isEqual(Caps caps2)
565 	{
566 		// gboolean gst_caps_is_equal (const GstCaps *caps1,  const GstCaps *caps2);
567 		return gst_caps_is_equal(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
568 	}
569 	
570 	/**
571 	 * Tests if two GstCaps are equal. This function only works on fixed
572 	 * GstCaps.
573 	 * Params:
574 	 * caps2 = the GstCaps to test
575 	 * Returns: TRUE if the arguments represent the same format
576 	 */
577 	public int isEqualFixed(Caps caps2)
578 	{
579 		// gboolean gst_caps_is_equal_fixed (const GstCaps *caps1,  const GstCaps *caps2);
580 		return gst_caps_is_equal_fixed(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
581 	}
582 	
583 	/**
584 	 * Checks if the given caps are exactly the same set of caps.
585 	 * Params:
586 	 * caps2 = another GstCaps
587 	 * Returns: TRUE if both caps are strictly equal.
588 	 */
589 	public int isStrictlyEqual(Caps caps2)
590 	{
591 		// gboolean gst_caps_is_strictly_equal (const GstCaps *caps1,  const GstCaps *caps2);
592 		return gst_caps_is_strictly_equal(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
593 	}
594 	
595 	/**
596 	 * A given GstCaps structure is always compatible with another if
597 	 * every media format that is in the first is also contained in the
598 	 * second. That is, caps1 is a subset of caps2.
599 	 * Params:
600 	 * caps2 = the GstCaps to test
601 	 * Returns: TRUE if caps1 is a subset of caps2.
602 	 */
603 	public int isAlwaysCompatible(Caps caps2)
604 	{
605 		// gboolean gst_caps_is_always_compatible (const GstCaps *caps1,  const GstCaps *caps2);
606 		return gst_caps_is_always_compatible(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
607 	}
608 	
609 	/**
610 	 * Checks if all caps represented by subset are also represented by superset.
611 	 * Params:
612 	 * superset = a potentially greater GstCaps
613 	 * Returns: TRUE if subset is a subset of superset
614 	 */
615 	public int isSubset(Caps superset)
616 	{
617 		// gboolean gst_caps_is_subset (const GstCaps *subset,  const GstCaps *superset);
618 		return gst_caps_is_subset(gstCaps, (superset is null) ? null : superset.getCapsStruct());
619 	}
620 	
621 	/**
622 	 * Checks if structure is a subset of caps. See gst_caps_is_subset()
623 	 * for more information.
624 	 * Params:
625 	 * structure = a potential GstStructure subset of caps
626 	 * Returns: TRUE if structure is a subset of caps
627 	 */
628 	public int isSubsetStructure(Structure structure)
629 	{
630 		// gboolean gst_caps_is_subset_structure (const GstCaps *caps,  const GstStructure *structure);
631 		return gst_caps_is_subset_structure(gstCaps, (structure is null) ? null : structure.getStructureStruct());
632 	}
633 	
634 	/**
635 	 * Checks if structure is a subset of caps. See gst_caps_is_subset()
636 	 * for more information.
637 	 * Since 1.2
638 	 * Params:
639 	 * structure = a potential GstStructure subset of caps
640 	 * features = a GstCapsFeatures for structure. [allow-none]
641 	 * Returns: TRUE if structure is a subset of caps
642 	 */
643 	public int isSubsetStructureFull(Structure structure, CapsFeatures features)
644 	{
645 		// gboolean gst_caps_is_subset_structure_full (const GstCaps *caps,  const GstStructure *structure,  const GstCapsFeatures *features);
646 		return gst_caps_is_subset_structure_full(gstCaps, (structure is null) ? null : structure.getStructureStruct(), (features is null) ? null : features.getCapsFeaturesStruct());
647 	}
648 	
649 	/**
650 	 * Tries intersecting caps1 and caps2 and reports whether the result would not
651 	 * be empty
652 	 * Params:
653 	 * caps2 = a GstCaps to intersect
654 	 * Returns: TRUE if intersection would be not empty
655 	 */
656 	public int canIntersect(Caps caps2)
657 	{
658 		// gboolean gst_caps_can_intersect (const GstCaps *caps1,  const GstCaps *caps2);
659 		return gst_caps_can_intersect(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
660 	}
661 	
662 	/**
663 	 * Creates a new GstCaps that contains all the formats that are common
664 	 * to both caps1 and caps2. Defaults to GST_CAPS_INTERSECT_ZIG_ZAG mode.
665 	 * Params:
666 	 * caps2 = a GstCaps to intersect
667 	 * Returns: the new GstCaps
668 	 */
669 	public Caps intersect(Caps caps2)
670 	{
671 		// GstCaps * gst_caps_intersect (GstCaps *caps1,  GstCaps *caps2);
672 		auto p = gst_caps_intersect(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
673 		
674 		if(p is null)
675 		{
676 			return null;
677 		}
678 		
679 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
680 	}
681 	
682 	/**
683 	 * Creates a new GstCaps that contains all the formats that are common
684 	 * to both caps1 and caps2, the order is defined by the GstCapsIntersectMode
685 	 * used.
686 	 * Params:
687 	 * caps2 = a GstCaps to intersect
688 	 * mode = The intersection algorithm/mode to use
689 	 * Returns: the new GstCaps
690 	 */
691 	public Caps intersectFull(Caps caps2, GstCapsIntersectMode mode)
692 	{
693 		// GstCaps * gst_caps_intersect_full (GstCaps *caps1,  GstCaps *caps2,  GstCapsIntersectMode mode);
694 		auto p = gst_caps_intersect_full(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct(), mode);
695 		
696 		if(p is null)
697 		{
698 			return null;
699 		}
700 		
701 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
702 	}
703 	
704 	/**
705 	 * Returns a GstCaps that represents the same set of formats as
706 	 * caps, but contains no lists. Each list is expanded into separate
707 	 * GstStructures.
708 	 * This function takes ownership of caps.
709 	 * Returns: the normalized GstCaps. [transfer full]
710 	 */
711 	public Caps normalize()
712 	{
713 		// GstCaps * gst_caps_normalize (GstCaps *caps);
714 		auto p = gst_caps_normalize(gstCaps);
715 		
716 		if(p is null)
717 		{
718 			return null;
719 		}
720 		
721 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
722 	}
723 	
724 	/**
725 	 * Converts the given caps into a representation that represents the
726 	 * same set of formats, but in a simpler form. Component structures that are
727 	 * identical are merged. Component structures that have values that can be
728 	 * merged are also merged.
729 	 * This method does not preserve the original order of caps.
730 	 * Returns: The simplified caps.
731 	 */
732 	public Caps simplify()
733 	{
734 		// GstCaps * gst_caps_simplify (GstCaps *caps);
735 		auto p = gst_caps_simplify(gstCaps);
736 		
737 		if(p is null)
738 		{
739 			return null;
740 		}
741 		
742 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
743 	}
744 	
745 	/**
746 	 * Modifies a pointer to a GstCaps to point to a different GstCaps. The
747 	 * modification is done atomically (so this is useful for ensuring thread safety
748 	 * in some cases), and the reference counts are updated appropriately (the old
749 	 * caps is unreffed, the new is reffed).
750 	 * Either ncaps or the GstCaps pointed to by ocaps may be NULL.
751 	 * Params:
752 	 * oldCaps = pointer to a pointer to a GstCaps to be
753 	 * replaced. [inout][transfer full]
754 	 * newCaps = pointer to a GstCaps that will
755 	 * replace the caps pointed to by ocaps. [transfer none][allow-none]
756 	 * Returns: TRUE if new_caps was different from old_caps
757 	 */
758 	public static int replace(GstCaps** oldCaps, Caps newCaps)
759 	{
760 		// gboolean gst_caps_replace (GstCaps **old_caps,  GstCaps *new_caps);
761 		return gst_caps_replace(oldCaps, (newCaps is null) ? null : newCaps.getCapsStruct());
762 	}
763 	
764 	/**
765 	 * Modifies a pointer to a GstCaps to point to a different GstCaps. This
766 	 * function is similar to gst_caps_replace() except that it takes ownership
767 	 * of new_caps.
768 	 * Params:
769 	 * oldCaps = pointer to a pointer to a GstCaps to be
770 	 * replaced. [inout][transfer full]
771 	 * newCaps = pointer to a GstCaps that will
772 	 * replace the caps pointed to by ocaps. [transfer full][allow-none]
773 	 * Returns: TRUE if new_caps was different from old_caps
774 	 */
775 	public static int take(GstCaps** oldCaps, Caps newCaps)
776 	{
777 		// gboolean gst_caps_take (GstCaps **old_caps,  GstCaps *new_caps);
778 		return gst_caps_take(oldCaps, (newCaps is null) ? null : newCaps.getCapsStruct());
779 	}
780 	
781 	/**
782 	 * Converts caps to a string representation. This string representation
783 	 * can be converted back to a GstCaps by gst_caps_from_string().
784 	 * Returns: a newly allocated string representing caps. [transfer full]
785 	 */
786 	public override string toString()
787 	{
788 		// gchar * gst_caps_to_string (const GstCaps *caps);
789 		return Str.toString(gst_caps_to_string(gstCaps));
790 	}
791 	
792 	/**
793 	 * Converts caps from a string representation.
794 	 * Params:
795 	 * string = a string to convert to GstCaps
796 	 * Returns: a newly allocated GstCaps. [transfer full]
797 	 */
798 	public static Caps fromString(string string)
799 	{
800 		// GstCaps * gst_caps_from_string (const gchar *string);
801 		auto p = gst_caps_from_string(Str.toStringz(string));
802 		
803 		if(p is null)
804 		{
805 			return null;
806 		}
807 		
808 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
809 	}
810 	
811 	/**
812 	 * Subtracts the subtrahend from the minuend.
813 	 * Note
814 	 * This function does not work reliably if optional properties for caps
815 	 * are included on one caps and omitted on the other.
816 	 * Params:
817 	 * subtrahend = GstCaps to subtract
818 	 * Returns: the resulting caps
819 	 */
820 	public Caps subtract(Caps subtrahend)
821 	{
822 		// GstCaps * gst_caps_subtract (GstCaps *minuend,  GstCaps *subtrahend);
823 		auto p = gst_caps_subtract(gstCaps, (subtrahend is null) ? null : subtrahend.getCapsStruct());
824 		
825 		if(p is null)
826 		{
827 			return null;
828 		}
829 		
830 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
831 	}
832 	
833 	/**
834 	 * Discard all but the first structure from caps. Useful when
835 	 * fixating.
836 	 * Returns: truncated caps. [transfer full]
837 	 */
838 	public Caps truncate()
839 	{
840 		// GstCaps * gst_caps_truncate (GstCaps *caps);
841 		auto p = gst_caps_truncate(gstCaps);
842 		
843 		if(p is null)
844 		{
845 			return null;
846 		}
847 		
848 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
849 	}
850 	
851 	/**
852 	 * Modifies the given caps into a representation with only fixed
853 	 * values. First the caps will be truncated and then the first structure will be
854 	 * fixated with gst_structure_fixate().
855 	 * Returns: the fixated caps. [transfer full]
856 	 */
857 	public Caps fixate()
858 	{
859 		// GstCaps * gst_caps_fixate (GstCaps *caps);
860 		auto p = gst_caps_fixate(gstCaps);
861 		
862 		if(p is null)
863 		{
864 			return null;
865 		}
866 		
867 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
868 	}
869 	
870 	/**
871 	 * Add a reference to a GstCaps object.
872 	 * From this point on, until the caller calls gst_caps_unref() or
873 	 * gst_caps_make_writable(), it is guaranteed that the caps object will not
874 	 * change. This means its structures won't change, etc. To use a GstCaps
875 	 * object, you must always have a refcount on it -- either the one made
876 	 * implicitly by e.g. gst_caps_new_simple(), or via taking one explicitly with
877 	 * this function.
878 	 * Returns: the same GstCaps object.
879 	 */
880 	public Caps doref()
881 	{
882 		// GstCaps * gst_caps_ref (GstCaps *caps);
883 		auto p = gst_caps_ref(gstCaps);
884 		
885 		if(p is null)
886 		{
887 			return null;
888 		}
889 		
890 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
891 	}
892 	
893 	/**
894 	 * Unref a GstCaps and and free all its structures and the
895 	 * structures' values when the refcount reaches 0.
896 	 */
897 	public void unref()
898 	{
899 		// void gst_caps_unref (GstCaps *caps);
900 		gst_caps_unref(gstCaps);
901 	}
902 }