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 module gstreamer.Caps;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Value;
31 private import gstreamer.CapsFeatures;
32 private import gstreamer.Structure;
33 private import gstreamerc.gstreamer;
34 public  import gstreamerc.gstreamertypes;
35 
36 
37 /**
38  * Caps (capabilities) are lightweight refcounted objects describing media types.
39  * They are composed of an array of #GstStructure.
40  * 
41  * Caps are exposed on #GstPadTemplate to describe all possible types a
42  * given pad can handle. They are also stored in the #GstRegistry along with
43  * a description of the #GstElement.
44  * 
45  * Caps are exposed on the element pads using the gst_pad_query_caps() pad
46  * function. This function describes the possible types that the pad can
47  * handle or produce at runtime.
48  * 
49  * A #GstCaps can be constructed with the following code fragment:
50  * |[
51  * GstCaps *caps = gst_caps_new_simple ("video/x-raw",
52  * "format", G_TYPE_STRING, "I420",
53  * "framerate", GST_TYPE_FRACTION, 25, 1,
54  * "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
55  * "width", G_TYPE_INT, 320,
56  * "height", G_TYPE_INT, 240,
57  * NULL);
58  * ]|
59  * 
60  * A #GstCaps is fixed when it has no properties with ranges or lists. Use
61  * gst_caps_is_fixed() to test for fixed caps. Fixed caps can be used in a
62  * caps event to notify downstream elements of the current media type.
63  * 
64  * Various methods exist to work with the media types such as subtracting
65  * or intersecting.
66  * 
67  * Be aware that the current #GstCaps / #GstStructure serialization into string
68  * has limited support for nested #GstCaps / #GstStructure fields. It can only
69  * support one level of nesting. Using more levels will lead to unexpected
70  * behavior when using serialization features, such as gst_caps_to_string() or
71  * gst_value_serialize() and their counterparts.
72  */
73 public class Caps
74 {
75 	/** the main Gtk struct */
76 	protected GstCaps* gstCaps;
77 
78 	/** Get the main Gtk struct */
79 	public GstCaps* getCapsStruct()
80 	{
81 		return gstCaps;
82 	}
83 
84 	/** the main Gtk struct as a void* */
85 	protected void* getStruct()
86 	{
87 		return cast(void*)gstCaps;
88 	}
89 
90 	/**
91 	 * Sets our main struct and passes it to the parent class.
92 	 */
93 	public this (GstCaps* gstCaps)
94 	{
95 		this.gstCaps = gstCaps;
96 	}
97 
98 	/**
99 	 * Creates a new GstCaps that indicates that it is compatible with
100 	 * any media format.
101 	 * Returns:
102 	 *  the new GstCaps
103 	 */
104 	public static Caps newAny()
105 	{
106 		// GstCaps* gst_caps_new_any (void);
107 		auto p = cast(GstCaps*)gst_caps_new_any();
108 		
109 		if(p is null)
110 		{
111 			throw new ConstructionException("null returned by gst_caps_new_any");
112 		}
113 		
114 		return new Caps(cast(GstCaps*)p); //, true);
115 	}
116 
117 	/**
118 	 */
119 
120 	public static GType getType()
121 	{
122 		return gst_caps_get_type();
123 	}
124 
125 	/**
126 	 * Creates a new #GstCaps that is empty.  That is, the returned
127 	 * #GstCaps contains no media formats.
128 	 * The #GstCaps is guaranteed to be writable.
129 	 * Caller is responsible for unreffing the returned caps.
130 	 *
131 	 * Return: the new #GstCaps
132 	 *
133 	 * Throws: ConstructionException GTK+ fails to create the object.
134 	 */
135 	public this()
136 	{
137 		auto p = gst_caps_new_empty();
138 		
139 		if(p is null)
140 		{
141 			throw new ConstructionException("null returned by new_empty");
142 		}
143 		
144 		this(cast(GstCaps*) p);
145 	}
146 
147 	/**
148 	 * Creates a new #GstCaps that contains one #GstStructure with name
149 	 * @media_type.
150 	 * Caller is responsible for unreffing the returned caps.
151 	 *
152 	 * Params:
153 	 *     mediaType = the media type of the structure
154 	 *
155 	 * Return: the new #GstCaps
156 	 *
157 	 * Throws: ConstructionException GTK+ fails to create the object.
158 	 */
159 	public this(string mediaType)
160 	{
161 		auto p = gst_caps_new_empty_simple(Str.toStringz(mediaType));
162 		
163 		if(p is null)
164 		{
165 			throw new ConstructionException("null returned by new_empty_simple");
166 		}
167 		
168 		this(cast(GstCaps*) p);
169 	}
170 
171 	/**
172 	 * Creates a new #GstCaps and adds all the structures listed as
173 	 * arguments.  The list must be %NULL-terminated.  The structures
174 	 * are not copied; the returned #GstCaps owns the structures.
175 	 *
176 	 * Params:
177 	 *     structure = the first structure to add
178 	 *     varArgs = additional structures to add
179 	 *
180 	 * Return: the new #GstCaps
181 	 *
182 	 * Throws: ConstructionException GTK+ fails to create the object.
183 	 */
184 	public this(Structure structure, void* varArgs)
185 	{
186 		auto p = gst_caps_new_full_valist((structure is null) ? null : structure.getStructureStruct(), varArgs);
187 		
188 		if(p is null)
189 		{
190 			throw new ConstructionException("null returned by new_full_valist");
191 		}
192 		
193 		this(cast(GstCaps*) p);
194 	}
195 
196 	/**
197 	 * Appends the structures contained in @caps2 to @caps1. The structures in
198 	 * @caps2 are not copied -- they are transferred to @caps1, and then @caps2 is
199 	 * freed. If either caps is ANY, the resulting caps will be ANY.
200 	 *
201 	 * Params:
202 	 *     caps2 = the #GstCaps to append
203 	 */
204 	public void append(Caps caps2)
205 	{
206 		gst_caps_append(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
207 	}
208 
209 	/**
210 	 * Appends @structure to @caps.  The structure is not copied; @caps
211 	 * becomes the owner of @structure.
212 	 *
213 	 * Params:
214 	 *     structure = the #GstStructure to append
215 	 */
216 	public void appendStructure(Structure structure)
217 	{
218 		gst_caps_append_structure(gstCaps, (structure is null) ? null : structure.getStructureStruct());
219 	}
220 
221 	/**
222 	 * Appends @structure with @features to @caps.  The structure is not copied; @caps
223 	 * becomes the owner of @structure.
224 	 *
225 	 * Params:
226 	 *     structure = the #GstStructure to append
227 	 *     features = the #GstCapsFeatures to append
228 	 *
229 	 * Since: 1.2
230 	 */
231 	public void appendStructureFull(Structure structure, CapsFeatures features)
232 	{
233 		gst_caps_append_structure_full(gstCaps, (structure is null) ? null : structure.getStructureStruct(), (features is null) ? null : features.getCapsFeaturesStruct());
234 	}
235 
236 	/**
237 	 * Tries intersecting @caps1 and @caps2 and reports whether the result would not
238 	 * be empty
239 	 *
240 	 * Params:
241 	 *     caps2 = a #GstCaps to intersect
242 	 *
243 	 * Return: %TRUE if intersection would be not empty
244 	 */
245 	public bool canIntersect(Caps caps2)
246 	{
247 		return gst_caps_can_intersect(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct()) != 0;
248 	}
249 
250 	/**
251 	 * Creates a new #GstCaps and appends a copy of the nth structure
252 	 * contained in @caps.
253 	 *
254 	 * Params:
255 	 *     nth = the nth structure to copy
256 	 *
257 	 * Return: the new #GstCaps
258 	 */
259 	public Caps copyNth(uint nth)
260 	{
261 		auto p = gst_caps_copy_nth(gstCaps, nth);
262 		
263 		if(p is null)
264 		{
265 			return null;
266 		}
267 		
268 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
269 	}
270 
271 	/**
272 	 * Modifies the given @caps into a representation with only fixed
273 	 * values. First the caps will be truncated and then the first structure will be
274 	 * fixated with gst_structure_fixate().
275 	 *
276 	 * Return: the fixated caps
277 	 */
278 	public Caps fixate()
279 	{
280 		auto p = gst_caps_fixate(gstCaps);
281 		
282 		if(p is null)
283 		{
284 			return null;
285 		}
286 		
287 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
288 	}
289 
290 	/**
291 	 * Finds the features in @caps that has the index @index, and
292 	 * returns it.
293 	 *
294 	 * WARNING: This function takes a const GstCaps *, but returns a
295 	 * non-const GstCapsFeatures *.  This is for programming convenience --
296 	 * the caller should be aware that structures inside a constant
297 	 * #GstCaps should not be modified. However, if you know the caps
298 	 * are writable, either because you have just copied them or made
299 	 * them writable with gst_caps_make_writable(), you may modify the
300 	 * features returned in the usual way, e.g. with functions like
301 	 * gst_caps_features_add().
302 	 *
303 	 * You do not need to free or unref the structure returned, it
304 	 * belongs to the #GstCaps.
305 	 *
306 	 * Params:
307 	 *     index = the index of the structure
308 	 *
309 	 * Return: a pointer to the #GstCapsFeatures corresponding
310 	 *     to @index
311 	 *
312 	 * Since: 1.2
313 	 */
314 	public CapsFeatures getFeatures(uint index)
315 	{
316 		auto p = gst_caps_get_features(gstCaps, index);
317 		
318 		if(p is null)
319 		{
320 			return null;
321 		}
322 		
323 		return ObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) p);
324 	}
325 
326 	/**
327 	 * Gets the number of structures contained in @caps.
328 	 *
329 	 * Return: the number of structures that @caps contains
330 	 */
331 	public uint getSize()
332 	{
333 		return gst_caps_get_size(gstCaps);
334 	}
335 
336 	/**
337 	 * Finds the structure in @caps that has the index @index, and
338 	 * returns it.
339 	 *
340 	 * WARNING: This function takes a const GstCaps *, but returns a
341 	 * non-const GstStructure *.  This is for programming convenience --
342 	 * the caller should be aware that structures inside a constant
343 	 * #GstCaps should not be modified. However, if you know the caps
344 	 * are writable, either because you have just copied them or made
345 	 * them writable with gst_caps_make_writable(), you may modify the
346 	 * structure returned in the usual way, e.g. with functions like
347 	 * gst_structure_set().
348 	 *
349 	 * You do not need to free or unref the structure returned, it
350 	 * belongs to the #GstCaps.
351 	 *
352 	 * Params:
353 	 *     index = the index of the structure
354 	 *
355 	 * Return: a pointer to the #GstStructure corresponding
356 	 *     to @index
357 	 */
358 	public Structure getStructure(uint index)
359 	{
360 		auto p = gst_caps_get_structure(gstCaps, index);
361 		
362 		if(p is null)
363 		{
364 			return null;
365 		}
366 		
367 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
368 	}
369 
370 	/**
371 	 * Creates a new #GstCaps that contains all the formats that are common
372 	 * to both @caps1 and @caps2. Defaults to %GST_CAPS_INTERSECT_ZIG_ZAG mode.
373 	 *
374 	 * Params:
375 	 *     caps2 = a #GstCaps to intersect
376 	 *
377 	 * Return: the new #GstCaps
378 	 */
379 	public Caps intersect(Caps caps2)
380 	{
381 		auto p = gst_caps_intersect(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
382 		
383 		if(p is null)
384 		{
385 			return null;
386 		}
387 		
388 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
389 	}
390 
391 	/**
392 	 * Creates a new #GstCaps that contains all the formats that are common
393 	 * to both @caps1 and @caps2, the order is defined by the #GstCapsIntersectMode
394 	 * used.
395 	 *
396 	 * Params:
397 	 *     caps2 = a #GstCaps to intersect
398 	 *     mode = The intersection algorithm/mode to use
399 	 *
400 	 * Return: the new #GstCaps
401 	 */
402 	public Caps intersectFull(Caps caps2, GstCapsIntersectMode mode)
403 	{
404 		auto p = gst_caps_intersect_full(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct(), mode);
405 		
406 		if(p is null)
407 		{
408 			return null;
409 		}
410 		
411 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
412 	}
413 
414 	/**
415 	 * A given #GstCaps structure is always compatible with another if
416 	 * every media format that is in the first is also contained in the
417 	 * second.  That is, @caps1 is a subset of @caps2.
418 	 *
419 	 * Params:
420 	 *     caps2 = the #GstCaps to test
421 	 *
422 	 * Return: %TRUE if @caps1 is a subset of @caps2.
423 	 */
424 	public bool isAlwaysCompatible(Caps caps2)
425 	{
426 		return gst_caps_is_always_compatible(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct()) != 0;
427 	}
428 
429 	/**
430 	 * Determines if @caps represents any media format.
431 	 *
432 	 * Return: %TRUE if @caps represents any format.
433 	 */
434 	public bool isAny()
435 	{
436 		return gst_caps_is_any(gstCaps) != 0;
437 	}
438 
439 	/**
440 	 * Determines if @caps represents no media formats.
441 	 *
442 	 * Return: %TRUE if @caps represents no formats.
443 	 */
444 	public bool isEmpty()
445 	{
446 		return gst_caps_is_empty(gstCaps) != 0;
447 	}
448 
449 	/**
450 	 * Checks if the given caps represent the same set of caps.
451 	 *
452 	 * Params:
453 	 *     caps2 = another #GstCaps
454 	 *
455 	 * Return: %TRUE if both caps are equal.
456 	 */
457 	public bool isEqual(Caps caps2)
458 	{
459 		return gst_caps_is_equal(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct()) != 0;
460 	}
461 
462 	/**
463 	 * Tests if two #GstCaps are equal.  This function only works on fixed
464 	 * #GstCaps.
465 	 *
466 	 * Params:
467 	 *     caps2 = the #GstCaps to test
468 	 *
469 	 * Return: %TRUE if the arguments represent the same format
470 	 */
471 	public bool isEqualFixed(Caps caps2)
472 	{
473 		return gst_caps_is_equal_fixed(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct()) != 0;
474 	}
475 
476 	/**
477 	 * Fixed #GstCaps describe exactly one format, that is, they have exactly
478 	 * one structure, and each field in the structure describes a fixed type.
479 	 * Examples of non-fixed types are GST_TYPE_INT_RANGE and GST_TYPE_LIST.
480 	 *
481 	 * Return: %TRUE if @caps is fixed
482 	 */
483 	public bool isFixed()
484 	{
485 		return gst_caps_is_fixed(gstCaps) != 0;
486 	}
487 
488 	/**
489 	 * Checks if the given caps are exactly the same set of caps.
490 	 *
491 	 * Params:
492 	 *     caps2 = another #GstCaps
493 	 *
494 	 * Return: %TRUE if both caps are strictly equal.
495 	 */
496 	public bool isStrictlyEqual(Caps caps2)
497 	{
498 		return gst_caps_is_strictly_equal(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct()) != 0;
499 	}
500 
501 	/**
502 	 * Checks if all caps represented by @subset are also represented by @superset.
503 	 *
504 	 * Params:
505 	 *     superset = a potentially greater #GstCaps
506 	 *
507 	 * Return: %TRUE if @subset is a subset of @superset
508 	 */
509 	public bool isSubset(Caps superset)
510 	{
511 		return gst_caps_is_subset(gstCaps, (superset is null) ? null : superset.getCapsStruct()) != 0;
512 	}
513 
514 	/**
515 	 * Checks if @structure is a subset of @caps. See gst_caps_is_subset()
516 	 * for more information.
517 	 *
518 	 * Params:
519 	 *     structure = a potential #GstStructure subset of @caps
520 	 *
521 	 * Return: %TRUE if @structure is a subset of @caps
522 	 */
523 	public bool isSubsetStructure(Structure structure)
524 	{
525 		return gst_caps_is_subset_structure(gstCaps, (structure is null) ? null : structure.getStructureStruct()) != 0;
526 	}
527 
528 	/**
529 	 * Checks if @structure is a subset of @caps. See gst_caps_is_subset()
530 	 * for more information.
531 	 *
532 	 * Params:
533 	 *     structure = a potential #GstStructure subset of @caps
534 	 *     features = a #GstCapsFeatures for @structure
535 	 *
536 	 * Return: %TRUE if @structure is a subset of @caps
537 	 *
538 	 * Since: 1.2
539 	 */
540 	public bool isSubsetStructureFull(Structure structure, CapsFeatures features)
541 	{
542 		return gst_caps_is_subset_structure_full(gstCaps, (structure is null) ? null : structure.getStructureStruct(), (features is null) ? null : features.getCapsFeaturesStruct()) != 0;
543 	}
544 
545 	/**
546 	 * Appends the structures contained in @caps2 to @caps1 if they are not yet
547 	 * expressed by @caps1. The structures in @caps2 are not copied -- they are
548 	 * transferred to a writable copy of @caps1, and then @caps2 is freed.
549 	 * If either caps is ANY, the resulting caps will be ANY.
550 	 *
551 	 * Params:
552 	 *     caps2 = the #GstCaps to merge in
553 	 *
554 	 * Return: the merged caps.
555 	 */
556 	public Caps merge(Caps caps2)
557 	{
558 		auto p = gst_caps_merge(gstCaps, (caps2 is null) ? null : caps2.getCapsStruct());
559 		
560 		if(p is null)
561 		{
562 			return null;
563 		}
564 		
565 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
566 	}
567 
568 	/**
569 	 * Appends @structure to @caps if its not already expressed by @caps.
570 	 *
571 	 * Params:
572 	 *     structure = the #GstStructure to merge
573 	 *
574 	 * Return: the merged caps.
575 	 */
576 	public Caps mergeStructure(Structure structure)
577 	{
578 		auto p = gst_caps_merge_structure(gstCaps, (structure is null) ? null : structure.getStructureStruct());
579 		
580 		if(p is null)
581 		{
582 			return null;
583 		}
584 		
585 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
586 	}
587 
588 	/**
589 	 * Appends @structure with @features to @caps if its not already expressed by @caps.
590 	 *
591 	 * Params:
592 	 *     structure = the #GstStructure to merge
593 	 *     features = the #GstCapsFeatures to merge
594 	 *
595 	 * Return: the merged caps.
596 	 *
597 	 * Since: 1.2
598 	 */
599 	public Caps mergeStructureFull(Structure structure, CapsFeatures features)
600 	{
601 		auto p = gst_caps_merge_structure_full(gstCaps, (structure is null) ? null : structure.getStructureStruct(), (features is null) ? null : features.getCapsFeaturesStruct());
602 		
603 		if(p is null)
604 		{
605 			return null;
606 		}
607 		
608 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
609 	}
610 
611 	/**
612 	 * Returns a #GstCaps that represents the same set of formats as
613 	 * @caps, but contains no lists.  Each list is expanded into separate
614 	 * @GstStructures.
615 	 *
616 	 * This function takes ownership of @caps.
617 	 *
618 	 * Return: the normalized #GstCaps
619 	 */
620 	public Caps normalize()
621 	{
622 		auto p = gst_caps_normalize(gstCaps);
623 		
624 		if(p is null)
625 		{
626 			return null;
627 		}
628 		
629 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
630 	}
631 
632 	/**
633 	 * removes the structure with the given index from the list of structures
634 	 * contained in @caps.
635 	 *
636 	 * Params:
637 	 *     idx = Index of the structure to remove
638 	 */
639 	public void removeStructure(uint idx)
640 	{
641 		gst_caps_remove_structure(gstCaps, idx);
642 	}
643 
644 	/**
645 	 * Sets the #GstCapsFeatures @features for the structure at @index.
646 	 *
647 	 * Params:
648 	 *     index = the index of the structure
649 	 *     features = the #GstCapsFeatures to set
650 	 *
651 	 * Since: 1.2
652 	 */
653 	public void setFeatures(uint index, CapsFeatures features)
654 	{
655 		gst_caps_set_features(gstCaps, index, (features is null) ? null : features.getCapsFeaturesStruct());
656 	}
657 
658 	/**
659 	 * Sets fields in a #GstCaps.  The arguments must be passed in the same
660 	 * manner as gst_structure_set(), and be %NULL-terminated.
661 	 *
662 	 * Params:
663 	 *     field = first field to set
664 	 *     varargs = additional parameters
665 	 */
666 	public void setSimpleValist(string field, void* varargs)
667 	{
668 		gst_caps_set_simple_valist(gstCaps, Str.toStringz(field), varargs);
669 	}
670 
671 	/**
672 	 * Sets the given @field on all structures of @caps to the given @value.
673 	 * This is a convenience function for calling gst_structure_set_value() on
674 	 * all structures of @caps.
675 	 *
676 	 * Params:
677 	 *     field = name of the field to set
678 	 *     value = value to set the field to
679 	 */
680 	public void setValue(string field, Value value)
681 	{
682 		gst_caps_set_value(gstCaps, Str.toStringz(field), (value is null) ? null : value.getValueStruct());
683 	}
684 
685 	/**
686 	 * Converts the given @caps into a representation that represents the
687 	 * same set of formats, but in a simpler form.  Component structures that are
688 	 * identical are merged.  Component structures that have values that can be
689 	 * merged are also merged.
690 	 *
691 	 * This method does not preserve the original order of @caps.
692 	 *
693 	 * Return: The simplified caps.
694 	 */
695 	public Caps simplify()
696 	{
697 		auto p = gst_caps_simplify(gstCaps);
698 		
699 		if(p is null)
700 		{
701 			return null;
702 		}
703 		
704 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
705 	}
706 
707 	/**
708 	 * Retrieves the structure with the given index from the list of structures
709 	 * contained in @caps. The caller becomes the owner of the returned structure.
710 	 *
711 	 * Params:
712 	 *     index = Index of the structure to retrieve
713 	 *
714 	 * Return: a pointer to the #GstStructure corresponding
715 	 *     to @index.
716 	 */
717 	public Structure stealStructure(uint index)
718 	{
719 		auto p = gst_caps_steal_structure(gstCaps, index);
720 		
721 		if(p is null)
722 		{
723 			return null;
724 		}
725 		
726 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
727 	}
728 
729 	/**
730 	 * Subtracts the @subtrahend from the @minuend.
731 	 * <note>This function does not work reliably if optional properties for caps
732 	 * are included on one caps and omitted on the other.</note>
733 	 *
734 	 * Params:
735 	 *     subtrahend = #GstCaps to subtract
736 	 *
737 	 * Return: the resulting caps
738 	 */
739 	public Caps subtract(Caps subtrahend)
740 	{
741 		auto p = gst_caps_subtract(gstCaps, (subtrahend is null) ? null : subtrahend.getCapsStruct());
742 		
743 		if(p is null)
744 		{
745 			return null;
746 		}
747 		
748 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
749 	}
750 
751 	/**
752 	 * Converts @caps to a string representation.  This string representation
753 	 * can be converted back to a #GstCaps by gst_caps_from_string().
754 	 *
755 	 * For debugging purposes its easier to do something like this:
756 	 * |[
757 	 * GST_LOG ("caps are %" GST_PTR_FORMAT, caps);
758 	 * ]|
759 	 * This prints the caps in human readable form.
760 	 *
761 	 * The current implementation of serialization will lead to unexpected results
762 	 * when there are nested #GstCaps / #GstStructure deeper than one level.
763 	 *
764 	 * Return: a newly allocated string representing @caps.
765 	 */
766 	public override string toString()
767 	{
768 		return Str.toString(gst_caps_to_string(gstCaps));
769 	}
770 
771 	/**
772 	 * Discard all but the first structure from @caps. Useful when
773 	 * fixating.
774 	 *
775 	 * Return: truncated caps
776 	 */
777 	public Caps truncate()
778 	{
779 		auto p = gst_caps_truncate(gstCaps);
780 		
781 		if(p is null)
782 		{
783 			return null;
784 		}
785 		
786 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
787 	}
788 
789 	/**
790 	 * Converts @caps from a string representation.
791 	 *
792 	 * The current implementation of serialization will lead to unexpected results
793 	 * when there are nested #GstCaps / #GstStructure deeper than one level.
794 	 *
795 	 * Params:
796 	 *     str = a string to convert to #GstCaps
797 	 *
798 	 * Return: a newly allocated #GstCaps
799 	 */
800 	public static Caps fromString(string str)
801 	{
802 		auto p = gst_caps_from_string(Str.toStringz(str));
803 		
804 		if(p is null)
805 		{
806 			return null;
807 		}
808 		
809 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
810 	}
811 }