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