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