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