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 
49 	/** Get the main Gtk struct */
50 	public GstTagList* getTagListStruct()
51 	{
52 		return gstTagList;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected void* getStruct()
57 	{
58 		return cast(void*)gstTagList;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GstTagList* gstTagList)
65 	{
66 		this.gstTagList = gstTagList;
67 	}
68 
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 	public bool getInt64(string tag, long* value)
439 	{
440 		return gst_tag_list_get_int64(gstTagList, Str.toStringz(tag), value) != 0;
441 	}
442 
443 	/**
444 	 * Gets the value that is at the given index for the given tag in the given
445 	 * list.
446 	 *
447 	 * Params:
448 	 *     tag = tag to read out
449 	 *     index = number of entry to read out
450 	 *     value = location for the result
451 	 *
452 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
453 	 *     given list.
454 	 */
455 	public bool getInt64Index(string tag, uint index, out long value)
456 	{
457 		return gst_tag_list_get_int64_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
458 	}
459 
460 	/**
461 	 * Gets the value that is at the given index for the given tag in the given
462 	 * list.
463 	 *
464 	 * Params:
465 	 *     tag = tag to read out
466 	 *     index = number of entry to read out
467 	 *     value = location for the result
468 	 *
469 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
470 	 *     given list.
471 	 */
472 	public bool getIntIndex(string tag, uint index, out int value)
473 	{
474 		return gst_tag_list_get_int_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
475 	}
476 
477 	/**
478 	 * Copies the contents for the given tag into the value, merging multiple values
479 	 * into one if multiple values are associated with the tag.
480 	 *
481 	 * Params:
482 	 *     tag = tag to read out
483 	 *     value = location for the result
484 	 *
485 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
486 	 *     given list.
487 	 */
488 	public bool getPointer(string tag, out void* value)
489 	{
490 		return gst_tag_list_get_pointer(gstTagList, Str.toStringz(tag), &value) != 0;
491 	}
492 
493 	/**
494 	 * Gets the value that is at the given index for the given tag in the given
495 	 * list.
496 	 *
497 	 * Params:
498 	 *     tag = tag to read out
499 	 *     index = number of entry to read out
500 	 *     value = location for the result
501 	 *
502 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
503 	 *     given list.
504 	 */
505 	public bool getPointerIndex(string tag, uint index, out void* value)
506 	{
507 		return gst_tag_list_get_pointer_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
508 	}
509 
510 	/**
511 	 * Copies the first sample for the given tag in the taglist into the variable
512 	 * pointed to by @sample. Free the sample with gst_sample_unref() when it is
513 	 * no longer needed. You can retrieve the buffer from the sample using
514 	 * gst_sample_get_buffer() and the associated caps (if any) with
515 	 * gst_sample_get_caps().
516 	 *
517 	 * Free-function: gst_sample_unref
518 	 *
519 	 * Params:
520 	 *     tag = tag to read out
521 	 *     sample = address of a GstSample
522 	 *         pointer variable to store the result into
523 	 *
524 	 * Return: %TRUE, if a sample was returned, %FALSE if the tag didn't exist in
525 	 *     the given list or if it was %NULL.
526 	 */
527 	public bool getSample(string tag, out Sample sample)
528 	{
529 		GstSample* outsample = null;
530 		
531 		auto p = gst_tag_list_get_sample(gstTagList, Str.toStringz(tag), &outsample) != 0;
532 		
533 		sample = ObjectG.getDObject!(Sample)(outsample);
534 		
535 		return p;
536 	}
537 
538 	/**
539 	 * Gets the sample that is at the given index for the given tag in the given
540 	 * list and copies it into the variable pointed to by @sample. Free the sample
541 	 * with gst_sample_unref() when it is no longer needed. You can retrieve the
542 	 * buffer from the sample using gst_sample_get_buffer() and the associated
543 	 * caps (if any) with gst_sample_get_caps().
544 	 *
545 	 * Free-function: gst_sample_unref
546 	 *
547 	 * Params:
548 	 *     tag = tag to read out
549 	 *     index = number of entry to read out
550 	 *     sample = address of a GstSample
551 	 *         pointer variable to store the result into
552 	 *
553 	 * Return: %TRUE, if a sample was copied, %FALSE if the tag didn't exist in the
554 	 *     given list or if it was %NULL.
555 	 */
556 	public bool getSampleIndex(string tag, uint index, out Sample sample)
557 	{
558 		GstSample* outsample = null;
559 		
560 		auto p = gst_tag_list_get_sample_index(gstTagList, Str.toStringz(tag), index, &outsample) != 0;
561 		
562 		sample = ObjectG.getDObject!(Sample)(outsample);
563 		
564 		return p;
565 	}
566 
567 	/**
568 	 * Gets the scope of @list.
569 	 *
570 	 * Return: The scope of @list
571 	 */
572 	public GstTagScope getScope()
573 	{
574 		return gst_tag_list_get_scope(gstTagList);
575 	}
576 
577 	/**
578 	 * Copies the contents for the given tag into the value, possibly merging
579 	 * multiple values into one if multiple values are associated with the tag.
580 	 *
581 	 * Use gst_tag_list_get_string_index (list, tag, 0, value) if you want
582 	 * to retrieve the first string associated with this tag unmodified.
583 	 *
584 	 * The resulting string in @value will be in UTF-8 encoding and should be
585 	 * freed by the caller using g_free when no longer needed. The
586 	 * returned string is also guaranteed to be non-%NULL and non-empty.
587 	 *
588 	 * Free-function: g_free
589 	 *
590 	 * Params:
591 	 *     tag = tag to read out
592 	 *     value = location for the result
593 	 *
594 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
595 	 *     given list.
596 	 */
597 	public bool getString(string tag, out string value)
598 	{
599 		char* outvalue = null;
600 		
601 		auto p = gst_tag_list_get_string(gstTagList, Str.toStringz(tag), &outvalue) != 0;
602 		
603 		value = Str.toString(outvalue);
604 		
605 		return p;
606 	}
607 
608 	/**
609 	 * Gets the value that is at the given index for the given tag in the given
610 	 * list.
611 	 *
612 	 * The resulting string in @value will be in UTF-8 encoding and should be
613 	 * freed by the caller using g_free when no longer needed. The
614 	 * returned string is also guaranteed to be non-%NULL and non-empty.
615 	 *
616 	 * Free-function: g_free
617 	 *
618 	 * Params:
619 	 *     tag = tag to read out
620 	 *     index = number of entry to read out
621 	 *     value = location for the result
622 	 *
623 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
624 	 *     given list.
625 	 */
626 	public bool getStringIndex(string tag, uint index, out string value)
627 	{
628 		char* outvalue = null;
629 		
630 		auto p = gst_tag_list_get_string_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
631 		
632 		value = Str.toString(outvalue);
633 		
634 		return p;
635 	}
636 
637 	/**
638 	 * Checks how many value are stored in this tag list for the given tag.
639 	 *
640 	 * Params:
641 	 *     tag = the tag to query
642 	 *
643 	 * Return: The number of tags stored
644 	 */
645 	public uint getTagSize(string tag)
646 	{
647 		return gst_tag_list_get_tag_size(gstTagList, Str.toStringz(tag));
648 	}
649 
650 	/**
651 	 * Copies the contents for the given tag into the value, merging multiple values
652 	 * into one if multiple values are associated with the tag.
653 	 *
654 	 * Params:
655 	 *     tag = tag to read out
656 	 *     value = location for the result
657 	 *
658 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
659 	 *     given list.
660 	 */
661 	public bool getUint(string tag, out uint value)
662 	{
663 		return gst_tag_list_get_uint(gstTagList, Str.toStringz(tag), &value) != 0;
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 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
675 	 *     given list.
676 	 */
677 	public bool getUint64(string tag, out ulong value)
678 	{
679 		return gst_tag_list_get_uint64(gstTagList, Str.toStringz(tag), &value) != 0;
680 	}
681 
682 	/**
683 	 * Gets the value that is at the given index for the given tag in the given
684 	 * list.
685 	 *
686 	 * Params:
687 	 *     tag = tag to read out
688 	 *     index = number of entry to read out
689 	 *     value = location for the result
690 	 *
691 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
692 	 *     given list.
693 	 */
694 	public bool getUint64Index(string tag, uint index, out ulong value)
695 	{
696 		return gst_tag_list_get_uint64_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
697 	}
698 
699 	/**
700 	 * Gets the value that is at the given index for the given tag in the given
701 	 * list.
702 	 *
703 	 * Params:
704 	 *     tag = tag to read out
705 	 *     index = number of entry to read out
706 	 *     value = location for the result
707 	 *
708 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
709 	 *     given list.
710 	 */
711 	public bool getUintIndex(string tag, uint index, out uint value)
712 	{
713 		return gst_tag_list_get_uint_index(gstTagList, Str.toStringz(tag), index, &value) != 0;
714 	}
715 
716 	/**
717 	 * Gets the value that is at the given index for the given tag in the given
718 	 * list.
719 	 *
720 	 * Params:
721 	 *     tag = tag to read out
722 	 *     index = number of entry to read out
723 	 *
724 	 * Return: The GValue for the specified
725 	 *     entry or %NULL if the tag wasn't available or the tag
726 	 *     doesn't have as many entries
727 	 */
728 	public Value getValueIndex(string tag, uint index)
729 	{
730 		auto p = gst_tag_list_get_value_index(gstTagList, Str.toStringz(tag), index);
731 		
732 		if(p is null)
733 		{
734 			return null;
735 		}
736 		
737 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
738 	}
739 
740 	/**
741 	 * Inserts the tags of the @from list into the first list using the given mode.
742 	 *
743 	 * Params:
744 	 *     from = list to merge from
745 	 *     mode = the mode to use
746 	 */
747 	public void insert(TagList from, GstTagMergeMode mode)
748 	{
749 		gst_tag_list_insert(gstTagList, (from is null) ? null : from.getTagListStruct(), mode);
750 	}
751 
752 	/**
753 	 * Checks if the given taglist is empty.
754 	 *
755 	 * Return: %TRUE if the taglist is empty, otherwise %FALSE.
756 	 */
757 	public bool isEmpty()
758 	{
759 		return gst_tag_list_is_empty(gstTagList) != 0;
760 	}
761 
762 	/**
763 	 * Checks if the two given taglists are equal.
764 	 *
765 	 * Params:
766 	 *     list2 = a #GstTagList.
767 	 *
768 	 * Return: %TRUE if the taglists are equal, otherwise %FALSE
769 	 */
770 	public bool isEqual(TagList list2)
771 	{
772 		return gst_tag_list_is_equal(gstTagList, (list2 is null) ? null : list2.getTagListStruct()) != 0;
773 	}
774 
775 	/**
776 	 * Merges the two given lists into a new list. If one of the lists is %NULL, a
777 	 * copy of the other is returned. If both lists are %NULL, %NULL is returned.
778 	 *
779 	 * Free-function: gst_tag_list_unref
780 	 *
781 	 * Params:
782 	 *     list2 = second list to merge
783 	 *     mode = the mode to use
784 	 *
785 	 * Return: the new list
786 	 */
787 	public TagList merge(TagList list2, GstTagMergeMode mode)
788 	{
789 		auto p = gst_tag_list_merge(gstTagList, (list2 is null) ? null : list2.getTagListStruct(), mode);
790 		
791 		if(p is null)
792 		{
793 			return null;
794 		}
795 		
796 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p);
797 	}
798 
799 	/**
800 	 * Get the number of tags in @list.
801 	 *
802 	 * Return: The number of tags in @list.
803 	 */
804 	public int nTags()
805 	{
806 		return gst_tag_list_n_tags(gstTagList);
807 	}
808 
809 	/**
810 	 * Get the name of the tag in @list at @index.
811 	 *
812 	 * Params:
813 	 *     index = the index
814 	 *
815 	 * Return: The name of the tag at @index.
816 	 */
817 	public string nthTagName(uint index)
818 	{
819 		return Str.toString(gst_tag_list_nth_tag_name(gstTagList, index));
820 	}
821 
822 	/**
823 	 * Peeks at the value that is at the given index for the given tag in the given
824 	 * list.
825 	 *
826 	 * The resulting string in @value will be in UTF-8 encoding and doesn't need
827 	 * to be freed by the caller. The returned string is also guaranteed to
828 	 * be non-%NULL and non-empty.
829 	 *
830 	 * Params:
831 	 *     tag = tag to read out
832 	 *     index = number of entry to read out
833 	 *     value = location for the result
834 	 *
835 	 * Return: %TRUE, if a value was set, %FALSE if the tag didn't exist in the
836 	 *     given list.
837 	 */
838 	public bool peekStringIndex(string tag, uint index, out string value)
839 	{
840 		char* outvalue = null;
841 		
842 		auto p = gst_tag_list_peek_string_index(gstTagList, Str.toStringz(tag), index, &outvalue) != 0;
843 		
844 		value = Str.toString(outvalue);
845 		
846 		return p;
847 	}
848 
849 	/**
850 	 * Removes the given tag from the taglist.
851 	 *
852 	 * Params:
853 	 *     tag = tag to remove
854 	 */
855 	public void removeTag(string tag)
856 	{
857 		gst_tag_list_remove_tag(gstTagList, Str.toStringz(tag));
858 	}
859 
860 	/**
861 	 * Sets the scope of @list to @scope. By default the scope
862 	 * of a taglist is stream scope.
863 	 *
864 	 * Params:
865 	 *     scop = new scope for @list
866 	 */
867 	public void setScope(GstTagScope scop)
868 	{
869 		gst_tag_list_set_scope(gstTagList, scop);
870 	}
871 
872 	/**
873 	 * Serializes a tag list to a string.
874 	 *
875 	 * Return: a newly-allocated string, or %NULL in case of
876 	 *     an error. The string must be freed with g_free() when no longer
877 	 *     needed.
878 	 */
879 	public override string toString()
880 	{
881 		return Str.toString(gst_tag_list_to_string(gstTagList));
882 	}
883 
884 	/**
885 	 * Copies the contents for the given tag into the value,
886 	 * merging multiple values into one if multiple values are associated
887 	 * with the tag.
888 	 * You must g_value_unset() the value after use.
889 	 *
890 	 * Params:
891 	 *     dest = uninitialized #GValue to copy into
892 	 *     list = list to get the tag from
893 	 *     tag = tag to read out
894 	 *
895 	 * Return: %TRUE, if a value was copied, %FALSE if the tag didn't exist in the
896 	 *     given list.
897 	 */
898 	public static bool copyValue(out Value dest, TagList list, string tag)
899 	{
900 		GValue* outdest = new GValue;
901 		
902 		auto p = gst_tag_list_copy_value(outdest, (list is null) ? null : list.getTagListStruct(), Str.toStringz(tag)) != 0;
903 		
904 		dest = ObjectG.getDObject!(Value)(outdest);
905 		
906 		return p;
907 	}
908 
909 	/**
910 	 * Checks if the given type is already registered.
911 	 *
912 	 * Params:
913 	 *     tag = name of the tag
914 	 *
915 	 * Return: %TRUE if the type is already registered
916 	 */
917 	public static bool exists(string tag)
918 	{
919 		return gst_tag_exists(Str.toStringz(tag)) != 0;
920 	}
921 
922 	/**
923 	 * Returns the human-readable description of this tag, You must not change or
924 	 * free this string.
925 	 *
926 	 * Params:
927 	 *     tag = the tag
928 	 *
929 	 * Return: the human-readable description of this tag
930 	 */
931 	public static string getDescription(string tag)
932 	{
933 		return Str.toString(gst_tag_get_description(Str.toStringz(tag)));
934 	}
935 
936 	/**
937 	 * Gets the flag of @tag.
938 	 *
939 	 * Params:
940 	 *     tag = the tag
941 	 *
942 	 * Return: the flag of this tag.
943 	 */
944 	public static GstTagFlag getFlag(string tag)
945 	{
946 		return gst_tag_get_flag(Str.toStringz(tag));
947 	}
948 
949 	/**
950 	 * Returns the human-readable name of this tag, You must not change or free
951 	 * this string.
952 	 *
953 	 * Params:
954 	 *     tag = the tag
955 	 *
956 	 * Return: the human-readable name of this tag
957 	 */
958 	public static string getNick(string tag)
959 	{
960 		return Str.toString(gst_tag_get_nick(Str.toStringz(tag)));
961 	}
962 
963 	/**
964 	 * Checks if the given tag is fixed. A fixed tag can only contain one value.
965 	 * Unfixed tags can contain lists of values.
966 	 *
967 	 * Params:
968 	 *     tag = tag to check
969 	 *
970 	 * Return: %TRUE, if the given tag is fixed.
971 	 */
972 	public static bool isFixed(string tag)
973 	{
974 		return gst_tag_is_fixed(Str.toStringz(tag)) != 0;
975 	}
976 
977 	/**
978 	 * This is a convenience function for the func argument of gst_tag_register().
979 	 * It concatenates all given strings using a comma. The tag must be registered
980 	 * as a G_TYPE_STRING or this function will fail.
981 	 *
982 	 * Params:
983 	 *     dest = uninitialized GValue to store result in
984 	 *     src = GValue to copy from
985 	 */
986 	public static void mergeStringsWithComma(out Value dest, Value src)
987 	{
988 		GValue* outdest = new GValue;
989 		
990 		gst_tag_merge_strings_with_comma(outdest, (src is null) ? null : src.getValueStruct());
991 		
992 		dest = ObjectG.getDObject!(Value)(outdest);
993 	}
994 
995 	/**
996 	 * This is a convenience function for the func argument of gst_tag_register().
997 	 * It creates a copy of the first value from the list.
998 	 *
999 	 * Params:
1000 	 *     dest = uninitialized GValue to store result in
1001 	 *     src = GValue to copy from
1002 	 */
1003 	public static void mergeUseFirst(out Value dest, Value src)
1004 	{
1005 		GValue* outdest = new GValue;
1006 		
1007 		gst_tag_merge_use_first(outdest, (src is null) ? null : src.getValueStruct());
1008 		
1009 		dest = ObjectG.getDObject!(Value)(outdest);
1010 	}
1011 
1012 	/**
1013 	 * Registers a new tag type for the use with GStreamer's type system. If a type
1014 	 * with that name is already registered, that one is used.
1015 	 * The old registration may have used a different type however. So don't rely
1016 	 * on your supplied values.
1017 	 *
1018 	 * Important: if you do not supply a merge function the implication will be
1019 	 * that there can only be one single value for this tag in a tag list and
1020 	 * any additional values will silently be discarded when being added (unless
1021 	 * #GST_TAG_MERGE_REPLACE, #GST_TAG_MERGE_REPLACE_ALL, or
1022 	 * #GST_TAG_MERGE_PREPEND is used as merge mode, in which case the new
1023 	 * value will replace the old one in the list).
1024 	 *
1025 	 * The merge function will be called from gst_tag_list_copy_value() when
1026 	 * it is required that one or more values for a tag be condensed into
1027 	 * one single value. This may happen from gst_tag_list_get_string(),
1028 	 * gst_tag_list_get_int(), gst_tag_list_get_double() etc. What will happen
1029 	 * exactly in that case depends on how the tag was registered and if a
1030 	 * merge function was supplied and if so which one.
1031 	 *
1032 	 * Two default merge functions are provided: gst_tag_merge_use_first() and
1033 	 * gst_tag_merge_strings_with_comma().
1034 	 *
1035 	 * Params:
1036 	 *     name = the name or identifier string
1037 	 *     flag = a flag describing the type of tag info
1038 	 *     type = the type this data is in
1039 	 *     nick = human-readable name
1040 	 *     blurb = a human-readable description about this tag
1041 	 *     func = function for merging multiple values of this tag, or %NULL
1042 	 */
1043 	public static void register(string name, GstTagFlag flag, GType type, string nick, string blurb, GstTagMergeFunc func)
1044 	{
1045 		gst_tag_register(Str.toStringz(name), flag, type, Str.toStringz(nick), Str.toStringz(blurb), func);
1046 	}
1047 
1048 	/**
1049 	 * Registers a new tag type for the use with GStreamer's type system.
1050 	 *
1051 	 * Same as gst_tag_register(), but @name, @nick, and @blurb must be
1052 	 * static strings or inlined strings, as they will not be copied. (GStreamer
1053 	 * plugins will be made resident once loaded, so this function can be used
1054 	 * even from dynamically loaded plugins.)
1055 	 *
1056 	 * Params:
1057 	 *     name = the name or identifier string (string constant)
1058 	 *     flag = a flag describing the type of tag info
1059 	 *     type = the type this data is in
1060 	 *     nick = human-readable name or short description (string constant)
1061 	 *     blurb = a human-readable description for this tag (string constant)
1062 	 *     func = function for merging multiple values of this tag, or %NULL
1063 	 */
1064 	public static void registerStatic(string name, GstTagFlag flag, GType type, string nick, string blurb, GstTagMergeFunc func)
1065 	{
1066 		gst_tag_register_static(Str.toStringz(name), flag, type, Str.toStringz(nick), Str.toStringz(blurb), func);
1067 	}
1068 }