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