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.ValueGst; 26 27 private import glib.Str; 28 private import gobject.ObjectG; 29 private import gobject.Value; 30 private import gstreamer.Caps; 31 private import gstreamer.CapsFeatures; 32 private import gstreamer.Structure; 33 private import gstreamerc.gstreamer; 34 public import gstreamerc.gstreamertypes; 35 36 37 public struct ValueGst 38 { 39 /** 40 */ 41 42 /** 43 * Determines if @value1 and @value2 can be compared. 44 * 45 * Params: 46 * value1 = a value to compare 47 * value2 = another value to compare 48 * 49 * Return: %TRUE if the values can be compared 50 */ 51 public static bool canCompare(Value value1, Value value2) 52 { 53 return gst_value_can_compare((value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0; 54 } 55 56 /** 57 * Determines if intersecting two values will produce a valid result. 58 * Two values will produce a valid intersection if they have the same 59 * type. 60 * 61 * Params: 62 * value1 = a value to intersect 63 * value2 = another value to intersect 64 * 65 * Return: %TRUE if the values can intersect 66 */ 67 public static bool canIntersect(Value value1, Value value2) 68 { 69 return gst_value_can_intersect((value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0; 70 } 71 72 /** 73 * Checks if it's possible to subtract @subtrahend from @minuend. 74 * 75 * Params: 76 * minuend = the value to subtract from 77 * subtrahend = the value to subtract 78 * 79 * Return: %TRUE if a subtraction is possible 80 */ 81 public static bool canSubtract(Value minuend, Value subtrahend) 82 { 83 return gst_value_can_subtract((minuend is null) ? null : minuend.getValueStruct(), (subtrahend is null) ? null : subtrahend.getValueStruct()) != 0; 84 } 85 86 /** 87 * Determines if @value1 and @value2 can be non-trivially unioned. 88 * Any two values can be trivially unioned by adding both of them 89 * to a GstValueList. However, certain types have the possibility 90 * to be unioned in a simpler way. For example, an integer range 91 * and an integer can be unioned if the integer is a subset of the 92 * integer range. If there is the possibility that two values can 93 * be unioned, this function returns %TRUE. 94 * 95 * Params: 96 * value1 = a value to union 97 * value2 = another value to union 98 * 99 * Return: %TRUE if there is a function allowing the two values to 100 * be unioned. 101 */ 102 public static bool canUnion(Value value1, Value value2) 103 { 104 return gst_value_can_union((value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0; 105 } 106 107 /** 108 * Compares @value1 and @value2. If @value1 and @value2 cannot be 109 * compared, the function returns GST_VALUE_UNORDERED. Otherwise, 110 * if @value1 is greater than @value2, GST_VALUE_GREATER_THAN is returned. 111 * If @value1 is less than @value2, GST_VALUE_LESS_THAN is returned. 112 * If the values are equal, GST_VALUE_EQUAL is returned. 113 * 114 * Params: 115 * value1 = a value to compare 116 * value2 = another value to compare 117 * 118 * Return: comparison result 119 */ 120 public static int compare(Value value1, Value value2) 121 { 122 return gst_value_compare((value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()); 123 } 124 125 /** 126 * Tries to deserialize a string into the type specified by the given GValue. 127 * If the operation succeeds, %TRUE is returned, %FALSE otherwise. 128 * 129 * Params: 130 * dest = #GValue to fill with contents of 131 * deserialization 132 * src = string to deserialize 133 * 134 * Return: %TRUE on success 135 */ 136 public static bool deserialize(out Value dest, string src) 137 { 138 GValue* outdest = new GValue; 139 140 auto p = gst_value_deserialize(outdest, Str.toStringz(src)) != 0; 141 142 dest = ObjectG.getDObject!(Value)(outdest); 143 144 return p; 145 } 146 147 /** 148 * Fixate @src into a new value @dest. 149 * For ranges, the first element is taken. For lists and arrays, the 150 * first item is fixated and returned. 151 * If @src is already fixed, this function returns %FALSE. 152 * 153 * Params: 154 * dest = the #GValue destination 155 * src = the #GValue to fixate 156 * 157 * Return: %TRUE if @dest contains a fixated version of @src. 158 */ 159 public static bool fixate(Value dest, Value src) 160 { 161 return gst_value_fixate((dest is null) ? null : dest.getValueStruct(), (src is null) ? null : src.getValueStruct()) != 0; 162 } 163 164 /** 165 * Multiplies the two #GValue items containing a #GST_TYPE_FRACTION and sets 166 * @product to the product of the two fractions. 167 * 168 * Params: 169 * product = a GValue initialized to #GST_TYPE_FRACTION 170 * factor1 = a GValue initialized to #GST_TYPE_FRACTION 171 * factor2 = a GValue initialized to #GST_TYPE_FRACTION 172 * 173 * Return: %FALSE in case of an error (like integer overflow), %TRUE otherwise. 174 */ 175 public static bool fractionMultiply(Value product, Value factor1, Value factor2) 176 { 177 return gst_value_fraction_multiply((product is null) ? null : product.getValueStruct(), (factor1 is null) ? null : factor1.getValueStruct(), (factor2 is null) ? null : factor2.getValueStruct()) != 0; 178 } 179 180 /** 181 * Subtracts the @subtrahend from the @minuend and sets @dest to the result. 182 * 183 * Params: 184 * dest = a GValue initialized to #GST_TYPE_FRACTION 185 * minuend = a GValue initialized to #GST_TYPE_FRACTION 186 * subtrahend = a GValue initialized to #GST_TYPE_FRACTION 187 * 188 * Return: %FALSE in case of an error (like integer overflow), %TRUE otherwise. 189 */ 190 public static bool fractionSubtract(Value dest, Value minuend, Value subtrahend) 191 { 192 return gst_value_fraction_subtract((dest is null) ? null : dest.getValueStruct(), (minuend is null) ? null : minuend.getValueStruct(), (subtrahend is null) ? null : subtrahend.getValueStruct()) != 0; 193 } 194 195 /** 196 * Gets the bitmask specified by @value. 197 * 198 * Params: 199 * value = a GValue initialized to #GST_TYPE_BITMASK 200 * 201 * Return: the bitmask. 202 */ 203 public static ulong getBitmask(Value value) 204 { 205 return gst_value_get_bitmask((value is null) ? null : value.getValueStruct()); 206 } 207 208 /** 209 * Gets the contents of @value. The reference count of the returned 210 * #GstCaps will not be modified, therefore the caller must take one 211 * before getting rid of the @value. 212 * 213 * Params: 214 * value = a GValue initialized to GST_TYPE_CAPS 215 * 216 * Return: the contents of @value 217 */ 218 public static Caps getCaps(Value value) 219 { 220 auto p = gst_value_get_caps((value is null) ? null : value.getValueStruct()); 221 222 if(p is null) 223 { 224 return null; 225 } 226 227 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 228 } 229 230 /** 231 * Gets the contents of @value. 232 * 233 * Params: 234 * value = a GValue initialized to GST_TYPE_CAPS_FEATURES 235 * 236 * Return: the contents of @value 237 */ 238 public static CapsFeatures getCapsFeatures(Value value) 239 { 240 auto p = gst_value_get_caps_features((value is null) ? null : value.getValueStruct()); 241 242 if(p is null) 243 { 244 return null; 245 } 246 247 return ObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) p); 248 } 249 250 /** 251 * Gets the maximum of the range specified by @value. 252 * 253 * Params: 254 * value = a GValue initialized to GST_TYPE_DOUBLE_RANGE 255 * 256 * Return: the maximum of the range 257 */ 258 public static double getDoubleRangeMax(Value value) 259 { 260 return gst_value_get_double_range_max((value is null) ? null : value.getValueStruct()); 261 } 262 263 /** 264 * Gets the minimum of the range specified by @value. 265 * 266 * Params: 267 * value = a GValue initialized to GST_TYPE_DOUBLE_RANGE 268 * 269 * Return: the minimum of the range 270 */ 271 public static double getDoubleRangeMin(Value value) 272 { 273 return gst_value_get_double_range_min((value is null) ? null : value.getValueStruct()); 274 } 275 276 /** 277 * Gets the denominator of the fraction specified by @value. 278 * 279 * Params: 280 * value = a GValue initialized to #GST_TYPE_FRACTION 281 * 282 * Return: the denominator of the fraction. 283 */ 284 public static int getFractionDenominator(Value value) 285 { 286 return gst_value_get_fraction_denominator((value is null) ? null : value.getValueStruct()); 287 } 288 289 /** 290 * Gets the numerator of the fraction specified by @value. 291 * 292 * Params: 293 * value = a GValue initialized to #GST_TYPE_FRACTION 294 * 295 * Return: the numerator of the fraction. 296 */ 297 public static int getFractionNumerator(Value value) 298 { 299 return gst_value_get_fraction_numerator((value is null) ? null : value.getValueStruct()); 300 } 301 302 /** 303 * Gets the maximum of the range specified by @value. 304 * 305 * Params: 306 * value = a GValue initialized to GST_TYPE_FRACTION_RANGE 307 * 308 * Return: the maximum of the range 309 */ 310 public static Value getFractionRangeMax(Value value) 311 { 312 auto p = gst_value_get_fraction_range_max((value is null) ? null : value.getValueStruct()); 313 314 if(p is null) 315 { 316 return null; 317 } 318 319 return ObjectG.getDObject!(Value)(cast(GValue*) p); 320 } 321 322 /** 323 * Gets the minimum of the range specified by @value. 324 * 325 * Params: 326 * value = a GValue initialized to GST_TYPE_FRACTION_RANGE 327 * 328 * Return: the minimum of the range 329 */ 330 public static Value getFractionRangeMin(Value value) 331 { 332 auto p = gst_value_get_fraction_range_min((value is null) ? null : value.getValueStruct()); 333 334 if(p is null) 335 { 336 return null; 337 } 338 339 return ObjectG.getDObject!(Value)(cast(GValue*) p); 340 } 341 342 /** 343 * Gets the maximum of the range specified by @value. 344 * 345 * Params: 346 * value = a GValue initialized to GST_TYPE_INT64_RANGE 347 * 348 * Return: the maximum of the range 349 */ 350 public static long getInt64RangeMax(Value value) 351 { 352 return gst_value_get_int64_range_max((value is null) ? null : value.getValueStruct()); 353 } 354 355 /** 356 * Gets the minimum of the range specified by @value. 357 * 358 * Params: 359 * value = a GValue initialized to GST_TYPE_INT64_RANGE 360 * 361 * Return: the minimum of the range 362 */ 363 public static long getInt64RangeMin(Value value) 364 { 365 return gst_value_get_int64_range_min((value is null) ? null : value.getValueStruct()); 366 } 367 368 /** 369 * Gets the step of the range specified by @value. 370 * 371 * Params: 372 * value = a GValue initialized to GST_TYPE_INT64_RANGE 373 * 374 * Return: the step of the range 375 */ 376 public static long getInt64RangeStep(Value value) 377 { 378 return gst_value_get_int64_range_step((value is null) ? null : value.getValueStruct()); 379 } 380 381 /** 382 * Gets the maximum of the range specified by @value. 383 * 384 * Params: 385 * value = a GValue initialized to GST_TYPE_INT_RANGE 386 * 387 * Return: the maximum of the range 388 */ 389 public static int getIntRangeMax(Value value) 390 { 391 return gst_value_get_int_range_max((value is null) ? null : value.getValueStruct()); 392 } 393 394 /** 395 * Gets the minimum of the range specified by @value. 396 * 397 * Params: 398 * value = a GValue initialized to GST_TYPE_INT_RANGE 399 * 400 * Return: the minimum of the range 401 */ 402 public static int getIntRangeMin(Value value) 403 { 404 return gst_value_get_int_range_min((value is null) ? null : value.getValueStruct()); 405 } 406 407 /** 408 * Gets the step of the range specified by @value. 409 * 410 * Params: 411 * value = a GValue initialized to GST_TYPE_INT_RANGE 412 * 413 * Return: the step of the range 414 */ 415 public static int getIntRangeStep(Value value) 416 { 417 return gst_value_get_int_range_step((value is null) ? null : value.getValueStruct()); 418 } 419 420 /** 421 * Gets the contents of @value. 422 * 423 * Params: 424 * value = a GValue initialized to GST_TYPE_STRUCTURE 425 * 426 * Return: the contents of @value 427 */ 428 public static Structure getStructure(Value value) 429 { 430 auto p = gst_value_get_structure((value is null) ? null : value.getValueStruct()); 431 432 if(p is null) 433 { 434 return null; 435 } 436 437 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 438 } 439 440 /** 441 * Initialises the target value to be of the same type as source and then copies 442 * the contents from source to target. 443 * 444 * Params: 445 * dest = the target value 446 * src = the source value 447 */ 448 public static void initAndCopy(out Value dest, Value src) 449 { 450 GValue* outdest = new GValue; 451 452 gst_value_init_and_copy(outdest, (src is null) ? null : src.getValueStruct()); 453 454 dest = ObjectG.getDObject!(Value)(outdest); 455 } 456 457 /** 458 * Calculates the intersection of two values. If the values have 459 * a non-empty intersection, the value representing the intersection 460 * is placed in @dest, unless %NULL. If the intersection is non-empty, 461 * @dest is not modified. 462 * 463 * Params: 464 * dest = a uninitialized #GValue that will hold the calculated 465 * intersection value. May be %NULL if the resulting set if not 466 * needed. 467 * value1 = a value to intersect 468 * value2 = another value to intersect 469 * 470 * Return: %TRUE if the intersection is non-empty 471 */ 472 public static bool intersect(out Value dest, Value value1, Value value2) 473 { 474 GValue* outdest = new GValue; 475 476 auto p = gst_value_intersect(outdest, (value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0; 477 478 dest = ObjectG.getDObject!(Value)(outdest); 479 480 return p; 481 } 482 483 /** 484 * Tests if the given GValue, if available in a GstStructure (or any other 485 * container) contains a "fixed" (which means: one value) or an "unfixed" 486 * (which means: multiple possible values, such as data lists or data 487 * ranges) value. 488 * 489 * Params: 490 * value = the #GValue to check 491 * 492 * Return: true if the value is "fixed". 493 */ 494 public static bool isFixed(Value value) 495 { 496 return gst_value_is_fixed((value is null) ? null : value.getValueStruct()) != 0; 497 } 498 499 /** 500 * Check that @value1 is a subset of @value2. 501 * 502 * Params: 503 * value1 = a #GValue 504 * value2 = a #GValue 505 * 506 * Return: %TRUE is @value1 is a subset of @value2 507 */ 508 public static bool isSubset(Value value1, Value value2) 509 { 510 return gst_value_is_subset((value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0; 511 } 512 513 /** 514 * Registers functions to perform calculations on #GValue items of a given 515 * type. Each type can only be added once. 516 * 517 * Params: 518 * table = structure containing functions to register 519 */ 520 public static void register(GstValueTable* table) 521 { 522 gst_value_register(table); 523 } 524 525 /** 526 * tries to transform the given @value into a string representation that allows 527 * getting back this string later on using gst_value_deserialize(). 528 * 529 * Free-function: g_free 530 * 531 * Params: 532 * value = a #GValue to serialize 533 * 534 * Return: the serialization for @value 535 * or %NULL if none exists 536 */ 537 public static string serialize(Value value) 538 { 539 return Str.toString(gst_value_serialize((value is null) ? null : value.getValueStruct())); 540 } 541 542 /** 543 * Sets @value to the bitmask specified by @bitmask. 544 * 545 * Params: 546 * value = a GValue initialized to #GST_TYPE_BITMASK 547 * bitmask = the bitmask 548 */ 549 public static void setBitmask(Value value, ulong bitmask) 550 { 551 gst_value_set_bitmask((value is null) ? null : value.getValueStruct(), bitmask); 552 } 553 554 /** 555 * Sets the contents of @value to @caps. A reference to the 556 * provided @caps will be taken by the @value. 557 * 558 * Params: 559 * value = a GValue initialized to GST_TYPE_CAPS 560 * caps = the caps to set the value to 561 */ 562 public static void setCaps(Value value, Caps caps) 563 { 564 gst_value_set_caps((value is null) ? null : value.getValueStruct(), (caps is null) ? null : caps.getCapsStruct()); 565 } 566 567 /** 568 * Sets the contents of @value to @features. 569 * 570 * Params: 571 * value = a GValue initialized to GST_TYPE_CAPS_FEATURES 572 * features = the features to set the value to 573 */ 574 public static void setCapsFeatures(Value value, CapsFeatures features) 575 { 576 gst_value_set_caps_features((value is null) ? null : value.getValueStruct(), (features is null) ? null : features.getCapsFeaturesStruct()); 577 } 578 579 /** 580 * Sets @value to the range specified by @start and @end. 581 * 582 * Params: 583 * value = a GValue initialized to GST_TYPE_DOUBLE_RANGE 584 * start = the start of the range 585 * end = the end of the range 586 */ 587 public static void setDoubleRange(Value value, double start, double end) 588 { 589 gst_value_set_double_range((value is null) ? null : value.getValueStruct(), start, end); 590 } 591 592 /** 593 * Sets @value to the fraction specified by @numerator over @denominator. 594 * The fraction gets reduced to the smallest numerator and denominator, 595 * and if necessary the sign is moved to the numerator. 596 * 597 * Params: 598 * value = a GValue initialized to #GST_TYPE_FRACTION 599 * numerator = the numerator of the fraction 600 * denominator = the denominator of the fraction 601 */ 602 public static void setFraction(Value value, int numerator, int denominator) 603 { 604 gst_value_set_fraction((value is null) ? null : value.getValueStruct(), numerator, denominator); 605 } 606 607 /** 608 * Sets @value to the range specified by @start and @end. 609 * 610 * Params: 611 * value = a GValue initialized to GST_TYPE_FRACTION_RANGE 612 * start = the start of the range (a GST_TYPE_FRACTION GValue) 613 * end = the end of the range (a GST_TYPE_FRACTION GValue) 614 */ 615 public static void setFractionRange(Value value, Value start, Value end) 616 { 617 gst_value_set_fraction_range((value is null) ? null : value.getValueStruct(), (start is null) ? null : start.getValueStruct(), (end is null) ? null : end.getValueStruct()); 618 } 619 620 /** 621 * Sets @value to the range specified by @numerator_start/@denominator_start 622 * and @numerator_end/@denominator_end. 623 * 624 * Params: 625 * value = a GValue initialized to GST_TYPE_FRACTION_RANGE 626 * numeratorStart = the numerator start of the range 627 * denominatorStart = the denominator start of the range 628 * numeratorEnd = the numerator end of the range 629 * denominatorEnd = the denominator end of the range 630 */ 631 public static void setFractionRangeFull(Value value, int numeratorStart, int denominatorStart, int numeratorEnd, int denominatorEnd) 632 { 633 gst_value_set_fraction_range_full((value is null) ? null : value.getValueStruct(), numeratorStart, denominatorStart, numeratorEnd, denominatorEnd); 634 } 635 636 /** 637 * Sets @value to the range specified by @start and @end. 638 * 639 * Params: 640 * value = a GValue initialized to GST_TYPE_INT64_RANGE 641 * start = the start of the range 642 * end = the end of the range 643 */ 644 public static void setInt64Range(Value value, long start, long end) 645 { 646 gst_value_set_int64_range((value is null) ? null : value.getValueStruct(), start, end); 647 } 648 649 /** 650 * Sets @value to the range specified by @start, @end and @step. 651 * 652 * Params: 653 * value = a GValue initialized to GST_TYPE_INT64_RANGE 654 * start = the start of the range 655 * end = the end of the range 656 * step = the step of the range 657 */ 658 public static void setInt64RangeStep(Value value, long start, long end, long step) 659 { 660 gst_value_set_int64_range_step((value is null) ? null : value.getValueStruct(), start, end, step); 661 } 662 663 /** 664 * Sets @value to the range specified by @start and @end. 665 * 666 * Params: 667 * value = a GValue initialized to GST_TYPE_INT_RANGE 668 * start = the start of the range 669 * end = the end of the range 670 */ 671 public static void setIntRange(Value value, int start, int end) 672 { 673 gst_value_set_int_range((value is null) ? null : value.getValueStruct(), start, end); 674 } 675 676 /** 677 * Sets @value to the range specified by @start, @end and @step. 678 * 679 * Params: 680 * value = a GValue initialized to GST_TYPE_INT_RANGE 681 * start = the start of the range 682 * end = the end of the range 683 * step = the step of the range 684 */ 685 public static void setIntRangeStep(Value value, int start, int end, int step) 686 { 687 gst_value_set_int_range_step((value is null) ? null : value.getValueStruct(), start, end, step); 688 } 689 690 /** 691 * Sets the contents of @value to @structure. The actual 692 * 693 * Params: 694 * value = a GValue initialized to GST_TYPE_STRUCTURE 695 * structure = the structure to set the value to 696 */ 697 public static void setStructure(Value value, Structure structure) 698 { 699 gst_value_set_structure((value is null) ? null : value.getValueStruct(), (structure is null) ? null : structure.getStructureStruct()); 700 } 701 702 /** 703 * Subtracts @subtrahend from @minuend and stores the result in @dest. 704 * Note that this means subtraction as in sets, not as in mathematics. 705 * 706 * Params: 707 * dest = the destination value 708 * for the result if the subtraction is not empty. May be %NULL, 709 * in which case the resulting set will not be computed, which can 710 * give a fair speedup. 711 * minuend = the value to subtract from 712 * subtrahend = the value to subtract 713 * 714 * Return: %TRUE if the subtraction is not empty 715 */ 716 public static bool subtract(out Value dest, Value minuend, Value subtrahend) 717 { 718 GValue* outdest = new GValue; 719 720 auto p = gst_value_subtract(outdest, (minuend is null) ? null : minuend.getValueStruct(), (subtrahend is null) ? null : subtrahend.getValueStruct()) != 0; 721 722 dest = ObjectG.getDObject!(Value)(outdest); 723 724 return p; 725 } 726 727 /** 728 * Creates a GValue corresponding to the union of @value1 and @value2. 729 * 730 * Params: 731 * dest = the destination value 732 * value1 = a value to union 733 * value2 = another value to union 734 * 735 * Return: %TRUE if the union succeeded. 736 */ 737 public static bool unio(out Value dest, Value value1, Value value2) 738 { 739 GValue* outdest = new GValue; 740 741 auto p = gst_value_union(outdest, (value1 is null) ? null : value1.getValueStruct(), (value2 is null) ? null : value2.getValueStruct()) != 0; 742 743 dest = ObjectG.getDObject!(Value)(outdest); 744 745 return p; 746 } 747 }