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.TagList;
26 
27 private import glib.ConstructionException;
28 private import glib.Date;
29 private import glib.MemorySlice;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import gobject.Value;
33 private import gstreamer.DateTime;
34 private import gstreamer.Sample;
35 private import gstreamer.c.functions;
36 public  import gstreamer.c.types;
37 public  import gstreamerc.gstreamertypes;
38 
39 
40 /**
41  * List of tags and values used to describe media metadata.
42  * 
43  * Strings in structures must be ASCII or UTF-8 encoded. Other encodings are
44  * not allowed. Strings must not be empty or %NULL.
45  */
46 public class TagList
47 {
48 	/** the main Gtk struct */
49 	protected GstTagList* gstTagList;
50 	protected bool ownedRef;
51 
52 	/** Get the main Gtk struct */
53 	public GstTagList* getTagListStruct(bool transferOwnership = false)
54 	{
55 		if (transferOwnership)
56 			ownedRef = false;
57 		return gstTagList;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected void* getStruct()
62 	{
63 		return cast(void*)gstTagList;
64 	}
65 
66 	/**
67 	 * Sets our main struct and passes it to the parent class.
68 	 */
69 	public this (GstTagList* gstTagList, bool ownedRef = false)
70 	{
71 		this.gstTagList = gstTagList;
72 		this.ownedRef = ownedRef;
73 	}
74 
75 
76 	/**
77 	 * Gets the #GType used for this tag.
78 	 *
79 	 * Params:
80 	 *     tag = the tag
81 	 *
82 	 * Returns: the #GType of this tag
83 	 */
84 	public static GType getType(string tag)
85 	{
86 		return gst_tag_get_type(Str.toStringz(tag));
87 	}
88 
89 	/**
90 	 * Creates a new empty GstTagList.
91 	 *
92 	 * Free-function: gst_tag_list_unref
93 	 *
94 	 * Returns: An empty tag list
95 	 *
96 	 * Throws: ConstructionException GTK+ fails to create the object.
97 	 */
98 	public this()
99 	{
100 		auto p = gst_tag_list_new_empty();
101 
102 		if(p is null)
103 		{
104 			throw new ConstructionException("null returned by new_empty");
105 		}
106 
107 		this(cast(GstTagList*) p);
108 	}
109 
110 	/**
111 	 * Deserializes a tag list.
112 	 *
113 	 * Params:
114 	 *     str = a string created with gst_tag_list_to_string()
115 	 *
116 	 * Returns: a new #GstTagList, or %NULL in case of an
117 	 *     error.
118 	 *
119 	 * Throws: ConstructionException GTK+ fails to create the object.
120 	 */
121 	public this(string str)
122 	{
123 		auto p = gst_tag_list_new_from_string(Str.toStringz(str));
124 
125 		if(p is null)
126 		{
127 			throw new ConstructionException("null returned by new_from_string");
128 		}
129 
130 		this(cast(GstTagList*) p);
131 	}
132 
133 	/**
134 	 * Just like gst_tag_list_new(), only that it takes a va_list argument.
135 	 * Useful mostly for language bindings.
136 	 *
137 	 * Free-function: gst_tag_list_unref
138 	 *
139 	 * Params:
140 	 *     varArgs = tag / value pairs to set
141 	 *
142 	 * Returns: a new #GstTagList. Free with gst_tag_list_unref()
143 	 *     when no longer needed.
144 	 *
145 	 * Throws: ConstructionException GTK+ fails to create the object.
146 	 */
147 	public this(void* varArgs)
148 	{
149 		auto p = gst_tag_list_new_valist(varArgs);
150 
151 		if(p is null)
152 		{
153 			throw new ConstructionException("null returned by new_valist");
154 		}
155 
156 		this(cast(GstTagList*) p);
157 	}
158 
159 	/**
160 	 * Sets the values for the given tags using the specified mode.
161 	 *
162 	 * Params:
163 	 *     mode = the mode to use
164 	 *     tag = tag
165 	 *     varArgs = tag / value pairs to set
166 	 */
167 	public void addValist(GstTagMergeMode mode, string tag, void* varArgs)
168 	{
169 		gst_tag_list_add_valist(gstTagList, mode, Str.toStringz(tag), varArgs);
170 	}
171 
172 	/**
173 	 * Sets the GValues for the given tags using the specified mode.
174 	 *
175 	 * Params:
176 	 *     mode = the mode to use
177 	 *     tag = tag
178 	 *     varArgs = tag / GValue pairs to set
179 	 */
180 	public void addValistValues(GstTagMergeMode mode, string tag, void* varArgs)
181 	{
182 		gst_tag_list_add_valist_values(gstTagList, mode, Str.toStringz(tag), varArgs);
183 	}
184 
185 	/**
186 	 * Sets the GValue for a given tag using the specified mode.
187 	 *
188 	 * Params:
189 	 *     mode = the mode to use
190 	 *     tag = tag
191 	 *     value = GValue for this tag
192 	 */
193 	public void addValue(GstTagMergeMode mode, string tag, Value value)
194 	{
195 		gst_tag_list_add_value(gstTagList, mode, Str.toStringz(tag), (value is null) ? null : value.getValueStruct());
196 	}
197 
198 	/**
199 	 * Calls the given function for each tag inside the tag list. Note that if there
200 	 * is no tag, the function won't be called at all.
201 	 *
202 	 * Params:
203 	 *     func = function to be called for each tag
204 	 *     userData = user specified data
205 	 */
206 	public void foreac(GstTagForeachFunc func, void* userData)
207 	{
208 		gst_tag_list_foreach(gstTagList, func, userData);
209 	}
210 
211 	/**
212 	 * Copies the contents for the given tag into the value, merging multiple values
213 	 * into one if multiple values are associated with the tag.
214 	 *
215 	 * Params:
216 	 *     tag = tag to read out
217 	 *     value = location for the result
218 	 *
219 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
220 	 *     given list.
221 	 */
222 	public bool getBoolean(string tag, out bool value)
223 	{
224 		int outvalue;
225 
226 		auto p = gst_tag_list_get_boolean(gstTagList, Str.toStringz(tag), &outvalue) != 0;
227 
228 		value = (outvalue == 1);
229 
230 		return p;
231 	}
232 
233 	/**
234 	 * Gets the value that is at the given index for the given tag in the given
235 	 * list.
236 	 *
237 	 * Params:
238 	 *     tag = tag to read out
239 	 *     index = number of entry to read out
240 	 *     value = location for the result
241 	 *
242 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
243 	 *     given list.
244 	 */
245 	public bool getBooleanIndex(string tag, uint index, out bool value)
246 	{
247 		int outvalue;
248 
249 		auto p = gst_tag_list_get_boolean_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
250 
251 		value = (outvalue == 1);
252 
253 		return p;
254 	}
255 
256 	/**
257 	 * Copies the first date for the given tag in the taglist into the variable
258 	 * pointed to by @value. Free the date with g_date_free() when it is no longer
259 	 * needed.
260 	 *
261 	 * Free-function: g_date_free
262 	 *
263 	 * Params:
264 	 *     tag = tag to read out
265 	 *     value = address of a GDate pointer
266 	 *         variable to store the result into
267 	 *
268 	 * Returns: %TRUE, if a date was copied, %FALSE if the tag didn't exist in the
269 	 *     given list or if it was %NULL.
270 	 */
271 	public bool getDate(string tag, out Date value)
272 	{
273 		GDate* outvalue = null;
274 
275 		auto p = gst_tag_list_get_date(gstTagList, Str.toStringz(tag), &outvalue) != 0;
276 
277 		value = new Date(outvalue);
278 
279 		return p;
280 	}
281 
282 	/**
283 	 * Gets the date that is at the given index for the given tag in the given
284 	 * list and copies it into the variable pointed to by @value. Free the date
285 	 * with g_date_free() when it is no longer needed.
286 	 *
287 	 * Free-function: g_date_free
288 	 *
289 	 * Params:
290 	 *     tag = tag to read out
291 	 *     index = number of entry to read out
292 	 *     value = location for the result
293 	 *
294 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
295 	 *     given list or if it was %NULL.
296 	 */
297 	public bool getDateIndex(string tag, uint index, out Date value)
298 	{
299 		GDate* outvalue = null;
300 
301 		auto p = gst_tag_list_get_date_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
302 
303 		value = new Date(outvalue);
304 
305 		return p;
306 	}
307 
308 	/**
309 	 * Copies the first datetime for the given tag in the taglist into the variable
310 	 * pointed to by @value. Unref the date with gst_date_time_unref() when
311 	 * it is no longer needed.
312 	 *
313 	 * Free-function: gst_date_time_unref
314 	 *
315 	 * Params:
316 	 *     tag = tag to read out
317 	 *     value = address of a #GstDateTime
318 	 *         pointer variable to store the result into
319 	 *
320 	 * Returns: %TRUE, if a datetime was copied, %FALSE if the tag didn't exist in
321 	 *     the given list or if it was %NULL.
322 	 */
323 	public bool getDateTime(string tag, out DateTime value)
324 	{
325 		GstDateTime* outvalue = null;
326 
327 		auto p = gst_tag_list_get_date_time(gstTagList, Str.toStringz(tag), &outvalue) != 0;
328 
329 		value = ObjectG.getDObject!(DateTime)(outvalue);
330 
331 		return p;
332 	}
333 
334 	/**
335 	 * Gets the datetime that is at the given index for the given tag in the given
336 	 * list and copies it into the variable pointed to by @value. Unref the datetime
337 	 * with gst_date_time_unref() when it is no longer needed.
338 	 *
339 	 * Free-function: gst_date_time_unref
340 	 *
341 	 * Params:
342 	 *     tag = tag to read out
343 	 *     index = number of entry to read out
344 	 *     value = location for the result
345 	 *
346 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
347 	 *     given list or if it was %NULL.
348 	 */
349 	public bool getDateTimeIndex(string tag, uint index, out DateTime value)
350 	{
351 		GstDateTime* outvalue = null;
352 
353 		auto p = gst_tag_list_get_date_time_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
354 
355 		value = ObjectG.getDObject!(DateTime)(outvalue);
356 
357 		return p;
358 	}
359 
360 	/**
361 	 * Copies the contents for the given tag into the value, merging multiple values
362 	 * into one if multiple values are associated with the tag.
363 	 *
364 	 * Params:
365 	 *     tag = tag to read out
366 	 *     value = location for the result
367 	 *
368 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
369 	 *     given list.
370 	 */
371 	public bool getDouble(string tag, out double value)
372 	{
373 		return gst_tag_list_get_double(gstTagList, Str.toStringz(tag), &value) != 0;
374 	}
375 
376 	/**
377 	 * Gets the value that is at the given index for the given tag in the given
378 	 * list.
379 	 *
380 	 * Params:
381 	 *     tag = tag to read out
382 	 *     index = number of entry to read out
383 	 *     value = location for the result
384 	 *
385 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
386 	 *     given list.
387 	 */
388 	public bool getDoubleIndex(string tag, uint index, out double value)
389 	{
390 		return gst_tag_list_get_double_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
391 	}
392 
393 	/**
394 	 * Copies the contents for the given tag into the value, merging multiple values
395 	 * into one if multiple values are associated with the tag.
396 	 *
397 	 * Params:
398 	 *     tag = tag to read out
399 	 *     value = location for the result
400 	 *
401 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
402 	 *     given list.
403 	 */
404 	public bool getFloat(string tag, out float value)
405 	{
406 		return gst_tag_list_get_float(gstTagList, Str.toStringz(tag), &value) != 0;
407 	}
408 
409 	/**
410 	 * Gets the value that is at the given index for the given tag in the given
411 	 * list.
412 	 *
413 	 * Params:
414 	 *     tag = tag to read out
415 	 *     index = number of entry to read out
416 	 *     value = location for the result
417 	 *
418 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
419 	 *     given list.
420 	 */
421 	public bool getFloatIndex(string tag, uint index, out float value)
422 	{
423 		return gst_tag_list_get_float_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
424 	}
425 
426 	/**
427 	 * Copies the contents for the given tag into the value, merging multiple values
428 	 * into one if multiple values are associated with the tag.
429 	 *
430 	 * Params:
431 	 *     tag = tag to read out
432 	 *     value = location for the result
433 	 *
434 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
435 	 *     given list.
436 	 */
437 	public bool getInt(string tag, out int value)
438 	{
439 		return gst_tag_list_get_int(gstTagList, Str.toStringz(tag), &value) != 0;
440 	}
441 
442 	/** */
443 	public bool getInt64(string tag, long* value)
444 	{
445 		return gst_tag_list_get_int64(gstTagList, Str.toStringz(tag), value) != 0;
446 	}
447 
448 	/**
449 	 * Gets the value that is at the given index for the given tag in the given
450 	 * list.
451 	 *
452 	 * Params:
453 	 *     tag = tag to read out
454 	 *     index = number of entry to read out
455 	 *     value = location for the result
456 	 *
457 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
458 	 *     given list.
459 	 */
460 	public bool getInt64Index(string tag, uint index, out long value)
461 	{
462 		return gst_tag_list_get_int64_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
463 	}
464 
465 	/**
466 	 * Gets the value that is at the given index for the given tag in the given
467 	 * list.
468 	 *
469 	 * Params:
470 	 *     tag = tag to read out
471 	 *     index = number of entry to read out
472 	 *     value = location for the result
473 	 *
474 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
475 	 *     given list.
476 	 */
477 	public bool getIntIndex(string tag, uint index, out int value)
478 	{
479 		return gst_tag_list_get_int_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
480 	}
481 
482 	/**
483 	 * Copies the contents for the given tag into the value, merging multiple values
484 	 * into one if multiple values are associated with the tag.
485 	 *
486 	 * Params:
487 	 *     tag = tag to read out
488 	 *     value = location for the result
489 	 *
490 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
491 	 *     given list.
492 	 */
493 	public bool getPointer(string tag, out void* value)
494 	{
495 		return gst_tag_list_get_pointer(gstTagList, Str.toStringz(tag), &value) != 0;
496 	}
497 
498 	/**
499 	 * Gets the value that is at the given index for the given tag in the given
500 	 * list.
501 	 *
502 	 * Params:
503 	 *     tag = tag to read out
504 	 *     index = number of entry to read out
505 	 *     value = location for the result
506 	 *
507 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
508 	 *     given list.
509 	 */
510 	public bool getPointerIndex(string tag, uint index, out void* value)
511 	{
512 		return gst_tag_list_get_pointer_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
513 	}
514 
515 	/**
516 	 * Copies the first sample for the given tag in the taglist into the variable
517 	 * pointed to by @sample. Free the sample with gst_sample_unref() when it is
518 	 * no longer needed. You can retrieve the buffer from the sample using
519 	 * gst_sample_get_buffer() and the associated caps (if any) with
520 	 * gst_sample_get_caps().
521 	 *
522 	 * Free-function: gst_sample_unref
523 	 *
524 	 * Params:
525 	 *     tag = tag to read out
526 	 *     sample = address of a GstSample
527 	 *         pointer variable to store the result into
528 	 *
529 	 * Returns: %TRUE, if a sample was returned, %FALSE if the tag didn't exist in
530 	 *     the given list or if it was %NULL.
531 	 */
532 	public bool getSample(string tag, out Sample sample)
533 	{
534 		GstSample* outsample = null;
535 
536 		auto p = gst_tag_list_get_sample(gstTagList, Str.toStringz(tag), &outsample) != 0;
537 
538 		sample = ObjectG.getDObject!(Sample)(outsample);
539 
540 		return p;
541 	}
542 
543 	/**
544 	 * Gets the sample that is at the given index for the given tag in the given
545 	 * list and copies it into the variable pointed to by @sample. Free the sample
546 	 * with gst_sample_unref() when it is no longer needed. You can retrieve the
547 	 * buffer from the sample using gst_sample_get_buffer() and the associated
548 	 * caps (if any) with gst_sample_get_caps().
549 	 *
550 	 * Free-function: gst_sample_unref
551 	 *
552 	 * Params:
553 	 *     tag = tag to read out
554 	 *     index = number of entry to read out
555 	 *     sample = address of a GstSample
556 	 *         pointer variable to store the result into
557 	 *
558 	 * Returns: %TRUE, if a sample was copied, %FALSE if the tag didn't exist in the
559 	 *     given list or if it was %NULL.
560 	 */
561 	public bool getSampleIndex(string tag, uint index, out Sample sample)
562 	{
563 		GstSample* outsample = null;
564 
565 		auto p = gst_tag_list_get_sample_index(gstTagList, Str.toStringz(tag), index, &outsample) != 0;
566 
567 		sample = ObjectG.getDObject!(Sample)(outsample);
568 
569 		return p;
570 	}
571 
572 	/**
573 	 * Gets the scope of @list.
574 	 *
575 	 * Returns: The scope of @list
576 	 */
577 	public GstTagScope getScope()
578 	{
579 		return gst_tag_list_get_scope(gstTagList);
580 	}
581 
582 	/**
583 	 * Copies the contents for the given tag into the value, possibly merging
584 	 * multiple values into one if multiple values are associated with the tag.
585 	 *
586 	 * Use gst_tag_list_get_string_index (list, tag, 0, value) if you want
587 	 * to retrieve the first string associated with this tag unmodified.
588 	 *
589 	 * The resulting string in @value will be in UTF-8 encoding and should be
590 	 * freed by the caller using g_free when no longer needed. The
591 	 * returned string is also guaranteed to be non-%NULL and non-empty.
592 	 *
593 	 * Free-function: g_free
594 	 *
595 	 * Params:
596 	 *     tag = tag to read out
597 	 *     value = location for the result
598 	 *
599 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
600 	 *     given list.
601 	 */
602 	public bool getString(string tag, out string value)
603 	{
604 		char* outvalue = null;
605 
606 		auto p = gst_tag_list_get_string(gstTagList, Str.toStringz(tag), &outvalue) != 0;
607 
608 		value = Str.toString(outvalue);
609 
610 		return p;
611 	}
612 
613 	/**
614 	 * Gets the value that is at the given index for the given tag in the given
615 	 * list.
616 	 *
617 	 * The resulting string in @value will be in UTF-8 encoding and should be
618 	 * freed by the caller using g_free when no longer needed. The
619 	 * returned string is also guaranteed to be non-%NULL and non-empty.
620 	 *
621 	 * Free-function: g_free
622 	 *
623 	 * Params:
624 	 *     tag = tag to read out
625 	 *     index = number of entry to read out
626 	 *     value = location for the result
627 	 *
628 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
629 	 *     given list.
630 	 */
631 	public bool getStringIndex(string tag, uint index, out string value)
632 	{
633 		char* outvalue = null;
634 
635 		auto p = gst_tag_list_get_string_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
636 
637 		value = Str.toString(outvalue);
638 
639 		return p;
640 	}
641 
642 	/**
643 	 * Checks how many value are stored in this tag list for the given tag.
644 	 *
645 	 * Params:
646 	 *     tag = the tag to query
647 	 *
648 	 * Returns: The number of tags stored
649 	 */
650 	public uint getTagSize(string tag)
651 	{
652 		return gst_tag_list_get_tag_size(gstTagList, Str.toStringz(tag));
653 	}
654 
655 	/**
656 	 * Copies the contents for the given tag into the value, merging multiple values
657 	 * into one if multiple values are associated with the tag.
658 	 *
659 	 * Params:
660 	 *     tag = tag to read out
661 	 *     value = location for the result
662 	 *
663 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
664 	 *     given list.
665 	 */
666 	public bool getUint(string tag, out uint value)
667 	{
668 		return gst_tag_list_get_uint(gstTagList, Str.toStringz(tag), &value) != 0;
669 	}
670 
671 	/**
672 	 * Copies the contents for the given tag into the value, merging multiple values
673 	 * into one if multiple values are associated with the tag.
674 	 *
675 	 * Params:
676 	 *     tag = tag to read out
677 	 *     value = location for the result
678 	 *
679 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
680 	 *     given list.
681 	 */
682 	public bool getUint64(string tag, out ulong value)
683 	{
684 		return gst_tag_list_get_uint64(gstTagList, Str.toStringz(tag), &value) != 0;
685 	}
686 
687 	/**
688 	 * Gets the value that is at the given index for the given tag in the given
689 	 * list.
690 	 *
691 	 * Params:
692 	 *     tag = tag to read out
693 	 *     index = number of entry to read out
694 	 *     value = location for the result
695 	 *
696 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
697 	 *     given list.
698 	 */
699 	public bool getUint64Index(string tag, uint index, out ulong value)
700 	{
701 		return gst_tag_list_get_uint64_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
702 	}
703 
704 	/**
705 	 * Gets the value that is at the given index for the given tag in the given
706 	 * list.
707 	 *
708 	 * Params:
709 	 *     tag = tag to read out
710 	 *     index = number of entry to read out
711 	 *     value = location for the result
712 	 *
713 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
714 	 *     given list.
715 	 */
716 	public bool getUintIndex(string tag, uint index, out uint value)
717 	{
718 		return gst_tag_list_get_uint_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
719 	}
720 
721 	/**
722 	 * Gets the value that is at the given index for the given tag in the given
723 	 * list.
724 	 *
725 	 * Params:
726 	 *     tag = tag to read out
727 	 *     index = number of entry to read out
728 	 *
729 	 * Returns: The GValue for the specified
730 	 *     entry or %NULL if the tag wasn't available or the tag
731 	 *     doesn't have as many entries
732 	 */
733 	public Value getValueIndex(string tag, uint index)
734 	{
735 		auto p = gst_tag_list_get_value_index(gstTagList, Str.toStringz(tag), index);
736 
737 		if(p is null)
738 		{
739 			return null;
740 		}
741 
742 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
743 	}
744 
745 	/**
746 	 * Inserts the tags of the @from list into the first list using the given mode.
747 	 *
748 	 * Params:
749 	 *     from = list to merge from
750 	 *     mode = the mode to use
751 	 */
752 	public void insert(TagList from, GstTagMergeMode mode)
753 	{
754 		gst_tag_list_insert(gstTagList, (from is null) ? null : from.getTagListStruct(), mode);
755 	}
756 
757 	/**
758 	 * Checks if the given taglist is empty.
759 	 *
760 	 * Returns: %TRUE if the taglist is empty, otherwise %FALSE.
761 	 */
762 	public bool isEmpty()
763 	{
764 		return gst_tag_list_is_empty(gstTagList) != 0;
765 	}
766 
767 	/**
768 	 * Checks if the two given taglists are equal.
769 	 *
770 	 * Params:
771 	 *     list2 = a #GstTagList.
772 	 *
773 	 * Returns: %TRUE if the taglists are equal, otherwise %FALSE
774 	 */
775 	public bool isEqual(TagList list2)
776 	{
777 		return gst_tag_list_is_equal(gstTagList, (list2 is null) ? null : list2.getTagListStruct()) != 0;
778 	}
779 
780 	/**
781 	 * Merges the two given lists into a new list. If one of the lists is %NULL, a
782 	 * copy of the other is returned. If both lists are %NULL, %NULL is returned.
783 	 *
784 	 * Free-function: gst_tag_list_unref
785 	 *
786 	 * Params:
787 	 *     list2 = second list to merge
788 	 *     mode = the mode to use
789 	 *
790 	 * Returns: the new list
791 	 */
792 	public TagList merge(TagList list2, GstTagMergeMode mode)
793 	{
794 		auto p = gst_tag_list_merge(gstTagList, (list2 is null) ? null : list2.getTagListStruct(), mode);
795 
796 		if(p is null)
797 		{
798 			return null;
799 		}
800 
801 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p, true);
802 	}
803 
804 	/**
805 	 * Get the number of tags in @list.
806 	 *
807 	 * Returns: The number of tags in @list.
808 	 */
809 	public int nTags()
810 	{
811 		return gst_tag_list_n_tags(gstTagList);
812 	}
813 
814 	/**
815 	 * Get the name of the tag in @list at @index.
816 	 *
817 	 * Params:
818 	 *     index = the index
819 	 *
820 	 * Returns: The name of the tag at @index.
821 	 */
822 	public string nthTagName(uint index)
823 	{
824 		return Str.toString(gst_tag_list_nth_tag_name(gstTagList, index));
825 	}
826 
827 	/**
828 	 * Peeks at the value that is at the given index for the given tag in the given
829 	 * list.
830 	 *
831 	 * The resulting string in @value will be in UTF-8 encoding and doesn't need
832 	 * to be freed by the caller. The returned string is also guaranteed to
833 	 * be non-%NULL and non-empty.
834 	 *
835 	 * Params:
836 	 *     tag = tag to read out
837 	 *     index = number of entry to read out
838 	 *     value = location for the result
839 	 *
840 	 * Returns: %TRUE, if a value was set, %FALSE if the tag didn't exist in the
841 	 *     given list.
842 	 */
843 	public bool peekStringIndex(string tag, uint index, out string value)
844 	{
845 		char* outvalue = null;
846 
847 		auto p = gst_tag_list_peek_string_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
848 
849 		value = Str.toString(outvalue);
850 
851 		return p;
852 	}
853 
854 	/**
855 	 * Removes the given tag from the taglist.
856 	 *
857 	 * Params:
858 	 *     tag = tag to remove
859 	 */
860 	public void removeTag(string tag)
861 	{
862 		gst_tag_list_remove_tag(gstTagList, Str.toStringz(tag));
863 	}
864 
865 	/**
866 	 * Sets the scope of @list to @scope. By default the scope
867 	 * of a taglist is stream scope.
868 	 *
869 	 * Params:
870 	 *     scop = new scope for @list
871 	 */
872 	public void setScope(GstTagScope scop)
873 	{
874 		gst_tag_list_set_scope(gstTagList, scop);
875 	}
876 
877 	/**
878 	 * Serializes a tag list to a string.
879 	 *
880 	 * Returns: a newly-allocated string, or %NULL in case of
881 	 *     an error. The string must be freed with g_free() when no longer
882 	 *     needed.
883 	 */
884 	public override string toString()
885 	{
886 		auto retStr = gst_tag_list_to_string(gstTagList);
887 
888 		scope(exit) Str.freeString(retStr);
889 		return Str.toString(retStr);
890 	}
891 
892 	/**
893 	 * Copies the contents for the given tag into the value,
894 	 * merging multiple values into one if multiple values are associated
895 	 * with the tag.
896 	 * You must g_value_unset() the value after use.
897 	 *
898 	 * Params:
899 	 *     dest = uninitialized #GValue to copy into
900 	 *     list = list to get the tag from
901 	 *     tag = tag to read out
902 	 *
903 	 * Returns: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
904 	 *     given list.
905 	 */
906 	public static bool copyValue(out Value dest, TagList list, string tag)
907 	{
908 		GValue* outdest = sliceNew!GValue();
909 
910 		auto p = gst_tag_list_copy_value(outdest, (list is null) ? null : list.getTagListStruct(), Str.toStringz(tag)) != 0;
911 
912 		dest = ObjectG.getDObject!(Value)(outdest, true);
913 
914 		return p;
915 	}
916 
917 	/**
918 	 * Checks if the given type is already registered.
919 	 *
920 	 * Params:
921 	 *     tag = name of the tag
922 	 *
923 	 * Returns: %TRUE if the type is already registered
924 	 */
925 	public static bool exists(string tag)
926 	{
927 		return gst_tag_exists(Str.toStringz(tag)) != 0;
928 	}
929 
930 	/**
931 	 * Returns the human-readable description of this tag, You must not change or
932 	 * free this string.
933 	 *
934 	 * Params:
935 	 *     tag = the tag
936 	 *
937 	 * Returns: the human-readable description of this tag
938 	 */
939 	public static string getDescription(string tag)
940 	{
941 		return Str.toString(gst_tag_get_description(Str.toStringz(tag)));
942 	}
943 
944 	/**
945 	 * Gets the flag of @tag.
946 	 *
947 	 * Params:
948 	 *     tag = the tag
949 	 *
950 	 * Returns: the flag of this tag.
951 	 */
952 	public static GstTagFlag getFlag(string tag)
953 	{
954 		return gst_tag_get_flag(Str.toStringz(tag));
955 	}
956 
957 	/**
958 	 * Returns the human-readable name of this tag, You must not change or free
959 	 * this string.
960 	 *
961 	 * Params:
962 	 *     tag = the tag
963 	 *
964 	 * Returns: the human-readable name of this tag
965 	 */
966 	public static string getNick(string tag)
967 	{
968 		return Str.toString(gst_tag_get_nick(Str.toStringz(tag)));
969 	}
970 
971 	/**
972 	 * Checks if the given tag is fixed. A fixed tag can only contain one value.
973 	 * Unfixed tags can contain lists of values.
974 	 *
975 	 * Params:
976 	 *     tag = tag to check
977 	 *
978 	 * Returns: %TRUE, if the given tag is fixed.
979 	 */
980 	public static bool isFixed(string tag)
981 	{
982 		return gst_tag_is_fixed(Str.toStringz(tag)) != 0;
983 	}
984 
985 	/**
986 	 * This is a convenience function for the func argument of gst_tag_register().
987 	 * It concatenates all given strings using a comma. The tag must be registered
988 	 * as a G_TYPE_STRING or this function will fail.
989 	 *
990 	 * Params:
991 	 *     dest = uninitialized GValue to store result in
992 	 *     src = GValue to copy from
993 	 */
994 	public static void mergeStringsWithComma(out Value dest, Value src)
995 	{
996 		GValue* outdest = sliceNew!GValue();
997 
998 		gst_tag_merge_strings_with_comma(outdest, (src is null) ? null : src.getValueStruct());
999 
1000 		dest = ObjectG.getDObject!(Value)(outdest, true);
1001 	}
1002 
1003 	/**
1004 	 * This is a convenience function for the func argument of gst_tag_register().
1005 	 * It creates a copy of the first value from the list.
1006 	 *
1007 	 * Params:
1008 	 *     dest = uninitialized GValue to store result in
1009 	 *     src = GValue to copy from
1010 	 */
1011 	public static void mergeUseFirst(out Value dest, Value src)
1012 	{
1013 		GValue* outdest = sliceNew!GValue();
1014 
1015 		gst_tag_merge_use_first(outdest, (src is null) ? null : src.getValueStruct());
1016 
1017 		dest = ObjectG.getDObject!(Value)(outdest, true);
1018 	}
1019 
1020 	/**
1021 	 * Registers a new tag type for the use with GStreamer's type system. If a type
1022 	 * with that name is already registered, that one is used.
1023 	 * The old registration may have used a different type however. So don't rely
1024 	 * on your supplied values.
1025 	 *
1026 	 * Important: if you do not supply a merge function the implication will be
1027 	 * that there can only be one single value for this tag in a tag list and
1028 	 * any additional values will silently be discarded when being added (unless
1029 	 * #GST_TAG_MERGE_REPLACE, #GST_TAG_MERGE_REPLACE_ALL, or
1030 	 * #GST_TAG_MERGE_PREPEND is used as merge mode, in which case the new
1031 	 * value will replace the old one in the list).
1032 	 *
1033 	 * The merge function will be called from gst_tag_list_copy_value() when
1034 	 * it is required that one or more values for a tag be condensed into
1035 	 * one single value. This may happen from gst_tag_list_get_string(),
1036 	 * gst_tag_list_get_int(), gst_tag_list_get_double() etc. What will happen
1037 	 * exactly in that case depends on how the tag was registered and if a
1038 	 * merge function was supplied and if so which one.
1039 	 *
1040 	 * Two default merge functions are provided: gst_tag_merge_use_first() and
1041 	 * gst_tag_merge_strings_with_comma().
1042 	 *
1043 	 * Params:
1044 	 *     name = the name or identifier string
1045 	 *     flag = a flag describing the type of tag info
1046 	 *     type = the type this data is in
1047 	 *     nick = human-readable name
1048 	 *     blurb = a human-readable description about this tag
1049 	 *     func = function for merging multiple values of this tag, or %NULL
1050 	 */
1051 	public static void register(string name, GstTagFlag flag, GType type, string nick, string blurb, GstTagMergeFunc func)
1052 	{
1053 		gst_tag_register(Str.toStringz(name), flag, type, Str.toStringz(nick), Str.toStringz(blurb), func);
1054 	}
1055 
1056 	/**
1057 	 * Registers a new tag type for the use with GStreamer's type system.
1058 	 *
1059 	 * Same as gst_tag_register(), but @name, @nick, and @blurb must be
1060 	 * static strings or inlined strings, as they will not be copied. (GStreamer
1061 	 * plugins will be made resident once loaded, so this function can be used
1062 	 * even from dynamically loaded plugins.)
1063 	 *
1064 	 * Params:
1065 	 *     name = the name or identifier string (string constant)
1066 	 *     flag = a flag describing the type of tag info
1067 	 *     type = the type this data is in
1068 	 *     nick = human-readable name or short description (string constant)
1069 	 *     blurb = a human-readable description for this tag (string constant)
1070 	 *     func = function for merging multiple values of this tag, or %NULL
1071 	 */
1072 	public static void registerStatic(string name, GstTagFlag flag, GType type, string nick, string blurb, GstTagMergeFunc func)
1073 	{
1074 		gst_tag_register_static(Str.toStringz(name), flag, type, Str.toStringz(nick), Str.toStringz(blurb), func);
1075 	}
1076 }