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