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