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 * Conversion parameters: 26 * inFile = GstPad.html 27 * outPack = gstreamer 28 * outFile = Pad 29 * strct = GstPad 30 * realStrct= 31 * ctorStrct= 32 * clss = Pad 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_pad_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gstreamer.Buffer 48 * - gstreamer.BufferList 49 * - gstreamer.Caps 50 * - gstreamer.Element 51 * - gstreamer.Event 52 * - gstreamer.Iterator 53 * - gstreamer.ObjectGst 54 * - gstreamer.PadTemplate 55 * - gstreamer.Query 56 * structWrap: 57 * - GstBuffer* -> Buffer 58 * - GstBufferList* -> BufferList 59 * - GstCaps* -> Caps 60 * - GstElement* -> Element 61 * - GstEvent* -> Event 62 * - GstIterator* -> Iterator 63 * - GstObject* -> ObjectGst 64 * - GstPad* -> Pad 65 * - GstPadTemplate* -> PadTemplate 66 * - GstQuery* -> Query 67 * module aliases: 68 * local aliases: 69 * overrides: 70 */ 71 72 module gstreamer.Pad; 73 74 public import gstreamerc.gstreamertypes; 75 76 private import gstreamerc.gstreamer; 77 private import glib.ConstructionException; 78 private import gobject.ObjectG; 79 80 private import gobject.Signals; 81 public import gtkc.gdktypes; 82 83 private import glib.Str; 84 private import gstreamer.Buffer; 85 private import gstreamer.BufferList; 86 private import gstreamer.Caps; 87 private import gstreamer.Element; 88 private import gstreamer.Event; 89 private import gstreamer.Iterator; 90 private import gstreamer.ObjectGst; 91 private import gstreamer.PadTemplate; 92 private import gstreamer.Query; 93 94 95 96 private import gstreamer.ObjectGst; 97 98 /** 99 * A GstElement is linked to other elements via "pads", which are extremely 100 * light-weight generic link points. 101 * 102 * Pads have a GstPadDirection, source pads produce data, sink pads consume 103 * data. 104 * 105 * Pads are typically created from a GstPadTemplate with 106 * gst_pad_new_from_template() and are then added to a GstElement. This usually 107 * happens when the element is created but it can also happen dynamically based 108 * on the data that the element is processing or based on the pads that the 109 * application requests. 110 * 111 * Pads without pad templates can be created with gst_pad_new(), 112 * which takes a direction and a name as an argument. If the name is NULL, 113 * then a guaranteed unique name will be assigned to it. 114 * 115 * A GstElement creating a pad will typically use the various 116 * gst_pad_set_*_function() calls to register callbacks for events, queries or 117 * dataflow on the pads. 118 * 119 * gst_pad_get_parent() will retrieve the GstElement that owns the pad. 120 * 121 * After two pads are retrieved from an element with gst_element_get_pad(), 122 * the pads can be linked with gst_pad_link(). (For quick links, 123 * you can also use gst_element_link(), which will make the obvious 124 * link for you if it's straightforward.). Pads can be unlinked again with 125 * gst_pad_unlink(). gst_pad_get_peer() can be used to check what the pad is 126 * linked to. 127 * 128 * Before dataflow is possible on the pads, they need to be activated with 129 * gst_pad_set_active(). 130 * 131 * gst_pad_query() and gst_pad_peer_query() can be used to query various 132 * properties of the pad and the stream. 133 * 134 * To send a GstEvent on a pad, use gst_pad_send_event() and 135 * gst_pad_push_event(). Some events will be sticky on the pad, meaning that 136 * after they pass on the pad they can be queried later with 137 * gst_pad_get_sticky_event() and gst_pad_sticky_events_foreach(). 138 * gst_pad_get_current_caps() and gst_pad_has_current_caps() are convenience 139 * functions to query the current sticky CAPS event on a pad. 140 * 141 * GstElements will use gst_pad_push() and gst_pad_pull_range() to push out 142 * or pull in a buffer. 143 * 144 * The dataflow, events and queries that happen on a pad can be monitored with 145 * probes that can be installed with gst_pad_add_probe(). gst_pad_is_blocked() 146 * can be used to check if a block probe is installed on the pad. 147 * gst_pad_is_blocking() checks if the blocking probe is currently blocking the 148 * pad. gst_pad_remove_probe() is used to remove a previously installed probe 149 * and unblock blocking probes if any. 150 * 151 * Pad have an offset that can be retrieved with gst_pad_get_offset(). This 152 * offset will be applied to the running_time of all data passing over the pad. 153 * gst_pad_set_offset() can be used to change the offset. 154 * 155 * Convenience functions exist to start, pause and stop the task on a pad with 156 * gst_pad_start_task(), gst_pad_pause_task() and gst_pad_stop_task() 157 * respectively. 158 * 159 * Last reviewed on 2012-03-29 (0.11.3) 160 */ 161 public class Pad : ObjectGst 162 { 163 164 /** the main Gtk struct */ 165 protected GstPad* gstPad; 166 167 168 public GstPad* getPadStruct() 169 { 170 return gstPad; 171 } 172 173 174 /** the main Gtk struct as a void* */ 175 protected override void* getStruct() 176 { 177 return cast(void*)gstPad; 178 } 179 180 /** 181 * Sets our main struct and passes it to the parent class 182 */ 183 public this (GstPad* gstPad) 184 { 185 super(cast(GstObject*)gstPad); 186 this.gstPad = gstPad; 187 } 188 189 protected override void setStruct(GObject* obj) 190 { 191 super.setStruct(obj); 192 gstPad = cast(GstPad*)obj; 193 } 194 195 /** 196 * Sets our main struct and passes it to the parent class. 197 * This one is additional to make gstreamer.Element addOnPadAdded() 198 * working without changes. 199 */ 200 public this (GObject* gstPad) 201 { 202 super(cast(GstObject*)gstPad); 203 this.gstPad = cast(GstPad*) gstPad; 204 } 205 206 /** 207 * Queries a pad for the stream position. 208 * This is a convenience function for gstreamerD. 209 * Returns: 210 * The current position in nanoseconds - GstFormat.TIME. 211 */ 212 public long queryPosition() 213 { 214 long cur_pos; 215 queryPosition( GstFormat.TIME, cur_pos ); 216 return cur_pos; 217 } 218 219 /** 220 * Queries a pad for the stream duration. 221 * This is a convenience function for gstreamerD. 222 * Returns: 223 * The duration in nanoseconds - GstFormat.TIME. 224 */ 225 public long queryDuration() 226 { 227 long cur_dur; 228 queryDuration( GstFormat.TIME, cur_dur ); 229 return cur_dur; 230 } 231 232 /** 233 */ 234 int[string] connectedSignals; 235 236 void delegate(Pad, Pad)[] onLinkedListeners; 237 /** 238 * Signals that a pad has been linked to the peer pad. 239 */ 240 void addOnLinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 241 { 242 if ( !("linked" in connectedSignals) ) 243 { 244 Signals.connectData( 245 getStruct(), 246 "linked", 247 cast(GCallback)&callBackLinked, 248 cast(void*)this, 249 null, 250 connectFlags); 251 connectedSignals["linked"] = 1; 252 } 253 onLinkedListeners ~= dlg; 254 } 255 extern(C) static void callBackLinked(GstPad* padStruct, GstPad* peer, Pad _pad) 256 { 257 foreach ( void delegate(Pad, Pad) dlg ; _pad.onLinkedListeners ) 258 { 259 dlg(ObjectG.getDObject!(Pad)(peer), _pad); 260 } 261 } 262 263 void delegate(Pad, Pad)[] onUnlinkedListeners; 264 /** 265 * Signals that a pad has been unlinked from the peer pad. 266 * See Also 267 * GstPadTemplate, GstElement, GstEvent, GstQuery, GstBuffer 268 */ 269 void addOnUnlinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 270 { 271 if ( !("unlinked" in connectedSignals) ) 272 { 273 Signals.connectData( 274 getStruct(), 275 "unlinked", 276 cast(GCallback)&callBackUnlinked, 277 cast(void*)this, 278 null, 279 connectFlags); 280 connectedSignals["unlinked"] = 1; 281 } 282 onUnlinkedListeners ~= dlg; 283 } 284 extern(C) static void callBackUnlinked(GstPad* padStruct, GstPad* peer, Pad _pad) 285 { 286 foreach ( void delegate(Pad, Pad) dlg ; _pad.onUnlinkedListeners ) 287 { 288 dlg(ObjectG.getDObject!(Pad)(peer), _pad); 289 } 290 } 291 292 293 /** 294 * Gets a string representing the given flow return. 295 * Params: 296 * ret = a GstFlowReturn to get the name of. 297 * Returns: a static string with the name of the flow return. 298 */ 299 public static string gstFlowGetName(GstFlowReturn ret) 300 { 301 // const gchar * gst_flow_get_name (GstFlowReturn ret); 302 return Str.toString(gst_flow_get_name(ret)); 303 } 304 305 /** 306 * Get the unique quark for the given GstFlowReturn. 307 * Params: 308 * ret = a GstFlowReturn to get the quark of. 309 * Returns: the quark associated with the flow return or 0 if an invalid return was specified. 310 */ 311 public static GQuark gstFlowToQuark(GstFlowReturn ret) 312 { 313 // GQuark gst_flow_to_quark (GstFlowReturn ret); 314 return gst_flow_to_quark(ret); 315 } 316 317 /** 318 * Return the name of a pad mode, for use in debug messages mostly. 319 * Params: 320 * mode = the pad mode 321 * Returns: short mnemonic for pad mode mode 322 */ 323 public static string modeGetName(GstPadMode mode) 324 { 325 // const gchar * gst_pad_mode_get_name (GstPadMode mode); 326 return Str.toString(gst_pad_mode_get_name(mode)); 327 } 328 329 /** 330 * Gets the direction of the pad. The direction of the pad is 331 * decided at construction time so this function does not take 332 * the LOCK. 333 * Returns: the GstPadDirection of the pad. MT safe. 334 */ 335 public GstPadDirection getDirection() 336 { 337 // GstPadDirection gst_pad_get_direction (GstPad *pad); 338 return gst_pad_get_direction(gstPad); 339 } 340 341 /** 342 * Gets the parent of pad, cast to a GstElement. If a pad has no parent or 343 * its parent is not an element, return NULL. 344 * Returns: the parent of the pad. The caller has a reference on the parent, so unref when you're finished with it. MT safe. [transfer full] 345 */ 346 public Element getParentElement() 347 { 348 // GstElement * gst_pad_get_parent_element (GstPad *pad); 349 auto p = gst_pad_get_parent_element(gstPad); 350 351 if(p is null) 352 { 353 return null; 354 } 355 356 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 357 } 358 359 /** 360 * Gets the template for pad. 361 * Returns: the GstPadTemplate from which this pad was instantiated, or NULL if this pad has no template. Unref after usage. [transfer full] 362 */ 363 public PadTemplate getPadTemplate() 364 { 365 // GstPadTemplate * gst_pad_get_pad_template (GstPad *pad); 366 auto p = gst_pad_get_pad_template(gstPad); 367 368 if(p is null) 369 { 370 return null; 371 } 372 373 return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p); 374 } 375 376 /** 377 * Links the source pad and the sink pad. 378 * Params: 379 * sinkpad = the sink GstPad to link. 380 * Returns: A result code indicating if the connection worked or what went wrong. MT Safe. 381 */ 382 public GstPadLinkReturn link(Pad sinkpad) 383 { 384 // GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad); 385 return gst_pad_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct()); 386 } 387 388 /** 389 * Links the source pad and the sink pad. 390 * This variant of gst_pad_link provides a more granular control on the 391 * checks being done when linking. While providing some considerable speedups 392 * the caller of this method must be aware that wrong usage of those flags 393 * can cause severe issues. Refer to the documentation of GstPadLinkCheck 394 * for more information. 395 * MT Safe. 396 * Params: 397 * sinkpad = the sink GstPad to link. 398 * flags = the checks to validate when linking 399 * Returns: A result code indicating if the connection worked or what went wrong. 400 */ 401 public GstPadLinkReturn linkFull(Pad sinkpad, GstPadLinkCheck flags) 402 { 403 // GstPadLinkReturn gst_pad_link_full (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags); 404 return gst_pad_link_full(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct(), flags); 405 } 406 407 /** 408 * Unlinks the source pad from the sink pad. Will emit the "unlinked" 409 * signal on both pads. 410 * Params: 411 * sinkpad = the sink GstPad to unlink. 412 * Returns: TRUE if the pads were unlinked. This function returns FALSE if the pads were not linked together. MT safe. 413 */ 414 public int unlink(Pad sinkpad) 415 { 416 // gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad); 417 return gst_pad_unlink(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct()); 418 } 419 420 /** 421 * Checks if a pad is linked to another pad or not. 422 * Returns: TRUE if the pad is linked, FALSE otherwise. MT safe. 423 */ 424 public int isLinked() 425 { 426 // gboolean gst_pad_is_linked (GstPad *pad); 427 return gst_pad_is_linked(gstPad); 428 } 429 430 /** 431 * Checks if the source pad and the sink pad are compatible so they can be 432 * linked. 433 * Params: 434 * sinkpad = the sink GstPad. 435 * Returns: TRUE if the pads can be linked. 436 */ 437 public int canLink(Pad sinkpad) 438 { 439 // gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad); 440 return gst_pad_can_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct()); 441 } 442 443 /** 444 * Gets the capabilities of the allowed media types that can flow through 445 * pad and its peer. 446 * The allowed capabilities is calculated as the intersection of the results of 447 * calling gst_pad_query_caps() on pad and its peer. The caller owns a reference 448 * on the resulting caps. 449 * Returns: the allowed GstCaps of the pad link. Unref the caps when you no longer need it. This function returns NULL when pad has no peer. MT safe. [transfer full] 450 */ 451 public Caps getAllowedCaps() 452 { 453 // GstCaps * gst_pad_get_allowed_caps (GstPad *pad); 454 auto p = gst_pad_get_allowed_caps(gstPad); 455 456 if(p is null) 457 { 458 return null; 459 } 460 461 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 462 } 463 464 /** 465 * Gets the capabilities currently configured on pad with the last 466 * GST_EVENT_CAPS event. 467 * Returns: the current caps of the pad with incremented ref-count. 468 */ 469 public Caps getCurrentCaps() 470 { 471 // GstCaps * gst_pad_get_current_caps (GstPad *pad); 472 auto p = gst_pad_get_current_caps(gstPad); 473 474 if(p is null) 475 { 476 return null; 477 } 478 479 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 480 } 481 482 /** 483 * Gets the capabilities for pad's template. 484 * Returns: the GstCaps of this pad template. Unref after usage. [transfer full] 485 */ 486 public Caps getPadTemplateCaps() 487 { 488 // GstCaps * gst_pad_get_pad_template_caps (GstPad *pad); 489 auto p = gst_pad_get_pad_template_caps(gstPad); 490 491 if(p is null) 492 { 493 return null; 494 } 495 496 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 497 } 498 499 /** 500 * Gets the peer of pad. This function refs the peer pad so 501 * you need to unref it after use. 502 * Returns: the peer GstPad. Unref after usage. MT safe. [transfer full] 503 */ 504 public Pad getPeer() 505 { 506 // GstPad * gst_pad_get_peer (GstPad *pad); 507 auto p = gst_pad_get_peer(gstPad); 508 509 if(p is null) 510 { 511 return null; 512 } 513 514 return ObjectG.getDObject!(Pad)(cast(GstPad*) p); 515 } 516 517 /** 518 * A helper function you can use that sets the FIXED_CAPS flag 519 * This way the default CAPS query will always return the negotiated caps 520 * or in case the pad is not negotiated, the padtemplate caps. 521 * The negotiated caps are the caps of the last CAPS event that passed on the 522 * pad. Use this function on a pad that, once it negotiated to a CAPS, cannot 523 * be renegotiated to something else. 524 */ 525 public void useFixedCaps() 526 { 527 // void gst_pad_use_fixed_caps (GstPad *pad); 528 gst_pad_use_fixed_caps(gstPad); 529 } 530 531 /** 532 * Check if pad has caps set on it with a GST_EVENT_CAPS event. 533 * Returns: TRUE when pad has caps associated with it. 534 */ 535 public int hasCurrentCaps() 536 { 537 // gboolean gst_pad_has_current_caps (GstPad *pad); 538 return gst_pad_has_current_caps(gstPad); 539 } 540 541 /** 542 * Returns a new reference of the sticky event of type event_type 543 * from the event. 544 * Params: 545 * eventType = the GstEventType that should be retrieved. 546 * idx = the index of the event 547 * Returns: a GstEvent of type event_type or NULL when no event of event_type was on pad. Unref after usage. [transfer full] 548 */ 549 public Event getStickyEvent(GstEventType eventType, uint idx) 550 { 551 // GstEvent * gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type, guint idx); 552 auto p = gst_pad_get_sticky_event(gstPad, eventType, idx); 553 554 if(p is null) 555 { 556 return null; 557 } 558 559 return ObjectG.getDObject!(Event)(cast(GstEvent*) p); 560 } 561 562 /** 563 * Iterates all sticky events on pad and calls foreach_func for every 564 * event. If foreach_func returns FALSE the iteration is immediately stopped. 565 * Params: 566 * foreachFunc = the GstPadStickyEventsForeachFunction that 567 * should be called for every event. [scope call] 568 * userData = the optional user data. [closure] 569 */ 570 public void stickyEventsForeach(GstPadStickyEventsForeachFunction foreachFunc, void* userData) 571 { 572 // void gst_pad_sticky_events_foreach (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data); 573 gst_pad_sticky_events_foreach(gstPad, foreachFunc, userData); 574 } 575 576 /** 577 * Query if a pad is active 578 * Returns: TRUE if the pad is active. MT safe. 579 */ 580 public int isActive() 581 { 582 // gboolean gst_pad_is_active (GstPad *pad); 583 return gst_pad_is_active(gstPad); 584 } 585 586 /** 587 * Params: 588 * info = a GstPadProbeInfo 589 * Returns: The GstBuffer from the probe. [transfer none] 590 */ 591 public static Buffer probeInfoGetBuffer(GstPadProbeInfo* info) 592 { 593 // GstBuffer * gst_pad_probe_info_get_buffer (GstPadProbeInfo *info); 594 auto p = gst_pad_probe_info_get_buffer(info); 595 596 if(p is null) 597 { 598 return null; 599 } 600 601 return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p); 602 } 603 604 /** 605 */ 606 public static BufferList probeInfoGetBufferList(GstPadProbeInfo* info) 607 { 608 // GstBufferList * gst_pad_probe_info_get_buffer_list (GstPadProbeInfo *info); 609 auto p = gst_pad_probe_info_get_buffer_list(info); 610 611 if(p is null) 612 { 613 return null; 614 } 615 616 return ObjectG.getDObject!(BufferList)(cast(GstBufferList*) p); 617 } 618 619 /** 620 * Params: 621 * info = a GstPadProbeInfo 622 * Returns: The GstEvent from the probe. [transfer none] 623 */ 624 public static Event probeInfoGetEvent(GstPadProbeInfo* info) 625 { 626 // GstEvent * gst_pad_probe_info_get_event (GstPadProbeInfo *info); 627 auto p = gst_pad_probe_info_get_event(info); 628 629 if(p is null) 630 { 631 return null; 632 } 633 634 return ObjectG.getDObject!(Event)(cast(GstEvent*) p); 635 } 636 637 /** 638 * Params: 639 * info = a GstPadProbeInfo 640 * Returns: The GstQuery from the probe. [transfer none] 641 */ 642 public static Query probeInfoGetQuery(GstPadProbeInfo* info) 643 { 644 // GstQuery * gst_pad_probe_info_get_query (GstPadProbeInfo *info); 645 auto p = gst_pad_probe_info_get_query(info); 646 647 if(p is null) 648 { 649 return null; 650 } 651 652 return ObjectG.getDObject!(Query)(cast(GstQuery*) p); 653 } 654 655 /** 656 * Be notified of different states of pads. The provided callback is called for 657 * every state that matches mask. 658 * Params: 659 * mask = the probe mask 660 * callback = GstPadProbeCallback that will be called with notifications of 661 * the pad state 662 * userData = user data passed to the callback. [closure] 663 * destroyData = GDestroyNotify for user_data 664 * Returns: an id or 0 on error. The id can be used to remove the probe with gst_pad_remove_probe(). MT safe. 665 */ 666 public gulong addProbe(GstPadProbeType mask, GstPadProbeCallback callback, void* userData, GDestroyNotify destroyData) 667 { 668 // gulong gst_pad_add_probe (GstPad *pad, GstPadProbeType mask, GstPadProbeCallback callback, gpointer user_data, GDestroyNotify destroy_data); 669 return gst_pad_add_probe(gstPad, mask, callback, userData, destroyData); 670 } 671 672 /** 673 * Remove the probe with id from pad. 674 * MT safe. 675 * Params: 676 * id = the probe id to remove 677 */ 678 public void removeProbe(gulong id) 679 { 680 // void gst_pad_remove_probe (GstPad *pad, gulong id); 681 gst_pad_remove_probe(gstPad, id); 682 } 683 684 /** 685 * Checks if the pad is blocked or not. This function returns the 686 * last requested state of the pad. It is not certain that the pad 687 * is actually blocking at this point (see gst_pad_is_blocking()). 688 * Returns: TRUE if the pad is blocked. MT safe. 689 */ 690 public int isBlocked() 691 { 692 // gboolean gst_pad_is_blocked (GstPad *pad); 693 return gst_pad_is_blocked(gstPad); 694 } 695 696 /** 697 * Checks if the pad is blocking or not. This is a guaranteed state 698 * of whether the pad is actually blocking on a GstBuffer or a GstEvent. 699 * Returns: TRUE if the pad is blocking. MT safe. 700 */ 701 public int isBlocking() 702 { 703 // gboolean gst_pad_is_blocking (GstPad *pad); 704 return gst_pad_is_blocking(gstPad); 705 } 706 707 /** 708 * Get the offset applied to the running time of pad. pad has to be a source 709 * pad. 710 * Returns: the offset. 711 */ 712 public long getOffset() 713 { 714 // gint64 gst_pad_get_offset (GstPad *pad); 715 return gst_pad_get_offset(gstPad); 716 } 717 718 /** 719 * Set the offset that will be applied to the running time of pad. 720 * Params: 721 * offset = the offset 722 */ 723 public void setOffset(long offset) 724 { 725 // void gst_pad_set_offset (GstPad *pad, gint64 offset); 726 gst_pad_set_offset(gstPad, offset); 727 } 728 729 /** 730 * Creates a new pad with the given name in the given direction. 731 * If name is NULL, a guaranteed unique name (across all pads) 732 * will be assigned. 733 * This function makes a copy of the name so you can safely free the name. 734 * Params: 735 * name = the name of the new pad. 736 * direction = the GstPadDirection of the pad. 737 * Throws: ConstructionException GTK+ fails to create the object. 738 */ 739 public this (string name, GstPadDirection direction) 740 { 741 // GstPad * gst_pad_new (const gchar *name, GstPadDirection direction); 742 auto p = gst_pad_new(Str.toStringz(name), direction); 743 if(p is null) 744 { 745 throw new ConstructionException("null returned by gst_pad_new(Str.toStringz(name), direction)"); 746 } 747 this(cast(GstPad*) p); 748 } 749 750 /** 751 * Creates a new pad with the given name from the given template. 752 * If name is NULL, a guaranteed unique name (across all pads) 753 * will be assigned. 754 * This function makes a copy of the name so you can safely free the name. 755 * Params: 756 * templ = the pad template to use 757 * name = the name of the element 758 * Throws: ConstructionException GTK+ fails to create the object. 759 */ 760 public this (PadTemplate templ, string name) 761 { 762 // GstPad * gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name); 763 auto p = gst_pad_new_from_template((templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name)); 764 if(p is null) 765 { 766 throw new ConstructionException("null returned by gst_pad_new_from_template((templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name))"); 767 } 768 this(cast(GstPad*) p); 769 } 770 771 /** 772 * Creates a new pad with the given name from the given static template. 773 * If name is NULL, a guaranteed unique name (across all pads) 774 * will be assigned. 775 * This function makes a copy of the name so you can safely free the name. 776 * Params: 777 * templ = the GstStaticPadTemplate to use 778 * name = the name of the element 779 * Throws: ConstructionException GTK+ fails to create the object. 780 */ 781 public this (GstStaticPadTemplate* templ, string name) 782 { 783 // GstPad * gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name); 784 auto p = gst_pad_new_from_static_template(templ, Str.toStringz(name)); 785 if(p is null) 786 { 787 throw new ConstructionException("null returned by gst_pad_new_from_static_template(templ, Str.toStringz(name))"); 788 } 789 this(cast(GstPad*) p); 790 } 791 792 /** 793 * Sets the given chain function for the pad. The chain function is called to 794 * process a GstBuffer input buffer. see GstPadChainFunction for more details. 795 * Params: 796 * chain = the GstPadChainFunction to set. 797 * userData = user_data passed to notify 798 * notify = notify called when chain will not be used anymore. 799 */ 800 public void setChainFunctionFull(GstPadChainFunction chain, void* userData, GDestroyNotify notify) 801 { 802 // void gst_pad_set_chain_function_full (GstPad *pad, GstPadChainFunction chain, gpointer user_data, GDestroyNotify notify); 803 gst_pad_set_chain_function_full(gstPad, chain, userData, notify); 804 } 805 806 /** 807 * Sets the given chain list function for the pad. The chainlist function is 808 * called to process a GstBufferList input buffer list. See 809 * GstPadChainListFunction for more details. 810 * Params: 811 * chainlist = the GstPadChainListFunction to set. 812 * userData = user_data passed to notify 813 * notify = notify called when chainlist will not be used anymore. 814 */ 815 public void setChainListFunctionFull(GstPadChainListFunction chainlist, void* userData, GDestroyNotify notify) 816 { 817 // void gst_pad_set_chain_list_function_full (GstPad *pad, GstPadChainListFunction chainlist, gpointer user_data, GDestroyNotify notify); 818 gst_pad_set_chain_list_function_full(gstPad, chainlist, userData, notify); 819 } 820 821 /** 822 * returns GST_FLOW_ERROR if NULL. 823 * When pad is flushing this function returns GST_FLOW_FLUSHING 824 * immediately and buffer is NULL. 825 * Calls the getrange function of pad, see GstPadGetRangeFunction for a 826 * description of a getrange function. If pad has no getrange function 827 * installed (see gst_pad_set_getrange_function()) this function returns 828 * GST_FLOW_NOT_SUPPORTED. 829 * If buffer points to a variable holding NULL, a valid new GstBuffer will be 830 * placed in buffer when this function returns GST_FLOW_OK. The new buffer 831 * must be freed with gst_buffer_unref() after usage. 832 * When buffer points to a variable that points to a valid GstBuffer, the 833 * buffer will be filled with the result data when this function returns 834 * GST_FLOW_OK. If the provided buffer is larger than size, only 835 * size bytes will be filled in the result buffer and its size will be updated 836 * accordingly. 837 * Note that less than size bytes can be returned in buffer when, for example, 838 * an EOS condition is near or when buffer is not large enough to hold size 839 * bytes. The caller should check the result buffer size to get the result size. 840 * When this function returns any other result value than GST_FLOW_OK, buffer 841 * will be unchanged. 842 * This is a lowlevel function. Usualy gst_pad_pull_range() is used. 843 * Params: 844 * offset = The start offset of the buffer 845 * size = The length of the buffer 846 * buffer = a pointer to hold the GstBuffer,. [out callee-allocates] 847 * Returns: a GstFlowReturn from the pad. MT safe. 848 */ 849 public GstFlowReturn getRange(ulong offset, uint size, ref Buffer buffer) 850 { 851 // GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer); 852 GstBuffer* outbuffer = (buffer is null) ? null : buffer.getBufferStruct(); 853 854 auto p = gst_pad_get_range(gstPad, offset, size, &outbuffer); 855 856 buffer = ObjectG.getDObject!(Buffer)(outbuffer); 857 return p; 858 } 859 860 /** 861 * Sets the given getrange function for the pad. The getrange function is 862 * called to produce a new GstBuffer to start the processing pipeline. see 863 * GstPadGetRangeFunction for a description of the getrange function. 864 * Params: 865 * get = the GstPadGetRangeFunction to set. 866 * userData = user_data passed to notify 867 * notify = notify called when get will not be used anymore. 868 */ 869 public void setGetrangeFunctionFull(GstPadGetRangeFunction get, void* userData, GDestroyNotify notify) 870 { 871 // void gst_pad_set_getrange_function_full (GstPad *pad, GstPadGetRangeFunction get, gpointer user_data, GDestroyNotify notify); 872 gst_pad_set_getrange_function_full(gstPad, get, userData, notify); 873 } 874 875 /** 876 * Sets the given event handler for the pad. 877 * Params: 878 * event = the GstPadEventFunction to set. 879 * userData = user_data passed to notify 880 * notify = notify called when event will not be used anymore. 881 */ 882 public void setEventFunctionFull(GstPadEventFunction event, void* userData, GDestroyNotify notify) 883 { 884 // void gst_pad_set_event_function_full (GstPad *pad, GstPadEventFunction event, gpointer user_data, GDestroyNotify notify); 885 gst_pad_set_event_function_full(gstPad, event, userData, notify); 886 } 887 888 /** 889 * Sets the given link function for the pad. It will be called when 890 * the pad is linked with another pad. 891 * The return value GST_PAD_LINK_OK should be used when the connection can be 892 * made. 893 * The return value GST_PAD_LINK_REFUSED should be used when the connection 894 * cannot be made for some reason. 895 * If link is installed on a source pad, it should call the GstPadLinkFunction 896 * of the peer sink pad, if present. 897 * Params: 898 * link = the GstPadLinkFunction to set. 899 * userData = user_data passed to notify 900 * notify = notify called when link will not be used anymore. 901 */ 902 public void setLinkFunctionFull(GstPadLinkFunction link, void* userData, GDestroyNotify notify) 903 { 904 // void gst_pad_set_link_function_full (GstPad *pad, GstPadLinkFunction link, gpointer user_data, GDestroyNotify notify); 905 gst_pad_set_link_function_full(gstPad, link, userData, notify); 906 } 907 908 /** 909 * Sets the given unlink function for the pad. It will be called 910 * when the pad is unlinked. 911 * Params: 912 * unlink = the GstPadUnlinkFunction to set. 913 * userData = user_data passed to notify 914 * notify = notify called when unlink will not be used anymore. 915 */ 916 public void setUnlinkFunctionFull(GstPadUnlinkFunction unlink, void* userData, GDestroyNotify notify) 917 { 918 // void gst_pad_set_unlink_function_full (GstPad *pad, GstPadUnlinkFunction unlink, gpointer user_data, GDestroyNotify notify); 919 gst_pad_set_unlink_function_full(gstPad, unlink, userData, notify); 920 } 921 922 /** 923 * Calls gst_pad_query_caps() for all internally linked pads fof pad and returns 924 * the intersection of the results. 925 * This function is useful as a default caps query function for an element 926 * that can handle any stream format, but requires all its pads to have 927 * the same caps. Two such elements are tee and adder. 928 * Params: 929 * query = a CAPS GstQuery. 930 * Returns: TRUE if query could be executed 931 */ 932 public int proxyQueryCaps(Query query) 933 { 934 // gboolean gst_pad_proxy_query_caps (GstPad *pad, GstQuery *query); 935 return gst_pad_proxy_query_caps(gstPad, (query is null) ? null : query.getQueryStruct()); 936 } 937 938 /** 939 * Calls gst_pad_accept_caps() for all internally linked pads of pad and 940 * returns the intersection of the results. 941 * This function is useful as a default accept caps query function for an element 942 * that can handle any stream format, but requires caps that are acceptable for 943 * all oposite pads. 944 * Params: 945 * query = an ACCEPT_CAPS GstQuery. 946 * Returns: TRUE if query could be executed 947 */ 948 public int proxyQueryAcceptCaps(Query query) 949 { 950 // gboolean gst_pad_proxy_query_accept_caps (GstPad *pad, GstQuery *query); 951 return gst_pad_proxy_query_accept_caps(gstPad, (query is null) ? null : query.getQueryStruct()); 952 } 953 954 /** 955 * Sets the given activate function for pad. The activate function will 956 * dispatch to gst_pad_activate_mode() to perform the actual activation. 957 * Only makes sense to set on sink pads. 958 * Call this function if your sink pad can start a pull-based task. 959 * Params: 960 * activate = the GstPadActivateFunction to set. 961 * userData = user_data passed to notify 962 * notify = notify called when activate will not be used anymore. 963 */ 964 public void setActivateFunctionFull(GstPadActivateFunction activate, void* userData, GDestroyNotify notify) 965 { 966 // void gst_pad_set_activate_function_full (GstPad *pad, GstPadActivateFunction activate, gpointer user_data, GDestroyNotify notify); 967 gst_pad_set_activate_function_full(gstPad, activate, userData, notify); 968 } 969 970 /** 971 * Sets the given activate_mode function for the pad. An activate_mode function 972 * prepares the element for data passing. 973 * Params: 974 * activatemode = the GstPadActivateModeFunction to set. 975 * userData = user_data passed to notify 976 * notify = notify called when activatemode will not be used anymore. 977 */ 978 public void setActivatemodeFunctionFull(GstPadActivateModeFunction activatemode, void* userData, GDestroyNotify notify) 979 { 980 // void gst_pad_set_activatemode_function_full (GstPad *pad, GstPadActivateModeFunction activatemode, gpointer user_data, GDestroyNotify notify); 981 gst_pad_set_activatemode_function_full(gstPad, activatemode, userData, notify); 982 } 983 984 /** 985 * Check the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return TRUE 986 * if the flag was set. 987 * Returns: TRUE is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on pad. 988 */ 989 public int needsReconfigure() 990 { 991 // gboolean gst_pad_needs_reconfigure (GstPad *pad); 992 return gst_pad_needs_reconfigure(gstPad); 993 } 994 995 /** 996 * Check and clear the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return TRUE 997 * if the flag was set. 998 * Returns: TRUE is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on pad. 999 */ 1000 public int checkReconfigure() 1001 { 1002 // gboolean gst_pad_check_reconfigure (GstPad *pad); 1003 return gst_pad_check_reconfigure(gstPad); 1004 } 1005 1006 /** 1007 * Mark a pad for needing reconfiguration. The next call to 1008 * gst_pad_check_reconfigure() will return TRUE after this call. 1009 */ 1010 public void markReconfigure() 1011 { 1012 // void gst_pad_mark_reconfigure (GstPad *pad); 1013 gst_pad_mark_reconfigure(gstPad); 1014 } 1015 1016 /** 1017 * Pushes a buffer to the peer of pad. 1018 * This function will call installed block probes before triggering any 1019 * installed data probes. 1020 * The function proceeds calling gst_pad_chain() on the peer pad and returns 1021 * the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will 1022 * be returned. 1023 * In all cases, success or failure, the caller loses its reference to buffer 1024 * after calling this function. 1025 * Params: 1026 * buffer = the GstBuffer to push returns GST_FLOW_ERROR 1027 * if not. [transfer full] 1028 * Returns: a GstFlowReturn from the peer pad. MT safe. 1029 */ 1030 public GstFlowReturn push(Buffer buffer) 1031 { 1032 // GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer); 1033 return gst_pad_push(gstPad, (buffer is null) ? null : buffer.getBufferStruct()); 1034 } 1035 1036 /** 1037 * Sends the event to the peer of the given pad. This function is 1038 * mainly used by elements to send events to their peer 1039 * elements. 1040 * This function takes owership of the provided event so you should 1041 * gst_event_ref() it if you want to reuse the event after this call. 1042 * Params: 1043 * event = the GstEvent to send to the pad. [transfer full] 1044 * Returns: TRUE if the event was handled. MT safe. 1045 */ 1046 public int pushEvent(Event event) 1047 { 1048 // gboolean gst_pad_push_event (GstPad *pad, GstEvent *event); 1049 return gst_pad_push_event(gstPad, (event is null) ? null : event.getEventStruct()); 1050 } 1051 1052 /** 1053 * Pushes a buffer list to the peer of pad. 1054 * This function will call installed block probes before triggering any 1055 * installed data probes. 1056 * The function proceeds calling the chain function on the peer pad and returns 1057 * the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will 1058 * be returned. If the peer pad does not have any installed chainlist function 1059 * every group buffer of the list will be merged into a normal GstBuffer and 1060 * chained via gst_pad_chain(). 1061 * In all cases, success or failure, the caller loses its reference to list 1062 * after calling this function. 1063 * Params: 1064 * list = the GstBufferList to push returns GST_FLOW_ERROR 1065 * if not. [transfer full] 1066 * Returns: a GstFlowReturn from the peer pad. MT safe. 1067 */ 1068 public GstFlowReturn pushList(BufferList list) 1069 { 1070 // GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list); 1071 return gst_pad_push_list(gstPad, (list is null) ? null : list.getBufferListStruct()); 1072 } 1073 1074 /** 1075 * Pulls a buffer from the peer pad or fills up a provided buffer. 1076 * This function will first trigger the pad block signal if it was 1077 * installed. 1078 * When pad is not linked GST_FLOW_NOT_LINKED is returned else this 1079 * function returns the result of gst_pad_get_range() on the peer pad. 1080 * See gst_pad_get_range() for a list of return values and for the 1081 * semantics of the arguments of this function. 1082 * If buffer points to a variable holding NULL, a valid new GstBuffer will be 1083 * placed in buffer when this function returns GST_FLOW_OK. The new buffer 1084 * must be freed with gst_buffer_unref() after usage. When this function 1085 * returns any other result value, buffer will still point to NULL. 1086 * When buffer points to a variable that points to a valid GstBuffer, the 1087 * buffer will be filled with the result data when this function returns 1088 * GST_FLOW_OK. When this function returns any other result value, 1089 * buffer will be unchanged. If the provided buffer is larger than size, only 1090 * size bytes will be filled in the result buffer and its size will be updated 1091 * accordingly. 1092 * Note that less than size bytes can be returned in buffer when, for example, 1093 * an EOS condition is near or when buffer is not large enough to hold size 1094 * bytes. The caller should check the result buffer size to get the result size. 1095 * Params: 1096 * offset = The start offset of the buffer 1097 * size = The length of the buffer 1098 * buffer = a pointer to hold the GstBuffer, returns 1099 * GST_FLOW_ERROR if NULL. [out callee-allocates] 1100 * Returns: a GstFlowReturn from the peer pad. MT safe. 1101 */ 1102 public GstFlowReturn pullRange(ulong offset, uint size, ref Buffer buffer) 1103 { 1104 // GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer); 1105 GstBuffer* outbuffer = (buffer is null) ? null : buffer.getBufferStruct(); 1106 1107 auto p = gst_pad_pull_range(gstPad, offset, size, &outbuffer); 1108 1109 buffer = ObjectG.getDObject!(Buffer)(outbuffer); 1110 return p; 1111 } 1112 1113 /** 1114 * Activates or deactivates the given pad in mode via dispatching to the 1115 * pad's activatemodefunc. For use from within pad activation functions only. 1116 * If you don't know what this is, you probably don't want to call it. 1117 * Params: 1118 * mode = the requested activation mode 1119 * active = whether or not the pad should be active. 1120 * Returns: TRUE if the operation was successful. MT safe. 1121 */ 1122 public int activateMode(GstPadMode mode, int active) 1123 { 1124 // gboolean gst_pad_activate_mode (GstPad *pad, GstPadMode mode, gboolean active); 1125 return gst_pad_activate_mode(gstPad, mode, active); 1126 } 1127 1128 /** 1129 * Sends the event to the pad. This function can be used 1130 * by applications to send events in the pipeline. 1131 * If pad is a source pad, event should be an upstream event. If pad is a 1132 * sink pad, event should be a downstream event. For example, you would not 1133 * send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream. 1134 * Furthermore, some downstream events have to be serialized with data flow, 1135 * like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If 1136 * the event needs to be serialized with data flow, this function will take the 1137 * pad's stream lock while calling its event function. 1138 * To find out whether an event type is upstream, downstream, or downstream and 1139 * serialized, see GstEventTypeFlags, gst_event_type_get_flags(), 1140 * GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and 1141 * GST_EVENT_IS_SERIALIZED. Note that in practice that an application or 1142 * plugin doesn't need to bother itself with this information; the core handles 1143 * all necessary locks and checks. 1144 * This function takes owership of the provided event so you should 1145 * gst_event_ref() it if you want to reuse the event after this call. 1146 * Params: 1147 * event = the GstEvent to send to the pad. [transfer full] 1148 * Returns: TRUE if the event was handled. 1149 */ 1150 public int sendEvent(Event event) 1151 { 1152 // gboolean gst_pad_send_event (GstPad *pad, GstEvent *event); 1153 return gst_pad_send_event(gstPad, (event is null) ? null : event.getEventStruct()); 1154 } 1155 1156 /** 1157 * Invokes the default event handler for the given pad. 1158 * The EOS event will pause the task associated with pad before it is forwarded 1159 * to all internally linked pads, 1160 * The the event is sent to all pads internally linked to pad. This function 1161 * takes ownership of event. 1162 * Params: 1163 * parent = the parent of pad or NULL. [allow-none] 1164 * event = the GstEvent to handle. [transfer full] 1165 * Returns: TRUE if the event was sent successfully. 1166 */ 1167 public int eventDefault(ObjectGst parent, Event event) 1168 { 1169 // gboolean gst_pad_event_default (GstPad *pad, GstObject *parent, GstEvent *event); 1170 return gst_pad_event_default(gstPad, (parent is null) ? null : parent.getObjectGstStruct(), (event is null) ? null : event.getEventStruct()); 1171 } 1172 1173 /** 1174 * Dispatches a query to a pad. The query should have been allocated by the 1175 * caller via one of the type-specific allocation functions. The element that 1176 * the pad belongs to is responsible for filling the query with an appropriate 1177 * response, which should then be parsed with a type-specific query parsing 1178 * function. 1179 * Again, the caller is responsible for both the allocation and deallocation of 1180 * the query structure. 1181 * Please also note that some queries might need a running pipeline to work. 1182 * Params: 1183 * query = the GstQuery to perform. [transfer none] 1184 * Returns: TRUE if the query could be performed. 1185 */ 1186 public int query(Query query) 1187 { 1188 // gboolean gst_pad_query (GstPad *pad, GstQuery *query); 1189 return gst_pad_query(gstPad, (query is null) ? null : query.getQueryStruct()); 1190 } 1191 1192 /** 1193 * Performs gst_pad_query() on the peer of pad. 1194 * The caller is responsible for both the allocation and deallocation of 1195 * the query structure. 1196 * Params: 1197 * query = the GstQuery to perform. [transfer none] 1198 * Returns: TRUE if the query could be performed. This function returns FALSE if pad has no peer. 1199 */ 1200 public int peerQuery(Query query) 1201 { 1202 // gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query); 1203 return gst_pad_peer_query(gstPad, (query is null) ? null : query.getQueryStruct()); 1204 } 1205 1206 /** 1207 * Invokes the default query handler for the given pad. 1208 * The query is sent to all pads internally linked to pad. Note that 1209 * if there are many possible sink pads that are internally linked to 1210 * pad, only one will be sent the query. 1211 * Multi-sinkpad elements should implement custom query handlers. 1212 * Params: 1213 * parent = the parent of pad or NULL. [allow-none] 1214 * query = the GstQuery to handle. [transfer none] 1215 * Returns: TRUE if the query was performed successfully. 1216 */ 1217 public int queryDefault(ObjectGst parent, Query query) 1218 { 1219 // gboolean gst_pad_query_default (GstPad *pad, GstObject *parent, GstQuery *query); 1220 return gst_pad_query_default(gstPad, (parent is null) ? null : parent.getObjectGstStruct(), (query is null) ? null : query.getQueryStruct()); 1221 } 1222 1223 /** 1224 * Queries a pad for the stream position. 1225 * Params: 1226 * format = the GstFormat requested 1227 * cur = A location in which to store the current position, or NULL. [out][allow-none] 1228 * Returns: TRUE if the query could be performed. 1229 */ 1230 public int queryPosition(GstFormat format, out long cur) 1231 { 1232 // gboolean gst_pad_query_position (GstPad *pad, GstFormat format, gint64 *cur); 1233 return gst_pad_query_position(gstPad, format, &cur); 1234 } 1235 1236 /** 1237 * Queries a pad for the total stream duration. 1238 * Params: 1239 * format = the GstFormat requested 1240 * duration = a location in which to store the total 1241 * duration, or NULL. [out][allow-none] 1242 * Returns: TRUE if the query could be performed. 1243 */ 1244 public int queryDuration(GstFormat format, out long duration) 1245 { 1246 // gboolean gst_pad_query_duration (GstPad *pad, GstFormat format, gint64 *duration); 1247 return gst_pad_query_duration(gstPad, format, &duration); 1248 } 1249 1250 /** 1251 * Queries a pad to convert src_val in src_format to dest_format. 1252 * Params: 1253 * srcFormat = a GstFormat to convert from. 1254 * srcVal = a value to convert. 1255 * destFormat = the GstFormat to convert to. 1256 * destVal = a pointer to the result. [out] 1257 * Returns: TRUE if the query could be performed. 1258 */ 1259 public int queryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, out long destVal) 1260 { 1261 // gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val, GstFormat dest_format, gint64 *dest_val); 1262 return gst_pad_query_convert(gstPad, srcFormat, srcVal, destFormat, &destVal); 1263 } 1264 1265 /** 1266 * Check if the given pad accepts the caps. 1267 * Params: 1268 * caps = a GstCaps to check on the pad 1269 * Returns: TRUE if the pad can accept the caps. 1270 */ 1271 public int queryAcceptCaps(Caps caps) 1272 { 1273 // gboolean gst_pad_query_accept_caps (GstPad *pad, GstCaps *caps); 1274 return gst_pad_query_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct()); 1275 } 1276 1277 /** 1278 * Gets the capabilities this pad can produce or consume. 1279 * Note that this method doesn't necessarily return the caps set by sending a 1280 * gst_event_new_caps() - use gst_pad_get_current_caps() for that instead. 1281 * gst_pad_query_caps returns all possible caps a pad can operate with, using 1282 * the pad's CAPS query function, If the query fails, this function will return 1283 * filter, if not NULL, otherwise ANY. 1284 * When called on sinkpads filter contains the caps that 1285 * upstream could produce in the order preferred by upstream. When 1286 * called on srcpads filter contains the caps accepted by 1287 * downstream in the preffered order. filter might be NULL but 1288 * if it is not NULL the returned caps will be a subset of filter. 1289 * Note that this function does not return writable GstCaps, use 1290 * gst_caps_make_writable() before modifying the caps. 1291 * Params: 1292 * filter = suggested GstCaps, or NULL. [allow-none] 1293 * Returns: the caps of the pad with incremented ref-count. [transfer full] 1294 */ 1295 public Caps queryCaps(Caps filter) 1296 { 1297 // GstCaps * gst_pad_query_caps (GstPad *pad, GstCaps *filter); 1298 auto p = gst_pad_query_caps(gstPad, (filter is null) ? null : filter.getCapsStruct()); 1299 1300 if(p is null) 1301 { 1302 return null; 1303 } 1304 1305 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 1306 } 1307 1308 /** 1309 * Queries the peer of a given sink pad for the stream position. 1310 * Params: 1311 * format = the GstFormat requested 1312 * cur = a location in which to store the current 1313 * position, or NULL. [out][allow-none] 1314 * Returns: TRUE if the query could be performed. 1315 */ 1316 public int peerQueryPosition(GstFormat format, out long cur) 1317 { 1318 // gboolean gst_pad_peer_query_position (GstPad *pad, GstFormat format, gint64 *cur); 1319 return gst_pad_peer_query_position(gstPad, format, &cur); 1320 } 1321 1322 /** 1323 * Queries the peer pad of a given sink pad for the total stream duration. 1324 * Params: 1325 * format = the GstFormat requested 1326 * duration = a location in which to store the total 1327 * duration, or NULL. [out][allow-none] 1328 * Returns: TRUE if the query could be performed. 1329 */ 1330 public int peerQueryDuration(GstFormat format, out long duration) 1331 { 1332 // gboolean gst_pad_peer_query_duration (GstPad *pad, GstFormat format, gint64 *duration); 1333 return gst_pad_peer_query_duration(gstPad, format, &duration); 1334 } 1335 1336 /** 1337 * Queries the peer pad of a given sink pad to convert src_val in src_format 1338 * to dest_format. 1339 * Params: 1340 * srcFormat = a GstFormat to convert from. 1341 * srcVal = a value to convert. 1342 * destFormat = the GstFormat to convert to. 1343 * destVal = a pointer to the result. [out] 1344 * Returns: TRUE if the query could be performed. 1345 */ 1346 public int peerQueryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, out long destVal) 1347 { 1348 // gboolean gst_pad_peer_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val, GstFormat dest_format, gint64 *dest_val); 1349 return gst_pad_peer_query_convert(gstPad, srcFormat, srcVal, destFormat, &destVal); 1350 } 1351 1352 /** 1353 * Check if the peer of pad accepts caps. If pad has no peer, this function 1354 * returns TRUE. 1355 * Params: 1356 * caps = a GstCaps to check on the pad 1357 * Returns: TRUE if the peer of pad can accept the caps or pad has no peer. 1358 */ 1359 public int peerQueryAcceptCaps(Caps caps) 1360 { 1361 // gboolean gst_pad_peer_query_accept_caps (GstPad *pad, GstCaps *caps); 1362 return gst_pad_peer_query_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct()); 1363 } 1364 1365 /** 1366 * Gets the capabilities of the peer connected to this pad. Similar to 1367 * gst_pad_query_caps(). 1368 * When called on srcpads filter contains the caps that 1369 * upstream could produce in the order preferred by upstream. When 1370 * called on sinkpads filter contains the caps accepted by 1371 * downstream in the preffered order. filter might be NULL but 1372 * if it is not NULL the returned caps will be a subset of filter. 1373 * Params: 1374 * filter = a GstCaps filter, or NULL. [allow-none] 1375 * Returns: the caps of the peer pad with incremented ref-count. When there is no peer pad, this function returns filter or, when filter is NULL, ANY caps. 1376 */ 1377 public Caps peerQueryCaps(Caps filter) 1378 { 1379 // GstCaps * gst_pad_peer_query_caps (GstPad *pad, GstCaps *filter); 1380 auto p = gst_pad_peer_query_caps(gstPad, (filter is null) ? null : filter.getCapsStruct()); 1381 1382 if(p is null) 1383 { 1384 return null; 1385 } 1386 1387 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 1388 } 1389 1390 /** 1391 * Set the given query function for the pad. 1392 * Params: 1393 * query = the GstPadQueryFunction to set. 1394 * userData = user_data passed to notify 1395 * notify = notify called when query will not be used anymore. 1396 */ 1397 public void setQueryFunctionFull(GstPadQueryFunction query, void* userData, GDestroyNotify notify) 1398 { 1399 // void gst_pad_set_query_function_full (GstPad *pad, GstPadQueryFunction query, gpointer user_data, GDestroyNotify notify); 1400 gst_pad_set_query_function_full(gstPad, query, userData, notify); 1401 } 1402 1403 /** 1404 * Sets the given internal link iterator function for the pad. 1405 * Params: 1406 * iterintlink = the GstPadIterIntLinkFunction to set. 1407 * userData = user_data passed to notify 1408 * notify = notify called when iterintlink will not be used anymore. 1409 */ 1410 public void setIterateInternalLinksFunctionFull(GstPadIterIntLinkFunction iterintlink, void* userData, GDestroyNotify notify) 1411 { 1412 // void gst_pad_set_iterate_internal_links_function_full (GstPad *pad, GstPadIterIntLinkFunction iterintlink, gpointer user_data, GDestroyNotify notify); 1413 gst_pad_set_iterate_internal_links_function_full(gstPad, iterintlink, userData, notify); 1414 } 1415 1416 /** 1417 * Gets an iterator for the pads to which the given pad is linked to inside 1418 * of the parent element. 1419 * Each GstPad element yielded by the iterator will have its refcount increased, 1420 * so unref after use. 1421 * Free-function: gst_iterator_free 1422 * Returns: a new GstIterator of GstPad or NULL when the pad does not have an iterator function configured. Use gst_iterator_free() after usage. [transfer full] 1423 */ 1424 public Iterator iterateInternalLinks() 1425 { 1426 // GstIterator * gst_pad_iterate_internal_links (GstPad *pad); 1427 auto p = gst_pad_iterate_internal_links(gstPad); 1428 1429 if(p is null) 1430 { 1431 return null; 1432 } 1433 1434 return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p); 1435 } 1436 1437 /** 1438 * Iterate the list of pads to which the given pad is linked to inside of 1439 * the parent element. 1440 * This is the default handler, and thus returns an iterator of all of the 1441 * pads inside the parent element with opposite direction. 1442 * The caller must free this iterator after use with gst_iterator_free(). 1443 * Params: 1444 * parent = the parent of pad or NULL. [allow-none] 1445 * Returns: a GstIterator of GstPad, or NULL if pad has no parent. Unref each returned pad with gst_object_unref(). 1446 */ 1447 public Iterator iterateInternalLinksDefault(ObjectGst parent) 1448 { 1449 // GstIterator * gst_pad_iterate_internal_links_default (GstPad *pad, GstObject *parent); 1450 auto p = gst_pad_iterate_internal_links_default(gstPad, (parent is null) ? null : parent.getObjectGstStruct()); 1451 1452 if(p is null) 1453 { 1454 return null; 1455 } 1456 1457 return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p); 1458 } 1459 1460 /** 1461 * Set the given private data gpointer on the pad. 1462 * This function can only be used by the element that owns the pad. 1463 * No locking is performed in this function. 1464 * Params: 1465 * priv = The private data to attach to the pad. 1466 */ 1467 public void setElementPrivate(void* priv) 1468 { 1469 // void gst_pad_set_element_private (GstPad *pad, gpointer priv); 1470 gst_pad_set_element_private(gstPad, priv); 1471 } 1472 1473 /** 1474 * Gets the private data of a pad. 1475 * No locking is performed in this function. 1476 * Returns: a gpointer to the private data. [transfer none] 1477 */ 1478 public void* getElementPrivate() 1479 { 1480 // gpointer gst_pad_get_element_private (GstPad *pad); 1481 return gst_pad_get_element_private(gstPad); 1482 } 1483 1484 /** 1485 * Creates a stream-id for the source GstPad pad by combining the 1486 * upstream information with the optional stream_id of the stream 1487 * of pad. pad must have a parent GstElement and which must have zero 1488 * or one sinkpad. stream_id can only be NULL if the parent element 1489 * of pad has only a single source pad. 1490 * This function generates an unique stream-id by getting the upstream 1491 * stream-start event stream ID and appending stream_id to it. If the 1492 * element has no sinkpad it will generate an upstream stream-id by 1493 * doing an URI query on the element and in the worst case just uses 1494 * a random number. Source elements that don't implement the URI 1495 * handler interface should ideally generate a unique, deterministic 1496 * stream-id manually instead. 1497 * Since stream IDs are sorted alphabetically, any numbers in the 1498 * stream ID should be printed with a fixed number of characters, 1499 * preceded by 0's, such as by using the format %03u instead of %u. 1500 * Params: 1501 * parent = Parent GstElement of pad 1502 * streamId = The stream-id. [allow-none] 1503 * Returns: A stream-id for pad. g_free() after usage. 1504 */ 1505 public string createStreamId(Element parent, string streamId) 1506 { 1507 // gchar * gst_pad_create_stream_id (GstPad *pad, GstElement *parent, const gchar *stream_id); 1508 return Str.toString(gst_pad_create_stream_id(gstPad, (parent is null) ? null : parent.getElementStruct(), Str.toStringz(streamId))); 1509 } 1510 1511 /** 1512 * Creates a stream-id for the source GstPad pad by combining the 1513 * upstream information with the optional stream_id of the stream 1514 * of pad. pad must have a parent GstElement and which must have zero 1515 * or one sinkpad. stream_id can only be NULL if the parent element 1516 * of pad has only a single source pad. 1517 * This function generates an unique stream-id by getting the upstream 1518 * stream-start event stream ID and appending stream_id to it. If the 1519 * element has no sinkpad it will generate an upstream stream-id by 1520 * doing an URI query on the element and in the worst case just uses 1521 * a random number. Source elements that don't implement the URI 1522 * handler interface should ideally generate a unique, deterministic 1523 * stream-id manually instead. 1524 * Params: 1525 * parent = Parent GstElement of pad 1526 * streamId = The stream-id. [allow-none] 1527 * varArgs = parameters for the stream_id format string 1528 * Returns: A stream-id for pad. g_free() after usage. 1529 */ 1530 public string createStreamIdPrintfValist(Element parent, string streamId, void* varArgs) 1531 { 1532 // gchar * gst_pad_create_stream_id_printf_valist (GstPad *pad, GstElement *parent, const gchar *stream_id, va_list var_args); 1533 return Str.toString(gst_pad_create_stream_id_printf_valist(gstPad, (parent is null) ? null : parent.getElementStruct(), Str.toStringz(streamId), varArgs)); 1534 } 1535 1536 /** 1537 * Returns the current stream-id for the pad, or NULL if none has been 1538 * set yet, i.e. the pad has not received a stream-start event yet. 1539 * This is a convenience wrapper around gst_pad_get_sticky_event() and 1540 * gst_event_parse_stream_start(). 1541 * The returned stream-id string should be treated as an opaque string, its 1542 * contents should not be interpreted. 1543 * Since 1.2 1544 * Returns: a newly-allocated copy of the stream-idfor pad, or NULL. g_free() the returned string when no longer needed. 1545 */ 1546 public string getStreamId() 1547 { 1548 // gchar * gst_pad_get_stream_id (GstPad *pad); 1549 return Str.toString(gst_pad_get_stream_id(gstPad)); 1550 } 1551 1552 /** 1553 * Calls forward for all internally linked pads of pad. This function deals with 1554 * dynamically changing internal pads and will make sure that the forward 1555 * function is only called once for each pad. 1556 * When forward returns TRUE, no further pads will be processed. 1557 * Params: 1558 * forward = a GstPadForwardFunction. [scope call] 1559 * userData = user data passed to forward 1560 * Returns: TRUE if one of the dispatcher functions returned TRUE. 1561 */ 1562 public int forward(GstPadForwardFunction forward, void* userData) 1563 { 1564 // gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward, gpointer user_data); 1565 return gst_pad_forward(gstPad, forward, userData); 1566 } 1567 1568 /** 1569 * Chain a buffer to pad. 1570 * The function returns GST_FLOW_FLUSHING if the pad was flushing. 1571 * If the buffer type is not acceptable for pad (as negotiated with a 1572 * preceeding GST_EVENT_CAPS event), this function returns 1573 * GST_FLOW_NOT_NEGOTIATED. 1574 * The function proceeds calling the chain function installed on pad (see 1575 * gst_pad_set_chain_function()) and the return value of that function is 1576 * returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no 1577 * chain function. 1578 * In all cases, success or failure, the caller loses its reference to buffer 1579 * after calling this function. 1580 * Params: 1581 * buffer = the GstBuffer to send, return GST_FLOW_ERROR 1582 * if not. [transfer full] 1583 * Returns: a GstFlowReturn from the pad. MT safe. 1584 */ 1585 public GstFlowReturn chain(Buffer buffer) 1586 { 1587 // GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer); 1588 return gst_pad_chain(gstPad, (buffer is null) ? null : buffer.getBufferStruct()); 1589 } 1590 1591 /** 1592 * Chain a bufferlist to pad. 1593 * The function returns GST_FLOW_FLUSHING if the pad was flushing. 1594 * If pad was not negotiated properly with a CAPS event, this function 1595 * returns GST_FLOW_NOT_NEGOTIATED. 1596 * The function proceeds calling the chainlist function installed on pad (see 1597 * gst_pad_set_chain_list_function()) and the return value of that function is 1598 * returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no 1599 * chainlist function. 1600 * In all cases, success or failure, the caller loses its reference to list 1601 * after calling this function. 1602 * MT safe. 1603 * Params: 1604 * list = the GstBufferList to send, return GST_FLOW_ERROR 1605 * if not. [transfer full] 1606 * Returns: a GstFlowReturn from the pad. 1607 */ 1608 public GstFlowReturn chainList(BufferList list) 1609 { 1610 // GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list); 1611 return gst_pad_chain_list(gstPad, (list is null) ? null : list.getBufferListStruct()); 1612 } 1613 1614 /** 1615 * Starts a task that repeatedly calls func with user_data. This function 1616 * is mostly used in pad activation functions to start the dataflow. 1617 * The GST_PAD_STREAM_LOCK of pad will automatically be acquired 1618 * before func is called. 1619 * Params: 1620 * func = the task function to call 1621 * userData = user data passed to the task function 1622 * notify = called when user_data is no longer referenced 1623 * Returns: a TRUE if the task could be started. 1624 */ 1625 public int startTask(GstTaskFunction func, void* userData, GDestroyNotify notify) 1626 { 1627 // gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func, gpointer user_data, GDestroyNotify notify); 1628 return gst_pad_start_task(gstPad, func, userData, notify); 1629 } 1630 1631 /** 1632 * Pause the task of pad. This function will also wait until the 1633 * function executed by the task is finished if this function is not 1634 * called from the task function. 1635 * Returns: a TRUE if the task could be paused or FALSE when the pad has no task. 1636 */ 1637 public int pauseTask() 1638 { 1639 // gboolean gst_pad_pause_task (GstPad *pad); 1640 return gst_pad_pause_task(gstPad); 1641 } 1642 1643 /** 1644 * Stop the task of pad. This function will also make sure that the 1645 * function executed by the task will effectively stop if not called 1646 * from the GstTaskFunction. 1647 * This function will deadlock if called from the GstTaskFunction of 1648 * the task. Use gst_task_pause() instead. 1649 * Regardless of whether the pad has a task, the stream lock is acquired and 1650 * released so as to ensure that streaming through this pad has finished. 1651 * Returns: a TRUE if the task could be stopped or FALSE on error. 1652 */ 1653 public int stopTask() 1654 { 1655 // gboolean gst_pad_stop_task (GstPad *pad); 1656 return gst_pad_stop_task(gstPad); 1657 } 1658 1659 /** 1660 * Activates or deactivates the given pad. 1661 * Normally called from within core state change functions. 1662 * If active, makes sure the pad is active. If it is already active, either in 1663 * push or pull mode, just return. Otherwise dispatches to the pad's activate 1664 * function to perform the actual activation. 1665 * If not active, calls gst_pad_activate_mode() with the pad's current mode 1666 * and a FALSE argument. 1667 * Params: 1668 * active = whether or not the pad should be active. 1669 * Returns: TRUE if the operation was successful. MT safe. 1670 */ 1671 public int setActive(int active) 1672 { 1673 // gboolean gst_pad_set_active (GstPad *pad, gboolean active); 1674 return gst_pad_set_active(gstPad, active); 1675 } 1676 }