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.Structure;
26 
27 private import glib.ConstructionException;
28 private import glib.Date;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Value;
32 private import gstreamer.DateTime;
33 private import gstreamerc.gstreamer;
34 public  import gstreamerc.gstreamertypes;
35 
36 
37 /**
38  * A #GstStructure is a collection of key/value pairs. The keys are expressed
39  * as GQuarks and the values can be of any GType.
40  * 
41  * In addition to the key/value pairs, a #GstStructure also has a name. The name
42  * starts with a letter and can be filled by letters, numbers and any of "/-_.:".
43  * 
44  * #GstStructure is used by various GStreamer subsystems to store information
45  * in a flexible and extensible way. A #GstStructure does not have a refcount
46  * because it usually is part of a higher level object such as #GstCaps,
47  * #GstMessage, #GstEvent, #GstQuery. It provides a means to enforce mutability
48  * using the refcount of the parent with the gst_structure_set_parent_refcount()
49  * method.
50  * 
51  * A #GstStructure can be created with gst_structure_new_empty() or
52  * gst_structure_new(), which both take a name and an optional set of
53  * key/value pairs along with the types of the values.
54  * 
55  * Field values can be changed with gst_structure_set_value() or
56  * gst_structure_set().
57  * 
58  * Field values can be retrieved with gst_structure_get_value() or the more
59  * convenient gst_structure_get_*() functions.
60  * 
61  * Fields can be removed with gst_structure_remove_field() or
62  * gst_structure_remove_fields().
63  * 
64  * Strings in structures must be ASCII or UTF-8 encoded. Other encodings are
65  * not allowed. Strings may be %NULL however.
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 Structure
74 {
75 	/** the main Gtk struct */
76 	protected GstStructure* gstStructure;
77 
78 	/** Get the main Gtk struct */
79 	public GstStructure* getStructureStruct()
80 	{
81 		return gstStructure;
82 	}
83 
84 	/** the main Gtk struct as a void* */
85 	protected void* getStruct()
86 	{
87 		return cast(void*)gstStructure;
88 	}
89 
90 	/**
91 	 * Sets our main struct and passes it to the parent class.
92 	 */
93 	public this (GstStructure* gstStructure)
94 	{
95 		this.gstStructure = gstStructure;
96 	}
97 
98 	public static Structure fromString(string name)
99 	{
100 		auto p = gst_structure_new_from_string(Str.toStringz(name));
101 		
102 		if(p is null)
103 		{
104 			throw new ConstructionException("null returned by gst_structure_new_from_string(Str.toStringz(name))");
105 		}
106 		
107 		return new Structure(cast(GstStructure*)p); //, true);
108 	}
109 
110 	/**
111 	 */
112 
113 	public static GType getType()
114 	{
115 		return gst_structure_get_type();
116 	}
117 
118 	/**
119 	 * Creates a new, empty #GstStructure with the given @name.
120 	 *
121 	 * See gst_structure_set_name() for constraints on the @name parameter.
122 	 *
123 	 * Free-function: gst_structure_free
124 	 *
125 	 * Params:
126 	 *     name = name of new structure
127 	 *
128 	 * Return: a new, empty #GstStructure
129 	 *
130 	 * Throws: ConstructionException GTK+ fails to create the object.
131 	 */
132 	public this(string name)
133 	{
134 		auto p = gst_structure_new_empty(Str.toStringz(name));
135 		
136 		if(p is null)
137 		{
138 			throw new ConstructionException("null returned by new_empty");
139 		}
140 		
141 		this(cast(GstStructure*) p);
142 	}
143 
144 	/**
145 	 * Creates a new, empty #GstStructure with the given name as a GQuark.
146 	 *
147 	 * Free-function: gst_structure_free
148 	 *
149 	 * Params:
150 	 *     quark = name of new structure
151 	 *
152 	 * Return: a new, empty #GstStructure
153 	 *
154 	 * Throws: ConstructionException GTK+ fails to create the object.
155 	 */
156 	public this(GQuark quark)
157 	{
158 		auto p = gst_structure_new_id_empty(quark);
159 		
160 		if(p is null)
161 		{
162 			throw new ConstructionException("null returned by new_id_empty");
163 		}
164 		
165 		this(cast(GstStructure*) p);
166 	}
167 
168 	/**
169 	 * Creates a new #GstStructure with the given @name.  Structure fields
170 	 * are set according to the varargs in a manner similar to
171 	 * gst_structure_new().
172 	 *
173 	 * See gst_structure_set_name() for constraints on the @name parameter.
174 	 *
175 	 * Free-function: gst_structure_free
176 	 *
177 	 * Params:
178 	 *     name = name of new structure
179 	 *     firstfield = name of first field to set
180 	 *     varargs = variable argument list
181 	 *
182 	 * Return: a new #GstStructure
183 	 *
184 	 * Throws: ConstructionException GTK+ fails to create the object.
185 	 */
186 	public this(string name, string firstfield, void* varargs)
187 	{
188 		auto p = gst_structure_new_valist(Str.toStringz(name), Str.toStringz(firstfield), varargs);
189 		
190 		if(p is null)
191 		{
192 			throw new ConstructionException("null returned by new_valist");
193 		}
194 		
195 		this(cast(GstStructure*) p);
196 	}
197 
198 	/**
199 	 * Tries intersecting @struct1 and @struct2 and reports whether the result
200 	 * would not be empty.
201 	 *
202 	 * Params:
203 	 *     struct2 = a #GstStructure
204 	 *
205 	 * Return: %TRUE if intersection would not be empty
206 	 */
207 	public bool canIntersect(Structure struct2)
208 	{
209 		return gst_structure_can_intersect(gstStructure, (struct2 is null) ? null : struct2.getStructureStruct()) != 0;
210 	}
211 
212 	/**
213 	 * Duplicates a #GstStructure and all its fields and values.
214 	 *
215 	 * Free-function: gst_structure_free
216 	 *
217 	 * Return: a new #GstStructure.
218 	 */
219 	public Structure copy()
220 	{
221 		auto p = gst_structure_copy(gstStructure);
222 		
223 		if(p is null)
224 		{
225 			return null;
226 		}
227 		
228 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
229 	}
230 
231 	/**
232 	 * Fixate all values in @structure using gst_value_fixate().
233 	 * @structure will be modified in-place and should be writable.
234 	 */
235 	public void fixate()
236 	{
237 		gst_structure_fixate(gstStructure);
238 	}
239 
240 	/**
241 	 * Fixates a #GstStructure by changing the given field with its fixated value.
242 	 *
243 	 * Params:
244 	 *     fieldName = a field in @structure
245 	 *
246 	 * Return: %TRUE if the structure field could be fixated
247 	 */
248 	public bool fixateField(string fieldName)
249 	{
250 		return gst_structure_fixate_field(gstStructure, Str.toStringz(fieldName)) != 0;
251 	}
252 
253 	/**
254 	 * Fixates a #GstStructure by changing the given @field_name field to the given
255 	 * @target boolean if that field is not fixed yet.
256 	 *
257 	 * Params:
258 	 *     fieldName = a field in @structure
259 	 *     target = the target value of the fixation
260 	 *
261 	 * Return: %TRUE if the structure could be fixated
262 	 */
263 	public bool fixateFieldBoolean(string fieldName, bool target)
264 	{
265 		return gst_structure_fixate_field_boolean(gstStructure, Str.toStringz(fieldName), target) != 0;
266 	}
267 
268 	/**
269 	 * Fixates a #GstStructure by changing the given field to the nearest
270 	 * double to @target that is a subset of the existing field.
271 	 *
272 	 * Params:
273 	 *     fieldName = a field in @structure
274 	 *     target = the target value of the fixation
275 	 *
276 	 * Return: %TRUE if the structure could be fixated
277 	 */
278 	public bool fixateFieldNearestDouble(string fieldName, double target)
279 	{
280 		return gst_structure_fixate_field_nearest_double(gstStructure, Str.toStringz(fieldName), target) != 0;
281 	}
282 
283 	/**
284 	 * Fixates a #GstStructure by changing the given field to the nearest
285 	 * fraction to @target_numerator/@target_denominator that is a subset
286 	 * of the existing field.
287 	 *
288 	 * Params:
289 	 *     fieldName = a field in @structure
290 	 *     targetNumerator = The numerator of the target value of the fixation
291 	 *     targetDenominator = The denominator of the target value of the fixation
292 	 *
293 	 * Return: %TRUE if the structure could be fixated
294 	 */
295 	public bool fixateFieldNearestFraction(string fieldName, int targetNumerator, int targetDenominator)
296 	{
297 		return gst_structure_fixate_field_nearest_fraction(gstStructure, Str.toStringz(fieldName), targetNumerator, targetDenominator) != 0;
298 	}
299 
300 	/**
301 	 * Fixates a #GstStructure by changing the given field to the nearest
302 	 * integer to @target that is a subset of the existing field.
303 	 *
304 	 * Params:
305 	 *     fieldName = a field in @structure
306 	 *     target = the target value of the fixation
307 	 *
308 	 * Return: %TRUE if the structure could be fixated
309 	 */
310 	public bool fixateFieldNearestInt(string fieldName, int target)
311 	{
312 		return gst_structure_fixate_field_nearest_int(gstStructure, Str.toStringz(fieldName), target) != 0;
313 	}
314 
315 	/**
316 	 * Fixates a #GstStructure by changing the given @field_name field to the given
317 	 * @target string if that field is not fixed yet.
318 	 *
319 	 * Params:
320 	 *     fieldName = a field in @structure
321 	 *     target = the target value of the fixation
322 	 *
323 	 * Return: %TRUE if the structure could be fixated
324 	 */
325 	public bool fixateFieldString(string fieldName, string target)
326 	{
327 		return gst_structure_fixate_field_string(gstStructure, Str.toStringz(fieldName), Str.toStringz(target)) != 0;
328 	}
329 
330 	/**
331 	 * Calls the provided function once for each field in the #GstStructure. The
332 	 * function must not modify the fields. Also see gst_structure_map_in_place().
333 	 *
334 	 * Params:
335 	 *     func = a function to call for each field
336 	 *     userData = private data
337 	 *
338 	 * Return: %TRUE if the supplied function returns %TRUE For each of the fields,
339 	 *     %FALSE otherwise.
340 	 */
341 	public bool foreac(GstStructureForeachFunc func, void* userData)
342 	{
343 		return gst_structure_foreach(gstStructure, func, userData) != 0;
344 	}
345 
346 	/**
347 	 * Frees a #GstStructure and all its fields and values. The structure must not
348 	 * have a parent when this function is called.
349 	 */
350 	public void free()
351 	{
352 		gst_structure_free(gstStructure);
353 	}
354 
355 	/**
356 	 * Sets the boolean pointed to by @value corresponding to the value of the
357 	 * given field.  Caller is responsible for making sure the field exists
358 	 * and has the correct type.
359 	 *
360 	 * Params:
361 	 *     fieldname = the name of a field
362 	 *     value = a pointer to a #gboolean to set
363 	 *
364 	 * Return: %TRUE if the value could be set correctly. If there was no field
365 	 *     with @fieldname or the existing field did not contain a boolean, this
366 	 *     function returns %FALSE.
367 	 */
368 	public bool getBoolean(string fieldname, out bool value)
369 	{
370 		int outvalue;
371 		
372 		auto p = gst_structure_get_boolean(gstStructure, Str.toStringz(fieldname), &outvalue) != 0;
373 		
374 		value = (outvalue == 1);
375 		
376 		return p;
377 	}
378 
379 	/**
380 	 * Sets the clock time pointed to by @value corresponding to the clock time
381 	 * of the given field.  Caller is responsible for making sure the field exists
382 	 * and has the correct type.
383 	 *
384 	 * Params:
385 	 *     fieldname = the name of a field
386 	 *     value = a pointer to a #GstClockTime to set
387 	 *
388 	 * Return: %TRUE if the value could be set correctly. If there was no field
389 	 *     with @fieldname or the existing field did not contain a #GstClockTime, this
390 	 *     function returns %FALSE.
391 	 */
392 	public bool getClockTime(string fieldname, out GstClockTime value)
393 	{
394 		return gst_structure_get_clock_time(gstStructure, Str.toStringz(fieldname), &value) != 0;
395 	}
396 
397 	/**
398 	 * Sets the date pointed to by @value corresponding to the date of the
399 	 * given field.  Caller is responsible for making sure the field exists
400 	 * and has the correct type.
401 	 *
402 	 * On success @value will point to a newly-allocated copy of the date which
403 	 * should be freed with g_date_free() when no longer needed (note: this is
404 	 * inconsistent with e.g. gst_structure_get_string() which doesn't return a
405 	 * copy of the string).
406 	 *
407 	 * Params:
408 	 *     fieldname = the name of a field
409 	 *     value = a pointer to a #GDate to set
410 	 *
411 	 * Return: %TRUE if the value could be set correctly. If there was no field
412 	 *     with @fieldname or the existing field did not contain a data, this function
413 	 *     returns %FALSE.
414 	 */
415 	public bool getDate(string fieldname, out Date value)
416 	{
417 		GDate* outvalue = null;
418 		
419 		auto p = gst_structure_get_date(gstStructure, Str.toStringz(fieldname), &outvalue) != 0;
420 		
421 		value = new Date(outvalue);
422 		
423 		return p;
424 	}
425 
426 	/**
427 	 * Sets the datetime pointed to by @value corresponding to the datetime of the
428 	 * given field. Caller is responsible for making sure the field exists
429 	 * and has the correct type.
430 	 *
431 	 * On success @value will point to a reference of the datetime which
432 	 * should be unreffed with gst_date_time_unref() when no longer needed
433 	 * (note: this is inconsistent with e.g. gst_structure_get_string()
434 	 * which doesn't return a copy of the string).
435 	 *
436 	 * Params:
437 	 *     fieldname = the name of a field
438 	 *     value = a pointer to a #GstDateTime to set
439 	 *
440 	 * Return: %TRUE if the value could be set correctly. If there was no field
441 	 *     with @fieldname or the existing field did not contain a data, this function
442 	 *     returns %FALSE.
443 	 */
444 	public bool getDateTime(string fieldname, out DateTime value)
445 	{
446 		GstDateTime* outvalue = null;
447 		
448 		auto p = gst_structure_get_date_time(gstStructure, Str.toStringz(fieldname), &outvalue) != 0;
449 		
450 		value = ObjectG.getDObject!(DateTime)(outvalue);
451 		
452 		return p;
453 	}
454 
455 	/**
456 	 * Sets the double pointed to by @value corresponding to the value of the
457 	 * given field.  Caller is responsible for making sure the field exists
458 	 * and has the correct type.
459 	 *
460 	 * Params:
461 	 *     fieldname = the name of a field
462 	 *     value = a pointer to a gdouble to set
463 	 *
464 	 * Return: %TRUE if the value could be set correctly. If there was no field
465 	 *     with @fieldname or the existing field did not contain a double, this
466 	 *     function returns %FALSE.
467 	 */
468 	public bool getDouble(string fieldname, out double value)
469 	{
470 		return gst_structure_get_double(gstStructure, Str.toStringz(fieldname), &value) != 0;
471 	}
472 
473 	/**
474 	 * Sets the int pointed to by @value corresponding to the value of the
475 	 * given field.  Caller is responsible for making sure the field exists,
476 	 * has the correct type and that the enumtype is correct.
477 	 *
478 	 * Params:
479 	 *     fieldname = the name of a field
480 	 *     enumtype = the enum type of a field
481 	 *     value = a pointer to an int to set
482 	 *
483 	 * Return: %TRUE if the value could be set correctly. If there was no field
484 	 *     with @fieldname or the existing field did not contain an enum of the given
485 	 *     type, this function returns %FALSE.
486 	 */
487 	public bool getEnum(string fieldname, GType enumtype, out int value)
488 	{
489 		return gst_structure_get_enum(gstStructure, Str.toStringz(fieldname), enumtype, &value) != 0;
490 	}
491 
492 	/**
493 	 * Finds the field with the given name, and returns the type of the
494 	 * value it contains.  If the field is not found, G_TYPE_INVALID is
495 	 * returned.
496 	 *
497 	 * Params:
498 	 *     fieldname = the name of the field
499 	 *
500 	 * Return: the #GValue of the field
501 	 */
502 	public GType getFieldType(string fieldname)
503 	{
504 		return gst_structure_get_field_type(gstStructure, Str.toStringz(fieldname));
505 	}
506 
507 	/**
508 	 * Sets the integers pointed to by @value_numerator and @value_denominator
509 	 * corresponding to the value of the given field.  Caller is responsible
510 	 * for making sure the field exists and has the correct type.
511 	 *
512 	 * Params:
513 	 *     fieldname = the name of a field
514 	 *     valueNumerator = a pointer to an int to set
515 	 *     valueDenominator = a pointer to an int to set
516 	 *
517 	 * Return: %TRUE if the values could be set correctly. If there was no field
518 	 *     with @fieldname or the existing field did not contain a GstFraction, this
519 	 *     function returns %FALSE.
520 	 */
521 	public bool getFraction(string fieldname, out int valueNumerator, out int valueDenominator)
522 	{
523 		return gst_structure_get_fraction(gstStructure, Str.toStringz(fieldname), &valueNumerator, &valueDenominator) != 0;
524 	}
525 
526 	/**
527 	 * Sets the int pointed to by @value corresponding to the value of the
528 	 * given field.  Caller is responsible for making sure the field exists
529 	 * and has the correct type.
530 	 *
531 	 * Params:
532 	 *     fieldname = the name of a field
533 	 *     value = a pointer to an int to set
534 	 *
535 	 * Return: %TRUE if the value could be set correctly. If there was no field
536 	 *     with @fieldname or the existing field did not contain an int, this function
537 	 *     returns %FALSE.
538 	 */
539 	public bool getInt(string fieldname, out int value)
540 	{
541 		return gst_structure_get_int(gstStructure, Str.toStringz(fieldname), &value) != 0;
542 	}
543 
544 	/**
545 	 * Sets the #gint64 pointed to by @value corresponding to the value of the
546 	 * given field. Caller is responsible for making sure the field exists
547 	 * and has the correct type.
548 	 *
549 	 * Params:
550 	 *     fieldname = the name of a field
551 	 *     value = a pointer to a #gint64 to set
552 	 *
553 	 * Return: %TRUE if the value could be set correctly. If there was no field
554 	 *     with @fieldname or the existing field did not contain a #gint64, this function
555 	 *     returns %FALSE.
556 	 *
557 	 * Since: 1.4
558 	 */
559 	public bool getInt64(string fieldname, out long value)
560 	{
561 		return gst_structure_get_int64(gstStructure, Str.toStringz(fieldname), &value) != 0;
562 	}
563 
564 	/**
565 	 * Get the name of @structure as a string.
566 	 *
567 	 * Return: the name of the structure.
568 	 */
569 	public string getName()
570 	{
571 		return Str.toString(gst_structure_get_name(gstStructure));
572 	}
573 
574 	/**
575 	 * Get the name of @structure as a GQuark.
576 	 *
577 	 * Return: the quark representing the name of the structure.
578 	 */
579 	public GQuark getNameId()
580 	{
581 		return gst_structure_get_name_id(gstStructure);
582 	}
583 
584 	/**
585 	 * Finds the field corresponding to @fieldname, and returns the string
586 	 * contained in the field's value.  Caller is responsible for making
587 	 * sure the field exists and has the correct type.
588 	 *
589 	 * The string should not be modified, and remains valid until the next
590 	 * call to a gst_structure_*() function with the given structure.
591 	 *
592 	 * Params:
593 	 *     fieldname = the name of a field
594 	 *
595 	 * Return: a pointer to the string or %NULL when the
596 	 *     field did not exist or did not contain a string.
597 	 */
598 	public string getString(string fieldname)
599 	{
600 		return Str.toString(gst_structure_get_string(gstStructure, Str.toStringz(fieldname)));
601 	}
602 
603 	/**
604 	 * Sets the uint pointed to by @value corresponding to the value of the
605 	 * given field.  Caller is responsible for making sure the field exists
606 	 * and has the correct type.
607 	 *
608 	 * Params:
609 	 *     fieldname = the name of a field
610 	 *     value = a pointer to a uint to set
611 	 *
612 	 * Return: %TRUE if the value could be set correctly. If there was no field
613 	 *     with @fieldname or the existing field did not contain a uint, this function
614 	 *     returns %FALSE.
615 	 */
616 	public bool getUint(string fieldname, out uint value)
617 	{
618 		return gst_structure_get_uint(gstStructure, Str.toStringz(fieldname), &value) != 0;
619 	}
620 
621 	/**
622 	 * Sets the #guint64 pointed to by @value corresponding to the value of the
623 	 * given field. Caller is responsible for making sure the field exists
624 	 * and has the correct type.
625 	 *
626 	 * Params:
627 	 *     fieldname = the name of a field
628 	 *     value = a pointer to a #guint64 to set
629 	 *
630 	 * Return: %TRUE if the value could be set correctly. If there was no field
631 	 *     with @fieldname or the existing field did not contain a #guint64, this function
632 	 *     returns %FALSE.
633 	 *
634 	 * Since: 1.4
635 	 */
636 	public bool getUint64(string fieldname, out ulong value)
637 	{
638 		return gst_structure_get_uint64(gstStructure, Str.toStringz(fieldname), &value) != 0;
639 	}
640 
641 	/**
642 	 * Parses the variable arguments and reads fields from @structure accordingly.
643 	 * valist-variant of gst_structure_get(). Look at the documentation of
644 	 * gst_structure_get() for more details.
645 	 *
646 	 * Params:
647 	 *     firstFieldname = the name of the first field to read
648 	 *     args = variable arguments
649 	 *
650 	 * Return: %TRUE, or %FALSE if there was a problem reading any of the fields
651 	 */
652 	public bool getValist(string firstFieldname, void* args)
653 	{
654 		return gst_structure_get_valist(gstStructure, Str.toStringz(firstFieldname), args) != 0;
655 	}
656 
657 	/**
658 	 * Get the value of the field with name @fieldname.
659 	 *
660 	 * Params:
661 	 *     fieldname = the name of the field to get
662 	 *
663 	 * Return: the #GValue corresponding to the field with the given name.
664 	 */
665 	public Value getValue(string fieldname)
666 	{
667 		auto p = gst_structure_get_value(gstStructure, Str.toStringz(fieldname));
668 		
669 		if(p is null)
670 		{
671 			return null;
672 		}
673 		
674 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
675 	}
676 
677 	/**
678 	 * Check if @structure contains a field named @fieldname.
679 	 *
680 	 * Params:
681 	 *     fieldname = the name of a field
682 	 *
683 	 * Return: %TRUE if the structure contains a field with the given name
684 	 */
685 	public bool hasField(string fieldname)
686 	{
687 		return gst_structure_has_field(gstStructure, Str.toStringz(fieldname)) != 0;
688 	}
689 
690 	/**
691 	 * Check if @structure contains a field named @fieldname and with GType @type.
692 	 *
693 	 * Params:
694 	 *     fieldname = the name of a field
695 	 *     type = the type of a value
696 	 *
697 	 * Return: %TRUE if the structure contains a field with the given name and type
698 	 */
699 	public bool hasFieldTyped(string fieldname, GType type)
700 	{
701 		return gst_structure_has_field_typed(gstStructure, Str.toStringz(fieldname), type) != 0;
702 	}
703 
704 	/**
705 	 * Checks if the structure has the given name
706 	 *
707 	 * Params:
708 	 *     name = structure name to check for
709 	 *
710 	 * Return: %TRUE if @name matches the name of the structure.
711 	 */
712 	public bool hasName(string name)
713 	{
714 		return gst_structure_has_name(gstStructure, Str.toStringz(name)) != 0;
715 	}
716 
717 	/**
718 	 * Parses the variable arguments and reads fields from @structure accordingly.
719 	 * valist-variant of gst_structure_id_get(). Look at the documentation of
720 	 * gst_structure_id_get() for more details.
721 	 *
722 	 * Params:
723 	 *     firstFieldId = the quark of the first field to read
724 	 *     args = variable arguments
725 	 *
726 	 * Return: %TRUE, or %FALSE if there was a problem reading any of the fields
727 	 */
728 	public bool idGetValist(GQuark firstFieldId, void* args)
729 	{
730 		return gst_structure_id_get_valist(gstStructure, firstFieldId, args) != 0;
731 	}
732 
733 	/**
734 	 * Get the value of the field with GQuark @field.
735 	 *
736 	 * Params:
737 	 *     field = the #GQuark of the field to get
738 	 *
739 	 * Return: the #GValue corresponding to the field with the given name
740 	 *     identifier.
741 	 */
742 	public Value idGetValue(GQuark field)
743 	{
744 		auto p = gst_structure_id_get_value(gstStructure, field);
745 		
746 		if(p is null)
747 		{
748 			return null;
749 		}
750 		
751 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
752 	}
753 
754 	/**
755 	 * Check if @structure contains a field named @field.
756 	 *
757 	 * Params:
758 	 *     field = #GQuark of the field name
759 	 *
760 	 * Return: %TRUE if the structure contains a field with the given name
761 	 */
762 	public bool idHasField(GQuark field)
763 	{
764 		return gst_structure_id_has_field(gstStructure, field) != 0;
765 	}
766 
767 	/**
768 	 * Check if @structure contains a field named @field and with GType @type.
769 	 *
770 	 * Params:
771 	 *     field = #GQuark of the field name
772 	 *     type = the type of a value
773 	 *
774 	 * Return: %TRUE if the structure contains a field with the given name and type
775 	 */
776 	public bool idHasFieldTyped(GQuark field, GType type)
777 	{
778 		return gst_structure_id_has_field_typed(gstStructure, field, type) != 0;
779 	}
780 
781 	/**
782 	 * va_list form of gst_structure_id_set().
783 	 *
784 	 * Params:
785 	 *     fieldname = the name of the field to set
786 	 *     varargs = variable arguments
787 	 */
788 	public void idSetValist(GQuark fieldname, void* varargs)
789 	{
790 		gst_structure_id_set_valist(gstStructure, fieldname, varargs);
791 	}
792 
793 	/**
794 	 * Sets the field with the given GQuark @field to @value.  If the field
795 	 * does not exist, it is created.  If the field exists, the previous
796 	 * value is replaced and freed.
797 	 *
798 	 * Params:
799 	 *     field = a #GQuark representing a field
800 	 *     value = the new value of the field
801 	 */
802 	public void idSetValue(GQuark field, Value value)
803 	{
804 		gst_structure_id_set_value(gstStructure, field, (value is null) ? null : value.getValueStruct());
805 	}
806 
807 	/**
808 	 * Sets the field with the given GQuark @field to @value.  If the field
809 	 * does not exist, it is created.  If the field exists, the previous
810 	 * value is replaced and freed.
811 	 *
812 	 * Params:
813 	 *     field = a #GQuark representing a field
814 	 *     value = the new value of the field
815 	 */
816 	public void idTakeValue(GQuark field, Value value)
817 	{
818 		gst_structure_id_take_value(gstStructure, field, (value is null) ? null : value.getValueStruct());
819 	}
820 
821 	/**
822 	 * Intersects @struct1 and @struct2 and returns the intersection.
823 	 *
824 	 * Params:
825 	 *     struct2 = a #GstStructure
826 	 *
827 	 * Return: Intersection of @struct1 and @struct2
828 	 */
829 	public Structure intersect(Structure struct2)
830 	{
831 		auto p = gst_structure_intersect(gstStructure, (struct2 is null) ? null : struct2.getStructureStruct());
832 		
833 		if(p is null)
834 		{
835 			return null;
836 		}
837 		
838 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
839 	}
840 
841 	/**
842 	 * Tests if the two #GstStructure are equal.
843 	 *
844 	 * Params:
845 	 *     structure2 = a #GstStructure.
846 	 *
847 	 * Return: %TRUE if the two structures have the same name and field.
848 	 */
849 	public bool isEqual(Structure structure2)
850 	{
851 		return gst_structure_is_equal(gstStructure, (structure2 is null) ? null : structure2.getStructureStruct()) != 0;
852 	}
853 
854 	/**
855 	 * Checks if @subset is a subset of @superset, i.e. has the same
856 	 * structure name and for all fields that are existing in @superset,
857 	 * @subset has a value that is a subset of the value in @superset.
858 	 *
859 	 * Params:
860 	 *     superset = a potentially greater #GstStructure
861 	 *
862 	 * Return: %TRUE if @subset is a subset of @superset
863 	 */
864 	public bool isSubset(Structure superset)
865 	{
866 		return gst_structure_is_subset(gstStructure, (superset is null) ? null : superset.getStructureStruct()) != 0;
867 	}
868 
869 	/**
870 	 * Calls the provided function once for each field in the #GstStructure. In
871 	 * contrast to gst_structure_foreach(), the function may modify but not delete the
872 	 * fields. The structure must be mutable.
873 	 *
874 	 * Params:
875 	 *     func = a function to call for each field
876 	 *     userData = private data
877 	 *
878 	 * Return: %TRUE if the supplied function returns %TRUE For each of the fields,
879 	 *     %FALSE otherwise.
880 	 */
881 	public bool mapInPlace(GstStructureMapFunc func, void* userData)
882 	{
883 		return gst_structure_map_in_place(gstStructure, func, userData) != 0;
884 	}
885 
886 	/**
887 	 * Get the number of fields in the structure.
888 	 *
889 	 * Return: the number of fields in the structure
890 	 */
891 	public int nFields()
892 	{
893 		return gst_structure_n_fields(gstStructure);
894 	}
895 
896 	/**
897 	 * Get the name of the given field number, counting from 0 onwards.
898 	 *
899 	 * Params:
900 	 *     index = the index to get the name of
901 	 *
902 	 * Return: the name of the given field number
903 	 */
904 	public string nthFieldName(uint index)
905 	{
906 		return Str.toString(gst_structure_nth_field_name(gstStructure, index));
907 	}
908 
909 	/**
910 	 * Removes all fields in a GstStructure.
911 	 */
912 	public void removeAllFields()
913 	{
914 		gst_structure_remove_all_fields(gstStructure);
915 	}
916 
917 	/**
918 	 * Removes the field with the given name.  If the field with the given
919 	 * name does not exist, the structure is unchanged.
920 	 *
921 	 * Params:
922 	 *     fieldname = the name of the field to remove
923 	 */
924 	public void removeField(string fieldname)
925 	{
926 		gst_structure_remove_field(gstStructure, Str.toStringz(fieldname));
927 	}
928 
929 	/**
930 	 * va_list form of gst_structure_remove_fields().
931 	 *
932 	 * Params:
933 	 *     fieldname = the name of the field to remove
934 	 *     varargs = %NULL-terminated list of more fieldnames to remove
935 	 */
936 	public void removeFieldsValist(string fieldname, void* varargs)
937 	{
938 		gst_structure_remove_fields_valist(gstStructure, Str.toStringz(fieldname), varargs);
939 	}
940 
941 	/**
942 	 * Sets the name of the structure to the given @name.  The string
943 	 * provided is copied before being used. It must not be empty, start with a
944 	 * letter and can be followed by letters, numbers and any of "/-_.:".
945 	 *
946 	 * Params:
947 	 *     name = the new name of the structure
948 	 */
949 	public void setName(string name)
950 	{
951 		gst_structure_set_name(gstStructure, Str.toStringz(name));
952 	}
953 
954 	/**
955 	 * Sets the parent_refcount field of #GstStructure. This field is used to
956 	 * determine whether a structure is mutable or not. This function should only be
957 	 * called by code implementing parent objects of #GstStructure, as described in
958 	 * the MT Refcounting section of the design documents.
959 	 *
960 	 * Params:
961 	 *     refcount = a pointer to the parent's refcount
962 	 *
963 	 * Return: %TRUE if the parent refcount could be set.
964 	 */
965 	public bool setParentRefcount(int* refcount)
966 	{
967 		return gst_structure_set_parent_refcount(gstStructure, refcount) != 0;
968 	}
969 
970 	/**
971 	 * va_list form of gst_structure_set().
972 	 *
973 	 * Params:
974 	 *     fieldname = the name of the field to set
975 	 *     varargs = variable arguments
976 	 */
977 	public void setValist(string fieldname, void* varargs)
978 	{
979 		gst_structure_set_valist(gstStructure, Str.toStringz(fieldname), varargs);
980 	}
981 
982 	/**
983 	 * Sets the field with the given name @field to @value.  If the field
984 	 * does not exist, it is created.  If the field exists, the previous
985 	 * value is replaced and freed.
986 	 *
987 	 * Params:
988 	 *     fieldname = the name of the field to set
989 	 *     value = the new value of the field
990 	 */
991 	public void setValue(string fieldname, Value value)
992 	{
993 		gst_structure_set_value(gstStructure, Str.toStringz(fieldname), (value is null) ? null : value.getValueStruct());
994 	}
995 
996 	/**
997 	 * Sets the field with the given name @field to @value.  If the field
998 	 * does not exist, it is created.  If the field exists, the previous
999 	 * value is replaced and freed. The function will take ownership of @value.
1000 	 *
1001 	 * Params:
1002 	 *     fieldname = the name of the field to set
1003 	 *     value = the new value of the field
1004 	 */
1005 	public void takeValue(string fieldname, Value value)
1006 	{
1007 		gst_structure_take_value(gstStructure, Str.toStringz(fieldname), (value is null) ? null : value.getValueStruct());
1008 	}
1009 
1010 	/**
1011 	 * Converts @structure to a human-readable string representation.
1012 	 *
1013 	 * For debugging purposes its easier to do something like this:
1014 	 * |[
1015 	 * GST_LOG ("structure is %" GST_PTR_FORMAT, structure);
1016 	 * ]|
1017 	 * This prints the structure in human readable form.
1018 	 *
1019 	 * The current implementation of serialization will lead to unexpected results
1020 	 * when there are nested #GstCaps / #GstStructure deeper than one level.
1021 	 *
1022 	 * Free-function: g_free
1023 	 *
1024 	 * Return: a pointer to string allocated by g_malloc().
1025 	 *     g_free() after usage.
1026 	 */
1027 	public override string toString()
1028 	{
1029 		return Str.toString(gst_structure_to_string(gstStructure));
1030 	}
1031 
1032 	/**
1033 	 * Creates a #GstStructure from a string representation.
1034 	 * If end is not %NULL, a pointer to the place inside the given string
1035 	 * where parsing ended will be returned.
1036 	 *
1037 	 * Free-function: gst_structure_free
1038 	 *
1039 	 * Params:
1040 	 *     str = a string representation of a #GstStructure.
1041 	 *     end = pointer to store the end of the string in.
1042 	 *
1043 	 * Return: a new #GstStructure or %NULL
1044 	 *     when the string could not be parsed. Free with
1045 	 *     gst_structure_free() after use.
1046 	 */
1047 	public static Structure fromString(string str, out string end)
1048 	{
1049 		char* outend = null;
1050 		
1051 		auto p = gst_structure_from_string(Str.toStringz(str), &outend);
1052 		
1053 		end = Str.toString(outend);
1054 		
1055 		if(p is null)
1056 		{
1057 			return null;
1058 		}
1059 		
1060 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
1061 	}
1062 }