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.Query; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gstreamer.AllocationParams; 31 private import gstreamer.Allocator; 32 private import gstreamer.BufferPool; 33 private import gstreamer.Caps; 34 private import gstreamer.Context; 35 private import gstreamer.Structure; 36 private import gstreamerc.gstreamer; 37 public import gstreamerc.gstreamertypes; 38 39 40 /** 41 * Queries can be performed on pads (gst_pad_query()) and elements 42 * (gst_element_query()). Please note that some queries might need a running 43 * pipeline to work. 44 * 45 * Queries can be created using the gst_query_new_*() functions. 46 * Query values can be set using gst_query_set_*(), and parsed using 47 * gst_query_parse_*() helpers. 48 * 49 * The following example shows how to query the duration of a pipeline: 50 * |[<!-- language="C" --> 51 * GstQuery *query; 52 * gboolean res; 53 * query = gst_query_new_duration (GST_FORMAT_TIME); 54 * res = gst_element_query (pipeline, query); 55 * if (res) { 56 * gint64 duration; 57 * gst_query_parse_duration (query, NULL, &duration); 58 * g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration)); 59 * } else { 60 * g_print ("duration query failed..."); 61 * } 62 * gst_query_unref (query); 63 * ]| 64 */ 65 public class Query 66 { 67 /** the main Gtk struct */ 68 protected GstQuery* gstQuery; 69 protected bool ownedRef; 70 71 /** Get the main Gtk struct */ 72 public GstQuery* getQueryStruct(bool transferOwnership = false) 73 { 74 if (transferOwnership) 75 ownedRef = false; 76 return gstQuery; 77 } 78 79 /** the main Gtk struct as a void* */ 80 protected void* getStruct() 81 { 82 return cast(void*)gstQuery; 83 } 84 85 /** 86 * Sets our main struct and passes it to the parent class. 87 */ 88 public this (GstQuery* gstQuery, bool ownedRef = false) 89 { 90 this.gstQuery = gstQuery; 91 this.ownedRef = ownedRef; 92 } 93 94 /** 95 * Constructs a new query stream position query object. Use gst_query_unref() 96 * when done with it. A position query is used to query the current position 97 * of playback in the streams, in some format. 98 * Params: 99 * format = the default GstFormat for the new query 100 * Returns: 101 * A GstQuery 102 */ 103 public static Query newPosition(GstFormat format) 104 { 105 auto p = gst_query_new_position(format); 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by gst_query_new_position"); 110 } 111 112 return new Query( cast(GstQuery*)p); //, true); 113 } 114 115 /** 116 * Constructs a new stream duration query object to query in the given format. 117 * Use gst_query_unref() when done with it. A duration query will give the 118 * total length of the stream. 119 * Params: 120 * format = the GstFormat for this duration query 121 * Returns: 122 * A GstQuery 123 */ 124 public static Query newDuration(GstFormat format) 125 { 126 auto p = gst_query_new_duration(format); 127 128 if(p is null) 129 { 130 throw new ConstructionException("null returned by gst_query_new_duration"); 131 } 132 133 return new Query( cast(GstQuery*)p); //, true); 134 } 135 136 /** 137 * Constructs a new query object for querying seeking properties of 138 * the stream. 139 * Params: 140 * format = the default GstFormat for the new query 141 * Returns: 142 * A GstQuery 143 */ 144 public static Query newSeeking(GstFormat format) 145 { 146 auto p = gst_query_new_seeking(format); 147 148 if(p is null) 149 { 150 throw new ConstructionException("null returned by gst_query_new_seeking"); 151 } 152 153 return new Query(cast(GstQuery*)p); //, true); 154 } 155 156 /** 157 * Constructs a new query object for querying formats of 158 * the stream. 159 * Returns: 160 * A GstQuery 161 */ 162 public static Query newFormats() 163 { 164 auto p = gst_query_new_formats(); 165 166 if(p is null) 167 { 168 throw new ConstructionException("null returned by gst_query_new_formats"); 169 } 170 171 return new Query(cast(GstQuery*)p); //, true); 172 } 173 174 /** 175 * Constructs a new segment query object. Use gst_query_unref() 176 * when done with it. A segment query is used to discover information about the 177 * currently configured segment for playback. 178 * Params: 179 * format = the GstFormat for the new query 180 * Returns: 181 * a GstQuery 182 */ 183 public static Query newSegment(GstFormat format) 184 { 185 auto p = gst_query_new_segment(format); 186 187 if(p is null) 188 { 189 throw new ConstructionException("null returned by gst_query_new_segment"); 190 } 191 192 return new Query(cast(GstQuery*)p); //, true); 193 } 194 195 /** 196 * Constructs a new latency query object. 197 * Use gst_query_unref() when done with it. A latency query is usually performed 198 * by sinks to compensate for additional latency introduced by elements in the 199 * pipeline. 200 * Free-function: gst_query_unref 201 */ 202 public static Query newLatency() 203 { 204 auto p = gst_query_new_latency(); 205 206 if(p is null) 207 { 208 throw new ConstructionException("null returned by gst_query_new_latency()"); 209 } 210 211 return new Query(cast(GstQuery*)p); //, true); 212 } 213 214 /** 215 * Constructs a new query URI query object. Use gst_query_unref() 216 * when done with it. An URI query is used to query the current URI 217 * that is used by the source or sink. 218 * Free-function: gst_query_unref 219 * Throws: ConstructionException GTK+ fails to create the object. 220 */ 221 public static Query newUri() 222 { 223 auto p = gst_query_new_uri(); 224 225 if(p is null) 226 { 227 throw new ConstructionException("null returned by gst_query_new_uri()"); 228 } 229 230 return new Query(cast(GstQuery*)p); //, true); 231 } 232 233 /** 234 * Constructs a new query object for querying the scheduling properties. 235 * Free-function: gst_query_unref 236 * Throws: ConstructionException GTK+ fails to create the object. 237 */ 238 public static Query newScheduling() 239 { 240 auto p = gst_query_new_scheduling(); 241 242 if(p is null) 243 { 244 throw new ConstructionException("null returned by gst_query_new_scheduling()"); 245 } 246 247 return new Query(cast(GstQuery*)p); //, true); 248 } 249 250 /** 251 * Constructs a new query object for querying the drain state. 252 * Free-function: gst_query_unref 253 * Throws: ConstructionException GTK+ fails to create the object. 254 */ 255 public static Query newDrain() 256 { 257 auto p = gst_query_new_drain(); 258 259 if(p is null) 260 { 261 throw new ConstructionException("null returned by gst_query_new_drain()"); 262 } 263 264 return new Query(cast(GstQuery*)p); //, true); 265 } 266 267 /** 268 * Constructs a new query object for querying if caps are accepted. 269 * Free-function: gst_query_unref 270 * Params: 271 * caps = a fixed GstCaps 272 * Throws: ConstructionException GTK+ fails to create the object. 273 */ 274 public static Query newAcceptCaps(Caps caps) 275 { 276 auto p = gst_query_new_accept_caps((caps is null) ? null : caps.getCapsStruct()); 277 278 if(p is null) 279 { 280 throw new ConstructionException("null returned by gst_query_new_accept_caps((caps is null) ? null : caps.getCapsStruct())"); 281 } 282 283 return new Query(cast(GstQuery*)p); //, true); 284 } 285 286 /** 287 */ 288 289 /** */ 290 public static GType getType() 291 { 292 return gst_query_get_type(); 293 } 294 295 /** 296 * Constructs a new query object for querying the allocation properties. 297 * 298 * Free-function: gst_query_unref() 299 * 300 * Params: 301 * caps = the negotiated caps 302 * needPool = return a pool 303 * 304 * Returns: a new #GstQuery 305 * 306 * Throws: ConstructionException GTK+ fails to create the object. 307 */ 308 public this(Caps caps, bool needPool) 309 { 310 auto p = gst_query_new_allocation((caps is null) ? null : caps.getCapsStruct(), needPool); 311 312 if(p is null) 313 { 314 throw new ConstructionException("null returned by new_allocation"); 315 } 316 317 this(cast(GstQuery*) p); 318 } 319 320 /** 321 * Constructs a new query object for querying the buffering status of 322 * a stream. 323 * 324 * Free-function: gst_query_unref() 325 * 326 * Params: 327 * format = the default #GstFormat for the new query 328 * 329 * Returns: a new #GstQuery 330 * 331 * Throws: ConstructionException GTK+ fails to create the object. 332 */ 333 public this(GstFormat format) 334 { 335 auto p = gst_query_new_buffering(format); 336 337 if(p is null) 338 { 339 throw new ConstructionException("null returned by new_buffering"); 340 } 341 342 this(cast(GstQuery*) p); 343 } 344 345 /** 346 * Constructs a new query object for querying the caps. 347 * 348 * The CAPS query should return the allowable caps for a pad in the context 349 * of the element's state, its link to other elements, and the devices or files 350 * it has opened. These caps must be a subset of the pad template caps. In the 351 * NULL state with no links, the CAPS query should ideally return the same caps 352 * as the pad template. In rare circumstances, an object property can affect 353 * the caps returned by the CAPS query, but this is discouraged. 354 * 355 * For most filters, the caps returned by CAPS query is directly affected by the 356 * allowed caps on other pads. For demuxers and decoders, the caps returned by 357 * the srcpad's getcaps function is directly related to the stream data. Again, 358 * the CAPS query should return the most specific caps it reasonably can, since this 359 * helps with autoplugging. 360 * 361 * The @filter is used to restrict the result caps, only the caps matching 362 * @filter should be returned from the CAPS query. Specifying a filter might 363 * greatly reduce the amount of processing an element needs to do. 364 * 365 * Free-function: gst_query_unref() 366 * 367 * Params: 368 * filter = a filter 369 * 370 * Returns: a new #GstQuery 371 * 372 * Throws: ConstructionException GTK+ fails to create the object. 373 */ 374 public this(Caps filter) 375 { 376 auto p = gst_query_new_caps((filter is null) ? null : filter.getCapsStruct()); 377 378 if(p is null) 379 { 380 throw new ConstructionException("null returned by new_caps"); 381 } 382 383 this(cast(GstQuery*) p); 384 } 385 386 /** 387 * Constructs a new query object for querying the pipeline-local context. 388 * 389 * Free-function: gst_query_unref() 390 * 391 * Params: 392 * contextType = Context type to query 393 * 394 * Returns: a new #GstQuery 395 * 396 * Since: 1.2 397 * 398 * Throws: ConstructionException GTK+ fails to create the object. 399 */ 400 public this(string contextType) 401 { 402 auto p = gst_query_new_context(Str.toStringz(contextType)); 403 404 if(p is null) 405 { 406 throw new ConstructionException("null returned by new_context"); 407 } 408 409 this(cast(GstQuery*) p); 410 } 411 412 /** 413 * Constructs a new convert query object. Use gst_query_unref() 414 * when done with it. A convert query is used to ask for a conversion between 415 * one format and another. 416 * 417 * Free-function: gst_query_unref() 418 * 419 * Params: 420 * srcFormat = the source #GstFormat for the new query 421 * value = the value to convert 422 * destFormat = the target #GstFormat 423 * 424 * Returns: a #GstQuery 425 * 426 * Throws: ConstructionException GTK+ fails to create the object. 427 */ 428 public this(GstFormat srcFormat, long value, GstFormat destFormat) 429 { 430 auto p = gst_query_new_convert(srcFormat, value, destFormat); 431 432 if(p is null) 433 { 434 throw new ConstructionException("null returned by new_convert"); 435 } 436 437 this(cast(GstQuery*) p); 438 } 439 440 /** 441 * Constructs a new custom query object. Use gst_query_unref() 442 * when done with it. 443 * 444 * Free-function: gst_query_unref() 445 * 446 * Params: 447 * type = the query type 448 * structure = a structure for the query 449 * 450 * Returns: a new #GstQuery 451 * 452 * Throws: ConstructionException GTK+ fails to create the object. 453 */ 454 public this(GstQueryType type, Structure structure) 455 { 456 auto p = gst_query_new_custom(type, (structure is null) ? null : structure.getStructureStruct(true)); 457 458 if(p is null) 459 { 460 throw new ConstructionException("null returned by new_custom"); 461 } 462 463 this(cast(GstQuery*) p); 464 } 465 466 /** 467 * Add @api with @params as one of the supported metadata API to @query. 468 * 469 * Params: 470 * api = the metadata API 471 * params = API specific parameters 472 */ 473 public void addAllocationMeta(GType api, Structure params) 474 { 475 gst_query_add_allocation_meta(gstQuery, api, (params is null) ? null : params.getStructureStruct()); 476 } 477 478 /** 479 * Add @allocator and its @params as a supported memory allocator. 480 * 481 * Params: 482 * allocator = the memory allocator 483 * params = a #GstAllocationParams 484 */ 485 public void addAllocationParam(Allocator allocator, AllocationParams params) 486 { 487 gst_query_add_allocation_param(gstQuery, (allocator is null) ? null : allocator.getAllocatorStruct(), (params is null) ? null : params.getAllocationParamsStruct()); 488 } 489 490 /** 491 * Set the pool parameters in @query. 492 * 493 * Params: 494 * pool = the #GstBufferPool 495 * size = the buffer size 496 * minBuffers = the min buffers 497 * maxBuffers = the max buffers 498 */ 499 public void addAllocationPool(BufferPool pool, uint size, uint minBuffers, uint maxBuffers) 500 { 501 gst_query_add_allocation_pool(gstQuery, (pool is null) ? null : pool.getBufferPoolStruct(), size, minBuffers, maxBuffers); 502 } 503 504 /** 505 * Set the buffering-ranges array field in @query. The current last 506 * start position of the array should be inferior to @start. 507 * 508 * Params: 509 * start = start position of the range 510 * stop = stop position of the range 511 * 512 * Returns: a #gboolean indicating if the range was added or not. 513 */ 514 public bool addBufferingRange(long start, long stop) 515 { 516 return gst_query_add_buffering_range(gstQuery, start, stop) != 0; 517 } 518 519 /** 520 * Add @mode as one of the supported scheduling modes to @query. 521 * 522 * Params: 523 * mode = a #GstPadMode 524 */ 525 public void addSchedulingMode(GstPadMode mode) 526 { 527 gst_query_add_scheduling_mode(gstQuery, mode); 528 } 529 530 /** 531 * Check if @query has metadata @api set. When this function returns %TRUE, 532 * @index will contain the index where the requested API and the parameters 533 * can be found. 534 * 535 * Params: 536 * api = the metadata API 537 * index = the index 538 * 539 * Returns: %TRUE when @api is in the list of metadata. 540 */ 541 public bool findAllocationMeta(GType api, out uint index) 542 { 543 return gst_query_find_allocation_meta(gstQuery, api, &index) != 0; 544 } 545 546 /** 547 * Retrieve the number of values currently stored in the 548 * meta API array of the query's structure. 549 * 550 * Returns: the metadata API array size as a #guint. 551 */ 552 public uint getNAllocationMetas() 553 { 554 return gst_query_get_n_allocation_metas(gstQuery); 555 } 556 557 /** 558 * Retrieve the number of values currently stored in the 559 * allocator params array of the query's structure. 560 * 561 * If no memory allocator is specified, the downstream element can handle 562 * the default memory allocator. The first memory allocator in the query 563 * should be generic and allow mapping to system memory, all following 564 * allocators should be ordered by preference with the preferred one first. 565 * 566 * Returns: the allocator array size as a #guint. 567 */ 568 public uint getNAllocationParams() 569 { 570 return gst_query_get_n_allocation_params(gstQuery); 571 } 572 573 /** 574 * Retrieve the number of values currently stored in the 575 * pool array of the query's structure. 576 * 577 * Returns: the pool array size as a #guint. 578 */ 579 public uint getNAllocationPools() 580 { 581 return gst_query_get_n_allocation_pools(gstQuery); 582 } 583 584 /** 585 * Retrieve the number of values currently stored in the 586 * buffered-ranges array of the query's structure. 587 * 588 * Returns: the range array size as a #guint. 589 */ 590 public uint getNBufferingRanges() 591 { 592 return gst_query_get_n_buffering_ranges(gstQuery); 593 } 594 595 /** 596 * Retrieve the number of values currently stored in the 597 * scheduling mode array of the query's structure. 598 * 599 * Returns: the scheduling mode array size as a #guint. 600 */ 601 public uint getNSchedulingModes() 602 { 603 return gst_query_get_n_scheduling_modes(gstQuery); 604 } 605 606 /** 607 * Get the structure of a query. 608 * 609 * Returns: the #GstStructure of the query. The structure is 610 * still owned by the query and will therefore be freed when the query 611 * is unreffed. 612 */ 613 public Structure getStructure() 614 { 615 auto p = gst_query_get_structure(gstQuery); 616 617 if(p is null) 618 { 619 return null; 620 } 621 622 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 623 } 624 625 /** 626 * Check if @query has scheduling mode set. 627 * 628 * > When checking if upstream supports pull mode, it is usually not 629 * > enough to just check for GST_PAD_MODE_PULL with this function, you 630 * > also want to check whether the scheduling flags returned by 631 * > gst_query_parse_scheduling() have the seeking flag set (meaning 632 * > random access is supported, not only sequential pulls). 633 * 634 * Params: 635 * mode = the scheduling mode 636 * 637 * Returns: %TRUE when @mode is in the list of scheduling modes. 638 */ 639 public bool hasSchedulingMode(GstPadMode mode) 640 { 641 return gst_query_has_scheduling_mode(gstQuery, mode) != 0; 642 } 643 644 /** 645 * Check if @query has scheduling mode set and @flags is set in 646 * query scheduling flags. 647 * 648 * Params: 649 * mode = the scheduling mode 650 * flags = #GstSchedulingFlags 651 * 652 * Returns: %TRUE when @mode is in the list of scheduling modes 653 * and @flags are compatible with query flags. 654 */ 655 public bool hasSchedulingModeWithFlags(GstPadMode mode, GstSchedulingFlags flags) 656 { 657 return gst_query_has_scheduling_mode_with_flags(gstQuery, mode, flags) != 0; 658 } 659 660 /** 661 * Get the caps from @query. The caps remains valid as long as @query remains 662 * valid. 663 * 664 * Params: 665 * caps = A pointer to the caps 666 */ 667 public void parseAcceptCaps(out Caps caps) 668 { 669 GstCaps* outcaps = null; 670 671 gst_query_parse_accept_caps(gstQuery, &outcaps); 672 673 caps = ObjectG.getDObject!(Caps)(outcaps); 674 } 675 676 /** 677 * Parse the result from @query and store in @result. 678 * 679 * Params: 680 * result = location for the result 681 */ 682 public void parseAcceptCapsResult(ref bool result) 683 { 684 int outresult = (result ? 1 : 0); 685 686 gst_query_parse_accept_caps_result(gstQuery, &outresult); 687 688 result = (outresult == 1); 689 } 690 691 /** 692 * Parse an allocation query, writing the requested caps in @caps and 693 * whether a pool is needed in @need_pool, if the respective parameters 694 * are non-%NULL. 695 * 696 * Pool details can be retrieved using gst_query_get_n_allocation_pools() and 697 * gst_query_parse_nth_allocation_pool(). 698 * 699 * Params: 700 * caps = The #GstCaps 701 * needPool = Whether a #GstBufferPool is needed 702 */ 703 public void parseAllocation(out Caps caps, out bool needPool) 704 { 705 GstCaps* outcaps = null; 706 int outneedPool; 707 708 gst_query_parse_allocation(gstQuery, &outcaps, &outneedPool); 709 710 caps = ObjectG.getDObject!(Caps)(outcaps); 711 needPool = (outneedPool == 1); 712 } 713 714 /** 715 * Get the percentage of buffered data. This is a value between 0 and 100. 716 * The @busy indicator is %TRUE when the buffering is in progress. 717 * 718 * Params: 719 * busy = if buffering is busy, or %NULL 720 * percent = a buffering percent, or %NULL 721 */ 722 public void parseBufferingPercent(out bool busy, out int percent) 723 { 724 int outbusy; 725 726 gst_query_parse_buffering_percent(gstQuery, &outbusy, &percent); 727 728 busy = (outbusy == 1); 729 } 730 731 /** 732 * Parse an available query, writing the format into @format, and 733 * other results into the passed parameters, if the respective parameters 734 * are non-%NULL 735 * 736 * Params: 737 * format = the format to set for the @segment_start 738 * and @segment_end values, or %NULL 739 * start = the start to set, or %NULL 740 * stop = the stop to set, or %NULL 741 * estimatedTotal = estimated total amount of download 742 * time remaining in milliseconds, or %NULL 743 */ 744 public void parseBufferingRange(out GstFormat format, out long start, out long stop, out long estimatedTotal) 745 { 746 gst_query_parse_buffering_range(gstQuery, &format, &start, &stop, &estimatedTotal); 747 } 748 749 /** 750 * Extracts the buffering stats values from @query. 751 * 752 * Params: 753 * mode = a buffering mode, or %NULL 754 * avgIn = the average input rate, or %NULL 755 * avgOut = the average output rat, or %NULL 756 * bufferingLeft = amount of buffering time left in 757 * milliseconds, or %NULL 758 */ 759 public void parseBufferingStats(out GstBufferingMode mode, out int avgIn, out int avgOut, out long bufferingLeft) 760 { 761 gst_query_parse_buffering_stats(gstQuery, &mode, &avgIn, &avgOut, &bufferingLeft); 762 } 763 764 /** 765 * Get the filter from the caps @query. The caps remains valid as long as 766 * @query remains valid. 767 * 768 * Params: 769 * filter = A pointer to the caps filter 770 */ 771 public void parseCaps(out Caps filter) 772 { 773 GstCaps* outfilter = null; 774 775 gst_query_parse_caps(gstQuery, &outfilter); 776 777 filter = ObjectG.getDObject!(Caps)(outfilter); 778 } 779 780 /** 781 * Get the caps result from @query. The caps remains valid as long as 782 * @query remains valid. 783 * 784 * Params: 785 * caps = A pointer to the caps 786 */ 787 public void parseCapsResult(out Caps caps) 788 { 789 GstCaps* outcaps = null; 790 791 gst_query_parse_caps_result(gstQuery, &outcaps); 792 793 caps = ObjectG.getDObject!(Caps)(outcaps); 794 } 795 796 /** 797 * Get the context from the context @query. The context remains valid as long as 798 * @query remains valid. 799 * 800 * Params: 801 * context = A pointer to store the #GstContext 802 * 803 * Since: 1.2 804 */ 805 public void parseContext(out Context context) 806 { 807 GstContext* outcontext = null; 808 809 gst_query_parse_context(gstQuery, &outcontext); 810 811 context = ObjectG.getDObject!(Context)(outcontext); 812 } 813 814 /** 815 * Parse a context type from an existing GST_QUERY_CONTEXT query. 816 * 817 * Params: 818 * contextType = the context type, or %NULL 819 * 820 * Returns: a #gboolean indicating if the parsing succeeded. 821 * 822 * Since: 1.2 823 */ 824 public bool parseContextType(out string contextType) 825 { 826 char* outcontextType = null; 827 828 auto p = gst_query_parse_context_type(gstQuery, &outcontextType) != 0; 829 830 contextType = Str.toString(outcontextType); 831 832 return p; 833 } 834 835 /** 836 * Parse a convert query answer. Any of @src_format, @src_value, @dest_format, 837 * and @dest_value may be %NULL, in which case that value is omitted. 838 * 839 * Params: 840 * srcFormat = the storage for the #GstFormat of the 841 * source value, or %NULL 842 * srcValue = the storage for the source value, or %NULL 843 * destFormat = the storage for the #GstFormat of the 844 * destination value, or %NULL 845 * destValue = the storage for the destination value, 846 * or %NULL 847 */ 848 public void parseConvert(out GstFormat srcFormat, out long srcValue, out GstFormat destFormat, out long destValue) 849 { 850 gst_query_parse_convert(gstQuery, &srcFormat, &srcValue, &destFormat, &destValue); 851 } 852 853 /** 854 * Parse a duration query answer. Write the format of the duration into @format, 855 * and the value into @duration, if the respective variables are non-%NULL. 856 * 857 * Params: 858 * format = the storage for the #GstFormat of the duration 859 * value, or %NULL. 860 * duration = the storage for the total duration, or %NULL. 861 */ 862 public void parseDuration(out GstFormat format, out long duration) 863 { 864 gst_query_parse_duration(gstQuery, &format, &duration); 865 } 866 867 /** 868 * Parse a latency query answer. 869 * 870 * Params: 871 * live = storage for live or %NULL 872 * minLatency = the storage for the min latency or %NULL 873 * maxLatency = the storage for the max latency or %NULL 874 */ 875 public void parseLatency(out bool live, out GstClockTime minLatency, out GstClockTime maxLatency) 876 { 877 int outlive; 878 879 gst_query_parse_latency(gstQuery, &outlive, &minLatency, &maxLatency); 880 881 live = (outlive == 1); 882 } 883 884 /** 885 * Parse the number of formats in the formats @query. 886 * 887 * Params: 888 * nFormats = the number of formats in this query. 889 */ 890 public void parseNFormats(out uint nFormats) 891 { 892 gst_query_parse_n_formats(gstQuery, &nFormats); 893 } 894 895 /** 896 * Parse an available query and get the metadata API 897 * at @index of the metadata API array. 898 * 899 * Params: 900 * index = position in the metadata API array to read 901 * params = API specific parameters 902 * 903 * Returns: a #GType of the metadata API at @index. 904 */ 905 public GType parseNthAllocationMeta(uint index, out Structure params) 906 { 907 GstStructure* outparams = null; 908 909 auto p = gst_query_parse_nth_allocation_meta(gstQuery, index, &outparams); 910 911 params = ObjectG.getDObject!(Structure)(outparams); 912 913 return p; 914 } 915 916 /** 917 * Parse an available query and get the allocator and its params 918 * at @index of the allocator array. 919 * 920 * Params: 921 * index = position in the allocator array to read 922 * allocator = variable to hold the result 923 * params = parameters for the allocator 924 */ 925 public void parseNthAllocationParam(uint index, out Allocator allocator, out AllocationParams params) 926 { 927 GstAllocator* outallocator = null; 928 GstAllocationParams* outparams = gMalloc!GstAllocationParams(); 929 930 gst_query_parse_nth_allocation_param(gstQuery, index, &outallocator, outparams); 931 932 allocator = ObjectG.getDObject!(Allocator)(outallocator); 933 params = ObjectG.getDObject!(AllocationParams)(outparams, true); 934 } 935 936 /** 937 * Get the pool parameters in @query. 938 * 939 * Unref @pool with gst_object_unref() when it's not needed any more. 940 * 941 * Params: 942 * index = index to parse 943 * pool = the #GstBufferPool 944 * size = the buffer size 945 * minBuffers = the min buffers 946 * maxBuffers = the max buffers 947 */ 948 public void parseNthAllocationPool(uint index, out BufferPool pool, out uint size, out uint minBuffers, out uint maxBuffers) 949 { 950 GstBufferPool* outpool = null; 951 952 gst_query_parse_nth_allocation_pool(gstQuery, index, &outpool, &size, &minBuffers, &maxBuffers); 953 954 pool = ObjectG.getDObject!(BufferPool)(outpool); 955 } 956 957 /** 958 * Parse an available query and get the start and stop values stored 959 * at the @index of the buffered ranges array. 960 * 961 * Params: 962 * index = position in the buffered-ranges array to read 963 * start = the start position to set, or %NULL 964 * stop = the stop position to set, or %NULL 965 * 966 * Returns: a #gboolean indicating if the parsing succeeded. 967 */ 968 public bool parseNthBufferingRange(uint index, out long start, out long stop) 969 { 970 return gst_query_parse_nth_buffering_range(gstQuery, index, &start, &stop) != 0; 971 } 972 973 /** 974 * Parse the format query and retrieve the @nth format from it into 975 * @format. If the list contains less elements than @nth, @format will be 976 * set to GST_FORMAT_UNDEFINED. 977 * 978 * Params: 979 * nth = the nth format to retrieve. 980 * format = a pointer to store the nth format 981 */ 982 public void parseNthFormat(uint nth, out GstFormat format) 983 { 984 gst_query_parse_nth_format(gstQuery, nth, &format); 985 } 986 987 /** 988 * Parse an available query and get the scheduling mode 989 * at @index of the scheduling modes array. 990 * 991 * Params: 992 * index = position in the scheduling modes array to read 993 * 994 * Returns: a #GstPadMode of the scheduling mode at @index. 995 */ 996 public GstPadMode parseNthSchedulingMode(uint index) 997 { 998 return gst_query_parse_nth_scheduling_mode(gstQuery, index); 999 } 1000 1001 /** 1002 * Parse a position query, writing the format into @format, and the position 1003 * into @cur, if the respective parameters are non-%NULL. 1004 * 1005 * Params: 1006 * format = the storage for the #GstFormat of the 1007 * position values (may be %NULL) 1008 * cur = the storage for the current position (may be %NULL) 1009 */ 1010 public void parsePosition(out GstFormat format, out long cur) 1011 { 1012 gst_query_parse_position(gstQuery, &format, &cur); 1013 } 1014 1015 /** 1016 * Set the scheduling properties. 1017 * 1018 * Params: 1019 * flags = #GstSchedulingFlags 1020 * minsize = the suggested minimum size of pull requests 1021 * maxsize = the suggested maximum size of pull requests: 1022 * alig = the suggested alignment of pull requests 1023 */ 1024 public void parseScheduling(out GstSchedulingFlags flags, out int minsize, out int maxsize, out int alig) 1025 { 1026 gst_query_parse_scheduling(gstQuery, &flags, &minsize, &maxsize, &alig); 1027 } 1028 1029 /** 1030 * Parse a seeking query, writing the format into @format, and 1031 * other results into the passed parameters, if the respective parameters 1032 * are non-%NULL 1033 * 1034 * Params: 1035 * format = the format to set for the @segment_start 1036 * and @segment_end values, or %NULL 1037 * seekable = the seekable flag to set, or %NULL 1038 * segmentStart = the segment_start to set, or %NULL 1039 * segmentEnd = the segment_end to set, or %NULL 1040 */ 1041 public void parseSeeking(out GstFormat format, out bool seekable, out long segmentStart, out long segmentEnd) 1042 { 1043 int outseekable; 1044 1045 gst_query_parse_seeking(gstQuery, &format, &outseekable, &segmentStart, &segmentEnd); 1046 1047 seekable = (outseekable == 1); 1048 } 1049 1050 /** 1051 * Parse a segment query answer. Any of @rate, @format, @start_value, and 1052 * @stop_value may be %NULL, which will cause this value to be omitted. 1053 * 1054 * See gst_query_set_segment() for an explanation of the function arguments. 1055 * 1056 * Params: 1057 * rate = the storage for the rate of the segment, or %NULL 1058 * format = the storage for the #GstFormat of the values, 1059 * or %NULL 1060 * startValue = the storage for the start value, or %NULL 1061 * stopValue = the storage for the stop value, or %NULL 1062 */ 1063 public void parseSegment(out double rate, out GstFormat format, out long startValue, out long stopValue) 1064 { 1065 gst_query_parse_segment(gstQuery, &rate, &format, &startValue, &stopValue); 1066 } 1067 1068 /** 1069 * Parse an URI query, writing the URI into @uri as a newly 1070 * allocated string, if the respective parameters are non-%NULL. 1071 * Free the string with g_free() after usage. 1072 * 1073 * Params: 1074 * uri = the storage for the current URI 1075 * (may be %NULL) 1076 */ 1077 public void parseUri(out string uri) 1078 { 1079 char* outuri = null; 1080 1081 gst_query_parse_uri(gstQuery, &outuri); 1082 1083 uri = Str.toString(outuri); 1084 } 1085 1086 /** 1087 * Parse an URI query, writing the URI into @uri as a newly 1088 * allocated string, if the respective parameters are non-%NULL. 1089 * Free the string with g_free() after usage. 1090 * 1091 * Params: 1092 * uri = the storage for the redirect URI 1093 * (may be %NULL) 1094 * 1095 * Since: 1.2 1096 */ 1097 public void parseUriRedirection(out string uri) 1098 { 1099 char* outuri = null; 1100 1101 gst_query_parse_uri_redirection(gstQuery, &outuri); 1102 1103 uri = Str.toString(outuri); 1104 } 1105 1106 /** 1107 * Parse an URI query, and set @permanent to %TRUE if there is a redirection 1108 * and it should be considered permanent. If a redirection is permanent, 1109 * applications should update their internal storage of the URI, otherwise 1110 * they should make all future requests to the original URI. 1111 * 1112 * Params: 1113 * permanent = if the URI redirection is permanent 1114 * (may be %NULL) 1115 * 1116 * Since: 1.4 1117 */ 1118 public void parseUriRedirectionPermanent(out bool permanent) 1119 { 1120 int outpermanent; 1121 1122 gst_query_parse_uri_redirection_permanent(gstQuery, &outpermanent); 1123 1124 permanent = (outpermanent == 1); 1125 } 1126 1127 /** 1128 * Remove the metadata API at @index of the metadata API array. 1129 * 1130 * Params: 1131 * index = position in the metadata API array to remove 1132 */ 1133 public void removeNthAllocationMeta(uint index) 1134 { 1135 gst_query_remove_nth_allocation_meta(gstQuery, index); 1136 } 1137 1138 /** 1139 * Remove the allocation param at @index of the allocation param array. 1140 * 1141 * Params: 1142 * index = position in the allocation param array to remove 1143 * 1144 * Since: 1.2 1145 */ 1146 public void removeNthAllocationParam(uint index) 1147 { 1148 gst_query_remove_nth_allocation_param(gstQuery, index); 1149 } 1150 1151 /** 1152 * Remove the allocation pool at @index of the allocation pool array. 1153 * 1154 * Params: 1155 * index = position in the allocation pool array to remove 1156 * 1157 * Since: 1.2 1158 */ 1159 public void removeNthAllocationPool(uint index) 1160 { 1161 gst_query_remove_nth_allocation_pool(gstQuery, index); 1162 } 1163 1164 /** 1165 * Set @result as the result for the @query. 1166 * 1167 * Params: 1168 * result = the result to set 1169 */ 1170 public void setAcceptCapsResult(bool result) 1171 { 1172 gst_query_set_accept_caps_result(gstQuery, result); 1173 } 1174 1175 /** 1176 * Set the percentage of buffered data. This is a value between 0 and 100. 1177 * The @busy indicator is %TRUE when the buffering is in progress. 1178 * 1179 * Params: 1180 * busy = if buffering is busy 1181 * percent = a buffering percent 1182 */ 1183 public void setBufferingPercent(bool busy, int percent) 1184 { 1185 gst_query_set_buffering_percent(gstQuery, busy, percent); 1186 } 1187 1188 /** 1189 * Set the available query result fields in @query. 1190 * 1191 * Params: 1192 * format = the format to set for the @start and @stop values 1193 * start = the start to set 1194 * stop = the stop to set 1195 * estimatedTotal = estimated total amount of download time remaining in 1196 * milliseconds 1197 */ 1198 public void setBufferingRange(GstFormat format, long start, long stop, long estimatedTotal) 1199 { 1200 gst_query_set_buffering_range(gstQuery, format, start, stop, estimatedTotal); 1201 } 1202 1203 /** 1204 * Configures the buffering stats values in @query. 1205 * 1206 * Params: 1207 * mode = a buffering mode 1208 * avgIn = the average input rate 1209 * avgOut = the average output rate 1210 * bufferingLeft = amount of buffering time left in milliseconds 1211 */ 1212 public void setBufferingStats(GstBufferingMode mode, int avgIn, int avgOut, long bufferingLeft) 1213 { 1214 gst_query_set_buffering_stats(gstQuery, mode, avgIn, avgOut, bufferingLeft); 1215 } 1216 1217 /** 1218 * Set the @caps result in @query. 1219 * 1220 * Params: 1221 * caps = A pointer to the caps 1222 */ 1223 public void setCapsResult(Caps caps) 1224 { 1225 gst_query_set_caps_result(gstQuery, (caps is null) ? null : caps.getCapsStruct()); 1226 } 1227 1228 /** 1229 * Answer a context query by setting the requested context. 1230 * 1231 * Params: 1232 * context = the requested #GstContext 1233 * 1234 * Since: 1.2 1235 */ 1236 public void setContext(Context context) 1237 { 1238 gst_query_set_context(gstQuery, (context is null) ? null : context.getContextStruct()); 1239 } 1240 1241 /** 1242 * Answer a convert query by setting the requested values. 1243 * 1244 * Params: 1245 * srcFormat = the source #GstFormat 1246 * srcValue = the source value 1247 * destFormat = the destination #GstFormat 1248 * destValue = the destination value 1249 */ 1250 public void setConvert(GstFormat srcFormat, long srcValue, GstFormat destFormat, long destValue) 1251 { 1252 gst_query_set_convert(gstQuery, srcFormat, srcValue, destFormat, destValue); 1253 } 1254 1255 /** 1256 * Answer a duration query by setting the requested value in the given format. 1257 * 1258 * Params: 1259 * format = the #GstFormat for the duration 1260 * duration = the duration of the stream 1261 */ 1262 public void setDuration(GstFormat format, long duration) 1263 { 1264 gst_query_set_duration(gstQuery, format, duration); 1265 } 1266 1267 /** 1268 * Set the formats query result fields in @query. The number of formats passed 1269 * in the @formats array must be equal to @n_formats. 1270 * 1271 * Params: 1272 * nFormats = the number of formats to set. 1273 * formats = an array containing @n_formats 1274 * @GstFormat values. 1275 */ 1276 public void setFormatsv(GstFormat[] formats) 1277 { 1278 gst_query_set_formatsv(gstQuery, cast(int)formats.length, formats.ptr); 1279 } 1280 1281 /** 1282 * Answer a latency query by setting the requested values in the given format. 1283 * 1284 * Params: 1285 * live = if there is a live element upstream 1286 * minLatency = the minimal latency of the upstream elements 1287 * maxLatency = the maximal latency of the upstream elements 1288 */ 1289 public void setLatency(bool live, GstClockTime minLatency, GstClockTime maxLatency) 1290 { 1291 gst_query_set_latency(gstQuery, live, minLatency, maxLatency); 1292 } 1293 1294 /** 1295 * Parse an available query and get the allocator and its params 1296 * at @index of the allocator array. 1297 * 1298 * Params: 1299 * index = position in the allocator array to set 1300 * allocator = new allocator to set 1301 * params = parameters for the allocator 1302 */ 1303 public void setNthAllocationParam(uint index, Allocator allocator, AllocationParams params) 1304 { 1305 gst_query_set_nth_allocation_param(gstQuery, index, (allocator is null) ? null : allocator.getAllocatorStruct(), (params is null) ? null : params.getAllocationParamsStruct()); 1306 } 1307 1308 /** 1309 * Set the pool parameters in @query. 1310 * 1311 * Params: 1312 * index = index to modify 1313 * pool = the #GstBufferPool 1314 * size = the size 1315 * minBuffers = the min buffers 1316 * maxBuffers = the max buffers 1317 */ 1318 public void setNthAllocationPool(uint index, BufferPool pool, uint size, uint minBuffers, uint maxBuffers) 1319 { 1320 gst_query_set_nth_allocation_pool(gstQuery, index, (pool is null) ? null : pool.getBufferPoolStruct(), size, minBuffers, maxBuffers); 1321 } 1322 1323 /** 1324 * Answer a position query by setting the requested value in the given format. 1325 * 1326 * Params: 1327 * format = the requested #GstFormat 1328 * cur = the position to set 1329 */ 1330 public void setPosition(GstFormat format, long cur) 1331 { 1332 gst_query_set_position(gstQuery, format, cur); 1333 } 1334 1335 /** 1336 * Set the scheduling properties. 1337 * 1338 * Params: 1339 * flags = #GstSchedulingFlags 1340 * minsize = the suggested minimum size of pull requests 1341 * maxsize = the suggested maximum size of pull requests 1342 * alig = the suggested alignment of pull requests 1343 */ 1344 public void setScheduling(GstSchedulingFlags flags, int minsize, int maxsize, int alig) 1345 { 1346 gst_query_set_scheduling(gstQuery, flags, minsize, maxsize, alig); 1347 } 1348 1349 /** 1350 * Set the seeking query result fields in @query. 1351 * 1352 * Params: 1353 * format = the format to set for the @segment_start and @segment_end values 1354 * seekable = the seekable flag to set 1355 * segmentStart = the segment_start to set 1356 * segmentEnd = the segment_end to set 1357 */ 1358 public void setSeeking(GstFormat format, bool seekable, long segmentStart, long segmentEnd) 1359 { 1360 gst_query_set_seeking(gstQuery, format, seekable, segmentStart, segmentEnd); 1361 } 1362 1363 /** 1364 * Answer a segment query by setting the requested values. The normal 1365 * playback segment of a pipeline is 0 to duration at the default rate of 1366 * 1.0. If a seek was performed on the pipeline to play a different 1367 * segment, this query will return the range specified in the last seek. 1368 * 1369 * @start_value and @stop_value will respectively contain the configured 1370 * playback range start and stop values expressed in @format. 1371 * The values are always between 0 and the duration of the media and 1372 * @start_value <= @stop_value. @rate will contain the playback rate. For 1373 * negative rates, playback will actually happen from @stop_value to 1374 * @start_value. 1375 * 1376 * Params: 1377 * rate = the rate of the segment 1378 * format = the #GstFormat of the segment values (@start_value and @stop_value) 1379 * startValue = the start value 1380 * stopValue = the stop value 1381 */ 1382 public void setSegment(double rate, GstFormat format, long startValue, long stopValue) 1383 { 1384 gst_query_set_segment(gstQuery, rate, format, startValue, stopValue); 1385 } 1386 1387 /** 1388 * Answer a URI query by setting the requested URI. 1389 * 1390 * Params: 1391 * uri = the URI to set 1392 */ 1393 public void setUri(string uri) 1394 { 1395 gst_query_set_uri(gstQuery, Str.toStringz(uri)); 1396 } 1397 1398 /** 1399 * Answer a URI query by setting the requested URI redirection. 1400 * 1401 * Params: 1402 * uri = the URI to set 1403 * 1404 * Since: 1.2 1405 */ 1406 public void setUriRedirection(string uri) 1407 { 1408 gst_query_set_uri_redirection(gstQuery, Str.toStringz(uri)); 1409 } 1410 1411 /** 1412 * Answer a URI query by setting the requested URI redirection 1413 * to permanent or not. 1414 * 1415 * Params: 1416 * permanent = whether the redirect is permanent or not 1417 * 1418 * Since: 1.4 1419 */ 1420 public void setUriRedirectionPermanent(bool permanent) 1421 { 1422 gst_query_set_uri_redirection_permanent(gstQuery, permanent); 1423 } 1424 1425 /** 1426 * Get the structure of a query. This method should be called with a writable 1427 * @query so that the returned structure is guaranteed to be writable. 1428 * 1429 * Returns: the #GstStructure of the query. The structure is 1430 * still owned by the query and will therefore be freed when the query 1431 * is unreffed. 1432 */ 1433 public Structure writableStructure() 1434 { 1435 auto p = gst_query_writable_structure(gstQuery); 1436 1437 if(p is null) 1438 { 1439 return null; 1440 } 1441 1442 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 1443 } 1444 1445 /** 1446 * Gets the #GstQueryTypeFlags associated with @type. 1447 * 1448 * Params: 1449 * type = a #GstQueryType 1450 * 1451 * Returns: a #GstQueryTypeFlags. 1452 */ 1453 public static GstQueryTypeFlags typeGetFlags(GstQueryType type) 1454 { 1455 return gst_query_type_get_flags(type); 1456 } 1457 1458 /** 1459 * Get a printable name for the given query type. Do not modify or free. 1460 * 1461 * Params: 1462 * type = the query type 1463 * 1464 * Returns: a reference to the static name of the query. 1465 */ 1466 public static string typeGetName(GstQueryType type) 1467 { 1468 return Str.toString(gst_query_type_get_name(type)); 1469 } 1470 1471 /** 1472 * Get the unique quark for the given query type. 1473 * 1474 * Params: 1475 * type = the query type 1476 * 1477 * Returns: the quark associated with the query type 1478 */ 1479 public static GQuark typeToQuark(GstQueryType type) 1480 { 1481 return gst_query_type_to_quark(type); 1482 } 1483 }