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