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