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