alternative to assert
[gtkD.git] / gtkD / srcgstreamer / gstreamer / Pad.d
blob3595df87e10f51e2ca18ceba9c13877c0569d14d
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GstPad.html
26 * outPack = gstreamer
27 * outFile = Pad
28 * strct = GstPad
29 * realStrct=
30 * ctorStrct=
31 * clss = Pad
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gst_pad_
40 * - gst_element_
41 * - gst_
42 * omit structs:
43 * omit prefixes:
44 * omit code:
45 * - gst_pad_load_and_link
46 * imports:
47 * - glib.Str
48 * - gstreamer.Element
49 * - gstreamer.MiniObject
50 * - gstreamer.PadTemplate
51 * - gstreamer.Caps
52 * - gstreamer.Buffer
53 * - gstreamer.Event
54 * - gstreamer.Query
55 * - glib.ListG
56 * structWrap:
57 * - GList* -> ListG
58 * - GstBuffer* -> Buffer
59 * - GstCaps* -> Caps
60 * - GstElement* -> Element
61 * - GstEvent* -> Event
62 * - GstMiniObject* -> MiniObject
63 * - GstPad* -> Pad
64 * - GstPadTemplate* -> PadTemplate
65 * - GstQuery* -> Query
66 * module aliases:
67 * local aliases:
70 module gstreamer.Pad;
72 private import gstreamerc.gstreamertypes;
74 private import gstreamerc.gstreamer;
76 private import glib.Str;
77 private import gstreamer.Element;
78 private import gstreamer.MiniObject;
79 private import gstreamer.PadTemplate;
80 private import gstreamer.Caps;
81 private import gstreamer.Buffer;
82 private import gstreamer.Event;
83 private import gstreamer.Query;
84 private import glib.ListG;
88 /**
89 * Description
90 * A GstElement is linked to other elements via "pads", which are extremely
91 * light-weight generic link points.
92 * After two pads are retrieved from an element with gst_element_get_pad(),
93 * the pads can be link with gst_pad_link(). (For quick links,
94 * you can also use gst_element_link(), which will make the obvious
95 * link for you if it's straightforward.)
96 * Pads are typically created from a GstPadTemplate with
97 * gst_pad_new_from_template().
98 * Pads have GstCaps attached to it to describe the media type they are
99 * capable of dealing with. gst_pad_get_caps() and gst_pad_set_caps() are
100 * used to manipulate the caps of the pads.
101 * Pads created from a pad template cannot set capabilities that are
102 * incompatible with the pad template capabilities.
103 * Pads without pad templates can be created with gst_pad_new(),
104 * which takes a direction and a name as an argument. If the name is NULL,
105 * then a guaranteed unique name will be assigned to it.
106 * gst_pad_get_parent() will retrieve the GstElement that owns the pad.
107 * A GstElement creating a pad will typically use the various
108 * gst_pad_set_*_function() calls to register callbacks for various events
109 * on the pads.
110 * GstElements will use gst_pad_push() and gst_pad_pull_range() to push out
111 * or pull in a buffer.
112 * To send a GstEvent on a pad, use gst_pad_send_event() and
113 * gst_pad_push_event().
114 * Last reviewed on 2006-07-06 (0.10.9)
116 private import gstreamer.ObjectGst;
117 public class Pad : ObjectGst
120 /** the main Gtk struct */
121 protected GstPad* gstPad;
124 public GstPad* getPadStruct()
126 return gstPad;
130 /** the main Gtk struct as a void* */
131 protected void* getStruct()
133 return cast(void*)gstPad;
137 * Sets our main struct and passes it to the parent class
139 public this (GstPad* gstPad)
141 super(cast(GstObject*)gstPad);
142 this.gstPad = gstPad;
146 * Sets our main struct and passes it to the parent class.
147 * This one is additional to make gstreamer.Element addOnPadAdded()
148 * working without changes.
150 public this (GObject* gstPad)
152 super(cast(GstObject*)gstPad);
153 this.gstPad = cast(GstPad*) gstPad;
157 * Queries a pad for the stream position.
158 * This is a convenience function for gstreamerD.
159 * Returns:
160 * The current position in nanoseconds - GstFormat.TIME.
162 public long queryPosition()
164 GstFormat form = GstFormat.TIME;
165 long cur_pos;
166 queryPosition( &form, &cur_pos );
167 return cur_pos;
171 * Queries a pad for the stream duration.
172 * This is a convenience function for gstreamerD.
173 * Returns:
174 * The duration in nanoseconds - GstFormat.TIME.
176 public long queryDuration()
178 GstFormat form = GstFormat.TIME;
179 long cur_dur;
180 queryDuration( &form, &cur_dur );
181 return cur_dur;
188 // imports for the signal processing
189 private import gobject.Signals;
190 private import gtkc.gdktypes;
191 int[char[]] connectedSignals;
193 gboolean delegate(MiniObject, Pad)[] onHaveDataListeners;
194 void addOnHaveData(gboolean delegate(MiniObject, Pad) dlg)
196 if ( !("have-data" in connectedSignals) )
198 Signals.connectData(
199 getStruct(),
200 "have-data",
201 cast(GCallback)&callBackHaveData,
202 cast(void*)this,
203 null,
204 cast(ConnectFlags)0);
205 connectedSignals["have-data"] = 1;
207 onHaveDataListeners ~= dlg;
209 extern(C) static void callBackHaveData(GstPad* padStruct, GstMiniObject* miniObj, Pad pad)
211 bit consumed = false;
213 foreach ( gboolean delegate(MiniObject, Pad) dlg ; pad.onHaveDataListeners )
215 dlg(new MiniObject(miniObj), pad);
218 return consumed;
221 void delegate(Pad, Pad)[] onLinkedListeners;
222 void addOnLinked(void delegate(Pad, Pad) dlg)
224 if ( !("linked" in connectedSignals) )
226 Signals.connectData(
227 getStruct(),
228 "linked",
229 cast(GCallback)&callBackLinked,
230 cast(void*)this,
231 null,
232 cast(ConnectFlags)0);
233 connectedSignals["linked"] = 1;
235 onLinkedListeners ~= dlg;
237 extern(C) static void callBackLinked(GstPad* padStruct, GstPad* peer, Pad pad)
239 bit consumed = false;
241 foreach ( void delegate(Pad, Pad) dlg ; pad.onLinkedListeners )
243 dlg(new Pad(peer), pad);
246 return consumed;
249 void delegate(Pad)[] onRequestLinkListeners;
250 void addOnRequestLink(void delegate(Pad) dlg)
252 if ( !("request-link" in connectedSignals) )
254 Signals.connectData(
255 getStruct(),
256 "request-link",
257 cast(GCallback)&callBackRequestLink,
258 cast(void*)this,
259 null,
260 cast(ConnectFlags)0);
261 connectedSignals["request-link"] = 1;
263 onRequestLinkListeners ~= dlg;
265 extern(C) static void callBackRequestLink(GstPad* padStruct, Pad pad)
267 bit consumed = false;
269 foreach ( void delegate(Pad) dlg ; pad.onRequestLinkListeners )
271 dlg(pad);
274 return consumed;
277 void delegate(Pad, Pad)[] onUnlinkedListeners;
278 void addOnUnlinked(void delegate(Pad, Pad) dlg)
280 if ( !("unlinked" in connectedSignals) )
282 Signals.connectData(
283 getStruct(),
284 "unlinked",
285 cast(GCallback)&callBackUnlinked,
286 cast(void*)this,
287 null,
288 cast(ConnectFlags)0);
289 connectedSignals["unlinked"] = 1;
291 onUnlinkedListeners ~= dlg;
293 extern(C) static void callBackUnlinked(GstPad* padStruct, GstPad* peer, Pad pad)
295 bit consumed = false;
297 foreach ( void delegate(Pad, Pad) dlg ; pad.onUnlinkedListeners )
299 dlg(new Pad(peer), pad);
302 return consumed;
316 * Gets the direction of the pad. The direction of the pad is
317 * decided at construction time so this function does not take
318 * the LOCK.
319 * pad:
320 * a GstPad to get the direction of.
321 * Returns:
322 * the GstPadDirection of the pad.
323 * MT safe.
325 public GstPadDirection getDirection()
327 // GstPadDirection gst_pad_get_direction (GstPad *pad);
328 return gst_pad_get_direction(gstPad);
333 * Gets the parent of pad, cast to a GstElement. If a pad has no parent or
334 * its parent is not an element, return NULL.
335 * pad:
336 * a pad
337 * Returns:
338 * The parent of the pad. The caller has a reference on the parent, so
339 * unref when you're finished with it.
340 * MT safe.
342 public Element getParentElement()
344 // GstElement* gst_pad_get_parent_element (GstPad *pad);
345 return new Element( gst_pad_get_parent_element(gstPad) );
349 * Gets the template for pad.
350 * pad:
351 * a GstPad.
352 * Returns:
353 * the GstPadTemplate from which this pad was instantiated, or NULL
354 * if this pad has no template.
355 * FIXME: currently returns an unrefcounted padtemplate.
357 public PadTemplate getPadTemplate()
359 // GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
360 return new PadTemplate( gst_pad_get_pad_template(gstPad) );
364 * Links the source pad and the sink pad.
365 * srcpad:
366 * the source GstPad to link.
367 * sinkpad:
368 * the sink GstPad to link.
369 * Returns:
370 * A result code indicating if the connection worked or
371 * what went wrong.
372 * MT Safe.
374 public GstPadLinkReturn link(Pad sinkpad)
376 // GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
377 return gst_pad_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
381 * Unlinks the source pad from the sink pad. Will emit the "unlinked" signal on
382 * both pads.
383 * srcpad:
384 * the source GstPad to unlink.
385 * sinkpad:
386 * the sink GstPad to unlink.
387 * Returns:
388 * TRUE if the pads were unlinked. This function returns FALSE if
389 * the pads were not linked together.
390 * MT safe.
392 public int unlink(Pad sinkpad)
394 // gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
395 return gst_pad_unlink(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
399 * Checks if a pad is linked to another pad or not.
400 * pad:
401 * pad to check
402 * Returns:
403 * TRUE if the pad is linked, FALSE otherwise.
404 * MT safe.
406 public int isLinked()
408 // gboolean gst_pad_is_linked (GstPad *pad);
409 return gst_pad_is_linked(gstPad);
413 * Checks if the source pad and the sink pad can be linked.
414 * Both srcpad and sinkpad must be unlinked.
415 * srcpad:
416 * the source GstPad to link.
417 * sinkpad:
418 * the sink GstPad to link.
419 * Returns:
420 * TRUE if the pads can be linked, FALSE otherwise.
422 public int canLink(Pad sinkpad)
424 // gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
425 return gst_pad_can_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
429 * Gets the capabilities this pad can produce or consume.
430 * Note that this method doesn't necessarily return the caps set by
431 * gst_pad_set_caps() - use GST_PAD_CAPS for that instead.
432 * gst_pad_get_caps returns all possible caps a pad can operate with, using
433 * the pad's get_caps function;
434 * this returns the pad template caps if not explicitly set.
435 * pad:
436 * a GstPad to get the capabilities of.
437 * Returns:
438 * a newly allocated copy of the GstCaps of this pad.
439 * MT safe.
441 public Caps getCaps()
443 // GstCaps* gst_pad_get_caps (GstPad *pad);
444 return new Caps( gst_pad_get_caps(gstPad) );
448 * Gets the capabilities of the allowed media types that can flow through
449 * pad and its peer.
450 * The allowed capabilities is calculated as the intersection of the results of
451 * calling gst_pad_get_caps() on pad and its peer. The caller owns a reference
452 * on the resulting caps.
453 * pad:
454 * a GstPad.
455 * Returns:
456 * the allowed GstCaps of the pad link. Unref the caps when you no
457 * longer need it. This function returns NULL when pad has no peer.
458 * MT safe.
460 public Caps getAllowedCaps()
462 // GstCaps* gst_pad_get_allowed_caps (GstPad *pad);
463 return new Caps( gst_pad_get_allowed_caps(gstPad) );
467 * Gets the capabilities of the media type that currently flows through pad
468 * and its peer.
469 * This function can be used on both src and sinkpads. Note that srcpads are
470 * always negotiated before sinkpads so it is possible that the negotiated caps
471 * on the srcpad do not match the negotiated caps of the peer.
472 * pad:
473 * a GstPad.
474 * Returns:
475 * the negotiated GstCaps of the pad link. Free the caps when
476 * you no longer need it. This function returns NULL when the pad has no
477 * peer or is not negotiated yet.
478 * MT safe.
480 public Caps getNegotiatedCaps()
482 // GstCaps* gst_pad_get_negotiated_caps (GstPad *pad);
483 return new Caps( gst_pad_get_negotiated_caps(gstPad) );
487 * Gets the capabilities for pad's template.
488 * pad:
489 * a GstPad to get the template capabilities from.
490 * Returns:
491 * the GstCaps of this pad template. If you intend to keep a reference
492 * on the caps, make a copy (see gst_caps_copy()).
494 public Caps getPadTemplateCaps()
496 // const GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
497 return new Caps( gst_pad_get_pad_template_caps(gstPad) );
501 * Sets the capabilities of this pad. The caps must be fixed. Any previous
502 * caps on the pad will be unreffed. This function refs the caps so you should
503 * unref if as soon as you don't need it anymore.
504 * It is possible to set NULL caps, which will make the pad unnegotiated
505 * again.
506 * pad:
507 * a GstPad to set the capabilities of.
508 * caps:
509 * a GstCaps to set.
510 * Returns:
511 * TRUE if the caps could be set. FALSE if the caps were not fixed
512 * or bad parameters were provided to this function.
513 * MT safe.
515 public int setCaps(Caps caps)
517 // gboolean gst_pad_set_caps (GstPad *pad, GstCaps *caps);
518 return gst_pad_set_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
522 * Gets the peer of pad. This function refs the peer pad so
523 * you need to unref it after use.
524 * pad:
525 * a GstPad to get the peer of.
526 * Returns:
527 * the peer GstPad. Unref after usage.
528 * MT safe.
530 public Pad getPeer()
532 // GstPad* gst_pad_get_peer (GstPad *pad);
533 return new Pad( gst_pad_get_peer(gstPad) );
537 * Gets the capabilities of the peer connected to this pad.
538 * pad:
539 * a GstPad to get the peer capabilities of.
540 * Returns:
541 * the GstCaps of the peer pad. This function returns a new caps, so use
542 * gst_caps_unref to get rid of it. this function returns NULL if there is no
543 * peer pad.
545 public Caps peerGetCaps()
547 // GstCaps* gst_pad_peer_get_caps (GstPad *pad);
548 return new Caps( gst_pad_peer_get_caps(gstPad) );
552 * A helper function you can use that sets the
553 * gst_pad_get_fixed_caps_func as the getcaps function for the
554 * pad. This way the function will always return the negotiated caps
555 * or in case the pad is not negotiated, the padtemplate caps.
556 * Use this function on a pad that, once _set_caps() has been called
557 * on it, cannot be renegotiated to something else.
558 * pad:
559 * the pad to use
561 public void useFixedCaps()
563 // void gst_pad_use_fixed_caps (GstPad *pad);
564 gst_pad_use_fixed_caps(gstPad);
568 * Query if a pad is active
569 * pad:
570 * the GstPad to query
571 * Returns:
572 * TRUE if the pad is active.
573 * MT safe.
575 public int isActive()
577 // gboolean gst_pad_is_active (GstPad *pad);
578 return gst_pad_is_active(gstPad);
582 * Blocks or unblocks the dataflow on a pad. This function is
583 * a shortcut for gst_pad_set_blocked_async() with a NULL
584 * callback.
585 * pad:
586 * the GstPad to block or unblock
587 * blocked:
588 * boolean indicating we should block or unblock
589 * Returns:
590 * TRUE if the pad could be blocked. This function can fail
591 * wrong parameters were passed or the pad was already in the
592 * requested state.
593 * MT safe.
595 public int setBlocked(int blocked)
597 // gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked);
598 return gst_pad_set_blocked(gstPad, blocked);
602 * Blocks or unblocks the dataflow on a pad. The provided callback
603 * is called when the operation succeeds; this happens right before the next
604 * attempt at pushing a buffer on the pad.
605 * This can take a while as the pad can only become blocked when real dataflow
606 * is happening.
607 * When the pipeline is stalled, for example in PAUSED, this can
608 * take an indeterminate amount of time.
609 * You can pass NULL as the callback to make this call block. Be careful with
610 * this blocking call as it might not return for reasons stated above.
611 * pad:
612 * the GstPad to block or unblock
613 * blocked:
614 * boolean indicating whether the pad should be blocked or unblocked
615 * callback:
616 * GstPadBlockCallback that will be called when the
617 * operation succeeds
618 * user_data:
619 * user data passed to the callback
620 * Returns:
621 * TRUE if the pad could be blocked. This function can fail
622 * if wrong parameters were passed or the pad was already in the
623 * requested state.
624 * MT safe.
626 public int setBlockedAsync(int blocked, GstPadBlockCallback callback, void* userData)
628 // gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data);
629 return gst_pad_set_blocked_async(gstPad, blocked, callback, userData);
634 * Checks if the pad is blocked or not. This function returns the
635 * last requested state of the pad. It is not certain that the pad
636 * is actually blocking at this point (see gst_pad_is_blocking()).
637 * pad:
638 * the GstPad to query
639 * Returns:
640 * TRUE if the pad is blocked.
641 * MT safe.
643 public int isBlocked()
645 // gboolean gst_pad_is_blocked (GstPad *pad);
646 return gst_pad_is_blocked(gstPad);
650 * Checks if the pad is blocking or not. This is a guaranteed state
651 * of whether the pad is actually blocking on a GstBuffer or a GstEvent.
652 * pad:
653 * the GstPad to query
654 * Returns:
655 * TRUE if the pad is blocking.
656 * MT safe.
657 * Since 0.10.11
659 public int isBlocking()
661 // gboolean gst_pad_is_blocking (GstPad *pad);
662 return gst_pad_is_blocking(gstPad);
666 * Adds a "data probe" to a pad. This function will be called whenever data
667 * passes through a pad. In this case data means both events and buffers. The
668 * probe will be called with the data as an argument, meaning handler should
669 * have the same callback signature as the 'have-data' signal of GstPad.
670 * Note that the data will have a reference count greater than 1, so it will
671 * be immutable -- you must not change it.
672 * For source pads, the probe will be called after the blocking function, if any
673 * (see gst_pad_set_blocked_async()), but before looking up the peer to chain
674 * to. For sink pads, the probe function will be called before configuring the
675 * sink with new caps, if any, and before calling the pad's chain function.
676 * Your data probe should return TRUE to let the data continue to flow, or FALSE
677 * to drop it. Dropping data is rarely useful, but occasionally comes in handy
678 * with events.
679 * Although probes are implemented internally by connecting handler to the
680 * have-data signal on the pad, if you want to remove a probe it is insufficient
681 * to only call g_signal_handler_disconnect on the returned handler id. To
682 * remove a probe, use the appropriate function, such as
683 * gst_pad_remove_data_probe().
684 * pad:
685 * pad to add the data probe handler to
686 * handler:
687 * function to call when data is passed over pad
688 * data:
689 * data to pass along with the handler
690 * Returns:
691 * The handler id.
693 public uint addDataProbe(GCallback handler, void* data)
695 // gulong gst_pad_add_data_probe (GstPad *pad, GCallback handler, gpointer data);
696 return gst_pad_add_data_probe(gstPad, handler, data);
700 * Adds a probe that will be called for all buffers passing through a pad. See
701 * gst_pad_add_data_probe() for more information.
702 * pad:
703 * pad to add the buffer probe handler to
704 * handler:
705 * function to call when data is passed over pad
706 * data:
707 * data to pass along with the handler
708 * Returns:
709 * The handler id
711 public uint addBufferProbe(GCallback handler, void* data)
713 // gulong gst_pad_add_buffer_probe (GstPad *pad, GCallback handler, gpointer data);
714 return gst_pad_add_buffer_probe(gstPad, handler, data);
718 * Adds a probe that will be called for all events passing through a pad. See
719 * gst_pad_add_data_probe() for more information.
720 * pad:
721 * pad to add the event probe handler to
722 * handler:
723 * function to call when data is passed over pad
724 * data:
725 * data to pass along with the handler
726 * Returns:
727 * The handler id
729 public uint addEventProbe(GCallback handler, void* data)
731 // gulong gst_pad_add_event_probe (GstPad *pad, GCallback handler, gpointer data);
732 return gst_pad_add_event_probe(gstPad, handler, data);
736 * Removes a data probe from pad.
737 * pad:
738 * pad to remove the data probe handler from
739 * handler_id:
740 * handler id returned from gst_pad_add_data_probe
742 public void removeDataProbe(uint handlerId)
744 // void gst_pad_remove_data_probe (GstPad *pad, guint handler_id);
745 gst_pad_remove_data_probe(gstPad, handlerId);
749 * Removes a buffer probe from pad.
750 * pad:
751 * pad to remove the buffer probe handler from
752 * handler_id:
753 * handler id returned from gst_pad_add_buffer_probe
755 public void removeBufferProbe(uint handlerId)
757 // void gst_pad_remove_buffer_probe (GstPad *pad, guint handler_id);
758 gst_pad_remove_buffer_probe(gstPad, handlerId);
762 * Removes an event probe from pad.
763 * pad:
764 * pad to remove the event probe handler from
765 * handler_id:
766 * handler id returned from gst_pad_add_event_probe
768 public void removeEventProbe(uint handlerId)
770 // void gst_pad_remove_event_probe (GstPad *pad, guint handler_id);
771 gst_pad_remove_event_probe(gstPad, handlerId);
775 * Creates a new pad with the given name in the given direction.
776 * If name is NULL, a guaranteed unique name (across all pads)
777 * will be assigned.
778 * This function makes a copy of the name so you can safely free the name.
779 * name:
780 * the name of the new pad.
781 * direction:
782 * the GstPadDirection of the pad.
783 * Returns:
784 * a new GstPad, or NULL in case of an error.
785 * MT safe.
787 public this (char[] name, GstPadDirection direction)
789 // GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
790 this(cast(GstPad*)gst_pad_new(Str.toStringz(name), direction) );
794 * Creates a new pad with the given name from the given template.
795 * If name is NULL, a guaranteed unique name (across all pads)
796 * will be assigned.
797 * This function makes a copy of the name so you can safely free the name.
798 * templ:
799 * the pad template to use
800 * name:
801 * the name of the element
802 * Returns:
803 * a new GstPad, or NULL in case of an error.
805 public this (PadTemplate templ, char[] name)
807 // GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
808 this(cast(GstPad*)gst_pad_new_from_template((templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name)) );
812 * Creates a new pad with the given name from the given static template.
813 * If name is NULL, a guaranteed unique name (across all pads)
814 * will be assigned.
815 * This function makes a copy of the name so you can safely free the name.
816 * templ:
817 * the GstStaticPadTemplate to use
818 * name:
819 * the name of the element
820 * Returns:
821 * a new GstPad, or NULL in case of an error.
823 public this (GstStaticPadTemplate* templ, char[] name)
825 // GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
826 this(cast(GstPad*)gst_pad_new_from_static_template(templ, Str.toStringz(name)) );
830 * Allocates a new, empty buffer optimized to push to pad pad. This
831 * function only works if pad is a source pad and has a peer.
832 * A new, empty GstBuffer will be put in the buf argument.
833 * You need to check the caps of the buffer after performing this
834 * function and renegotiate to the format if needed.
835 * pad:
836 * a source GstPad
837 * offset:
838 * the offset of the new buffer in the stream
839 * size:
840 * the size of the new buffer
841 * caps:
842 * the caps of the new buffer
843 * buf:
844 * a newly allocated buffer
845 * Returns:
846 * a result code indicating success of the operation. Any
847 * result code other than GST_FLOW_OK is an error and buf should
848 * not be used.
849 * An error can occur if the pad is not connected or when the downstream
850 * peer elements cannot provide an acceptable buffer.
851 * MT safe.
853 public GstFlowReturn allocBuffer(ulong offset, int size, Caps caps, GstBuffer** buf)
855 // GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf);
856 return gst_pad_alloc_buffer(gstPad, offset, size, (caps is null) ? null : caps.getCapsStruct(), buf);
860 * In addition to the function gst_pad_alloc_buffer(), this function
861 * automatically calls gst_pad_set_caps() when the caps of the
862 * newly allocated buffer are different from the pad caps.
863 * pad:
864 * a source GstPad
865 * offset:
866 * the offset of the new buffer in the stream
867 * size:
868 * the size of the new buffer
869 * caps:
870 * the caps of the new buffer
871 * buf:
872 * a newly allocated buffer
873 * Returns:
874 * a result code indicating success of the operation. Any
875 * result code other than GST_FLOW_OK is an error and buf should
876 * not be used.
877 * An error can occur if the pad is not connected or when the downstream
878 * peer elements cannot provide an acceptable buffer.
879 * MT safe.
881 public GstFlowReturn allocBufferAndSetCaps(ulong offset, int size, Caps caps, GstBuffer** buf)
883 // GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf);
884 return gst_pad_alloc_buffer_and_set_caps(gstPad, offset, size, (caps is null) ? null : caps.getCapsStruct(), buf);
888 * Sets the given bufferalloc function for the pad. Note that the
889 * bufferalloc function can only be set on sinkpads.
890 * pad:
891 * a sink GstPad.
892 * bufalloc:
893 * the GstPadBufferAllocFunction to set.
895 public void setBufferallocFunction(GstPadBufferAllocFunction bufalloc)
897 // void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc);
898 gst_pad_set_bufferalloc_function(gstPad, bufalloc);
903 * Sets the given chain function for the pad. The chain function is called to
904 * process a GstBuffer input buffer. see GstPadChainFunction for more details.
905 * pad:
906 * a sink GstPad.
907 * chain:
908 * the GstPadChainFunction to set.
910 public void setChainFunction(GstPadChainFunction chain)
912 // void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
913 gst_pad_set_chain_function(gstPad, chain);
918 * Sets the given checkgetrange function for the pad. Implement this function on
919 * a pad if you dynamically support getrange based scheduling on the pad.
920 * pad:
921 * a source GstPad.
922 * check:
923 * the GstPadCheckGetRangeFunction to set.
925 public void setCheckgetrangeFunction(GstPadCheckGetRangeFunction check)
927 // void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check);
928 gst_pad_set_checkgetrange_function(gstPad, check);
933 * When pad is flushing this function returns GST_FLOW_WRONG_STATE
934 * immediatly.
935 * Calls the getrange function of pad, see GstPadGetRangeFunction for a
936 * description of a getrange function. If pad has no getrange function
937 * installed (see gst_pad_set_getrange_function()) this function returns
938 * GST_FLOW_NOT_SUPPORTED.
939 * buffer's caps must either be unset or the same as what is already configured
940 * on pad. Renegotiation within a running pull-mode pipeline is not supported.
941 * pad:
942 * a src GstPad, returns GST_FLOW_ERROR if not.
943 * offset:
944 * The start offset of the buffer
945 * size:
946 * The length of the buffer
947 * buffer:
948 * a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if NULL.
949 * Returns:
950 * a GstFlowReturn from the pad.
951 * MT safe.
953 public GstFlowReturn getRange(ulong offset, uint size, GstBuffer** buffer)
955 // GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer);
956 return gst_pad_get_range(gstPad, offset, size, buffer);
960 * Sets the given getrange function for the pad. The getrange function is called to
961 * produce a new GstBuffer to start the processing pipeline. see
962 * GstPadGetRangeFunction for a description of the getrange function.
963 * pad:
964 * a source GstPad.
965 * get:
966 * the GstPadGetRangeFunction to set.
968 public void setGetrangeFunction(GstPadGetRangeFunction get)
970 // void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get);
971 gst_pad_set_getrange_function(gstPad, get);
976 * Sets the given event handler for the pad.
977 * pad:
978 * a source GstPad.
979 * event:
980 * the GstPadEventFunction to set.
982 public void setEventFunction(GstPadEventFunction event)
984 // void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
985 gst_pad_set_event_function(gstPad, event);
990 * Sets the given link function for the pad. It will be called when
991 * the pad is linked with another pad.
992 * The return value GST_PAD_LINK_OK should be used when the connection can be
993 * made.
994 * The return value GST_PAD_LINK_REFUSED should be used when the connection
995 * cannot be made for some reason.
996 * If link is installed on a source pad, it should call the GstPadLinkFunction
997 * of the peer sink pad, if present.
998 * pad:
999 * a GstPad.
1000 * link:
1001 * the GstPadLinkFunction to set.
1003 public void setLinkFunction(GstPadLinkFunction link)
1005 // void gst_pad_set_link_function (GstPad *pad, GstPadLinkFunction link);
1006 gst_pad_set_link_function(gstPad, link);
1011 * Sets the given unlink function for the pad. It will be called
1012 * when the pad is unlinked.
1013 * pad:
1014 * a GstPad.
1015 * unlink:
1016 * the GstPadUnlinkFunction to set.
1018 public void setUnlinkFunction(GstPadUnlinkFunction unlink)
1020 // void gst_pad_set_unlink_function (GstPad *pad, GstPadUnlinkFunction unlink);
1021 gst_pad_set_unlink_function(gstPad, unlink);
1026 * Check if the given pad accepts the caps.
1027 * pad:
1028 * a GstPad to check
1029 * caps:
1030 * a GstCaps to check on the pad
1031 * Returns:
1032 * TRUE if the pad can accept the caps.
1034 public int acceptCaps(Caps caps)
1036 // gboolean gst_pad_accept_caps (GstPad *pad, GstCaps *caps);
1037 return gst_pad_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1041 * Sets the given acceptcaps function for the pad. The acceptcaps function
1042 * will be called to check if the pad can accept the given caps. Setting the
1043 * acceptcaps function to NULL restores the default behaviour of allowing
1044 * any caps that matches the caps from gst_pad_get_caps.
1045 * pad:
1046 * a GstPad.
1047 * acceptcaps:
1048 * the GstPadAcceptCapsFunction to set.
1050 public void setAcceptcapsFunction(GstPadAcceptCapsFunction acceptcaps)
1052 // void gst_pad_set_acceptcaps_function (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
1053 gst_pad_set_acceptcaps_function(gstPad, acceptcaps);
1058 * Sets the given getcaps function for the pad. getcaps should return the
1059 * allowable caps for a pad in the context of the element's state, its link to
1060 * other elements, and the devices or files it has opened. These caps must be a
1061 * subset of the pad template caps. In the NULL state with no links, getcaps
1062 * should ideally return the same caps as the pad template. In rare
1063 * circumstances, an object property can affect the caps returned by getcaps,
1064 * but this is discouraged.
1065 * You do not need to call this function if pad's allowed caps are always the
1066 * same as the pad template caps. This can only be true if the padtemplate
1067 * has fixed simple caps.
1068 * For most filters, the caps returned by getcaps is directly affected by the
1069 * allowed caps on other pads. For demuxers and decoders, the caps returned by
1070 * the srcpad's getcaps function is directly related to the stream data. Again,
1071 * getcaps should return the most specific caps it reasonably can, since this
1072 * helps with autoplugging.
1073 * Note that the return value from getcaps is owned by the caller, so the caller
1074 * should unref the caps after usage.
1075 * pad:
1076 * a GstPad.
1077 * getcaps:
1078 * the GstPadGetCapsFunction to set.
1080 public void setGetcapsFunction(GstPadGetCapsFunction getcaps)
1082 // void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
1083 gst_pad_set_getcaps_function(gstPad, getcaps);
1088 * Calls gst_pad_get_allowed_caps() for every other pad belonging to the
1089 * same element as pad, and returns the intersection of the results.
1090 * This function is useful as a default getcaps function for an element
1091 * that can handle any stream format, but requires all its pads to have
1092 * the same caps. Two such elements are tee and aggregator.
1093 * pad:
1094 * a GstPad to proxy.
1095 * Returns:
1096 * the intersection of the other pads' allowed caps.
1098 public Caps proxyGetcaps()
1100 // GstCaps* gst_pad_proxy_getcaps (GstPad *pad);
1101 return new Caps( gst_pad_proxy_getcaps(gstPad) );
1105 * Sets the given setcaps function for the pad. The setcaps function
1106 * will be called whenever a buffer with a new media type is pushed or
1107 * pulled from the pad. The pad/element needs to update its internal
1108 * structures to process the new media type. If this new type is not
1109 * acceptable, the setcaps function should return FALSE.
1110 * pad:
1111 * a GstPad.
1112 * setcaps:
1113 * the GstPadSetCapsFunction to set.
1115 public void setSetcapsFunction(GstPadSetCapsFunction setcaps)
1117 // void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
1118 gst_pad_set_setcaps_function(gstPad, setcaps);
1123 * Calls gst_pad_set_caps() for every other pad belonging to the
1124 * same element as pad. If gst_pad_set_caps() fails on any pad,
1125 * the proxy setcaps fails. May be used only during negotiation.
1126 * pad:
1127 * a GstPad to proxy from
1128 * caps:
1129 * the GstCaps to link with
1130 * Returns:
1131 * TRUE if sucessful
1133 public int proxySetcaps(Caps caps)
1135 // gboolean gst_pad_proxy_setcaps (GstPad *pad, GstCaps *caps);
1136 return gst_pad_proxy_setcaps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1140 * Fixate a caps on the given pad. Modifies the caps in place, so you should
1141 * make sure that the caps are actually writable (see gst_caps_make_writable()).
1142 * pad:
1143 * a GstPad to fixate
1144 * caps:
1145 * the GstCaps to fixate
1147 public void fixateCaps(Caps caps)
1149 // void gst_pad_fixate_caps (GstPad *pad, GstCaps *caps);
1150 gst_pad_fixate_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1154 * Sets the given fixatecaps function for the pad. The fixatecaps function
1155 * will be called whenever the default values for a GstCaps needs to be
1156 * filled in.
1157 * pad:
1158 * a GstPad.
1159 * fixatecaps:
1160 * the GstPadFixateCapsFunction to set.
1162 public void setFixatecapsFunction(GstPadFixateCapsFunction fixatecaps)
1164 // void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
1165 gst_pad_set_fixatecaps_function(gstPad, fixatecaps);
1170 * A helper function you can use as a GetCaps function that
1171 * will return the currently negotiated caps or the padtemplate
1172 * when NULL.
1173 * pad:
1174 * the pad to use
1175 * Returns:
1176 * The currently negotiated caps or the padtemplate.
1178 public Caps getFixedCapsFunc()
1180 // GstCaps* gst_pad_get_fixed_caps_func (GstPad *pad);
1181 return new Caps( gst_pad_get_fixed_caps_func(gstPad) );
1185 * Check if the peer of pad accepts caps. If pad has no peer, this function
1186 * returns TRUE.
1187 * pad:
1188 * a GstPad to check the peer of
1189 * caps:
1190 * a GstCaps to check on the pad
1191 * Returns:
1192 * TRUE if the peer of pad can accept the caps or pad has no peer.
1194 public int peerAcceptCaps(Caps caps)
1196 // gboolean gst_pad_peer_accept_caps (GstPad *pad, GstCaps *caps);
1197 return gst_pad_peer_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1201 * Sets the given activate function for pad. The activate function will
1202 * dispatch to gst_pad_activate_push() or gst_pad_activate_pull() to perform
1203 * the actual activation. Only makes sense to set on sink pads.
1204 * Call this function if your sink pad can start a pull-based task.
1205 * pad:
1206 * a GstPad.
1207 * activate:
1208 * the GstPadActivateFunction to set.
1210 public void setActivateFunction(GstPadActivateFunction activate)
1212 // void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activate);
1213 gst_pad_set_activate_function(gstPad, activate);
1218 * Sets the given activate_push function for the pad. An activate_push function
1219 * prepares the element for pushing. See XXX part-activation.txt for details.
1220 * pad:
1221 * a GstPad.
1222 * activatepush:
1223 * the GstPadActivateModeFunction to set.
1225 public void setActivatepushFunction(GstPadActivateModeFunction activatepush)
1227 // void gst_pad_set_activatepush_function (GstPad *pad, GstPadActivateModeFunction activatepush);
1228 gst_pad_set_activatepush_function(gstPad, activatepush);
1232 * Sets the given activate_pull function for the pad. An activate_pull function
1233 * prepares the element and any upstream connections for pulling. See XXX
1234 * part-activation.txt for details.
1235 * pad:
1236 * a GstPad.
1237 * activatepull:
1238 * the GstPadActivateModeFunction to set.
1240 public void setActivatepullFunction(GstPadActivateModeFunction activatepull)
1242 // void gst_pad_set_activatepull_function (GstPad *pad, GstPadActivateModeFunction activatepull);
1243 gst_pad_set_activatepull_function(gstPad, activatepull);
1248 * Pushes a buffer to the peer of pad.
1249 * This function will call an installed pad block before triggering any
1250 * installed pad probes.
1251 * If the caps on buffer are different from the currently configured caps on
1252 * pad, this function will call any installed setcaps function on pad (see
1253 * gst_pad_set_setcaps_function()). In case of failure to renegotiate the new
1254 * format, this function returns GST_FLOW_NOT_NEGOTIATED.
1255 * The function proceeds calling gst_pad_chain() on the peer pad and returns the
1256 * value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be
1257 * returned.
1258 * In all cases, success or failure, the caller loses its reference to buffer
1259 * after calling this function.
1260 * pad:
1261 * a source GstPad, returns GST_FLOW_ERROR if not.
1262 * buffer:
1263 * the GstBuffer to push returns GST_FLOW_ERROR if not.
1264 * Returns:
1265 * a GstFlowReturn from the peer pad.
1266 * MT safe.
1268 public GstFlowReturn push(Buffer buffer)
1270 // GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
1271 return gst_pad_push(gstPad, (buffer is null) ? null : buffer.getBufferStruct());
1275 * Sends the event to the peer of the given pad. This function is
1276 * mainly used by elements to send events to their peer
1277 * elements.
1278 * This function takes owership of the provided event so you should
1279 * gst_event_ref() it if you want to reuse the event after this call.
1280 * pad:
1281 * a GstPad to push the event to.
1282 * event:
1283 * the GstEvent to send to the pad.
1284 * Returns:
1285 * TRUE if the event was handled.
1286 * MT safe.
1288 public int pushEvent(Event event)
1290 // gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
1291 return gst_pad_push_event(gstPad, (event is null) ? null : event.getEventStruct());
1295 * Checks if a gst_pad_pull_range() can be performed on the peer
1296 * source pad. This function is used by plugins that want to check
1297 * if they can use random access on the peer source pad.
1298 * The peer sourcepad can implement a custom GstPadCheckGetRangeFunction
1299 * if it needs to perform some logic to determine if pull_range is
1300 * possible.
1301 * pad:
1302 * a sink GstPad.
1303 * Returns:
1304 * a gboolean with the result.
1305 * MT safe.
1307 public int checkPullRange()
1309 // gboolean gst_pad_check_pull_range (GstPad *pad);
1310 return gst_pad_check_pull_range(gstPad);
1314 * Pulls a buffer from the peer pad.
1315 * This function will first trigger the pad block signal if it was
1316 * installed.
1317 * When pad is not linked GST_FLOW_NOT_LINKED is returned else this
1318 * function returns the result of gst_pad_get_range() on the peer pad.
1319 * See gst_pad_get_range() for a list of return values and for the
1320 * semantics of the arguments of this function.
1321 * buffer's caps must either be unset or the same as what is already configured
1322 * on pad. Renegotiation within a running pull-mode pipeline is not supported.
1323 * pad:
1324 * a sink GstPad, returns GST_FLOW_ERROR if not.
1325 * offset:
1326 * The start offset of the buffer
1327 * size:
1328 * The length of the buffer
1329 * buffer:
1330 * a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if NULL.
1331 * Returns:
1332 * a GstFlowReturn from the peer pad.
1333 * When this function returns GST_FLOW_OK, buffer will contain a valid
1334 * GstBuffer that should be freed with gst_buffer_unref() after usage.
1335 * buffer may not be used or freed when any other return value than
1336 * GST_FLOW_OK is returned.
1337 * MT safe.
1339 public GstFlowReturn pullRange(ulong offset, uint size, GstBuffer** buffer)
1341 // GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer);
1342 return gst_pad_pull_range(gstPad, offset, size, buffer);
1346 * Activates or deactivates the given pad in pull mode via dispatching to the
1347 * pad's activatepullfunc. For use from within pad activation functions only.
1348 * When called on sink pads, will first proxy the call to the peer pad, which is
1349 * expected to activate its internally linked pads from within its activate_pull
1350 * function.
1351 * If you don't know what this is, you probably don't want to call it.
1352 * pad:
1353 * the GstPad to activate or deactivate.
1354 * active:
1355 * whether or not the pad should be active.
1356 * Returns:
1357 * TRUE if the operation was successful.
1358 * MT safe.
1360 public int activatePull(int active)
1362 // gboolean gst_pad_activate_pull (GstPad *pad, gboolean active);
1363 return gst_pad_activate_pull(gstPad, active);
1367 * Activates or deactivates the given pad in push mode via dispatching to the
1368 * pad's activatepushfunc. For use from within pad activation functions only.
1369 * If you don't know what this is, you probably don't want to call it.
1370 * pad:
1371 * the GstPad to activate or deactivate.
1372 * active:
1373 * whether the pad should be active or not.
1374 * Returns:
1375 * TRUE if the operation was successful.
1376 * MT safe.
1378 public int activatePush(int active)
1380 // gboolean gst_pad_activate_push (GstPad *pad, gboolean active);
1381 return gst_pad_activate_push(gstPad, active);
1385 * Sends the event to the pad. This function can be used
1386 * by applications to send events in the pipeline.
1387 * If pad is a source pad, event should be an upstream event. If pad is a
1388 * sink pad, event should be a downstream event. For example, you would not
1389 * send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream.
1390 * Furthermore, some downstream events have to be serialized with data flow,
1391 * like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If
1392 * the event needs to be serialized with data flow, this function will take the
1393 * pad's stream lock while calling its event function.
1394 * To find out whether an event type is upstream, downstream, or downstream and
1395 * serialized, see GstEventTypeFlags, gst_event_type_get_flags(),
1396 * GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and
1397 * GST_EVENT_IS_SERIALIZED. Note that in practice that an application or plugin
1398 * doesn't need to bother itself with this information; the core handles all
1399 * necessary locks and checks.
1400 * This function takes owership of the provided event so you should
1401 * gst_event_ref() it if you want to reuse the event after this call.
1402 * pad:
1403 * a GstPad to send the event to.
1404 * event:
1405 * the GstEvent to send to the pad.
1406 * Returns:
1407 * TRUE if the event was handled.
1409 public int sendEvent(Event event)
1411 // gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
1412 return gst_pad_send_event(gstPad, (event is null) ? null : event.getEventStruct());
1416 * Invokes the default event handler for the given pad. End-of-stream and
1417 * discontinuity events are handled specially, and then the event is sent to all
1418 * pads internally linked to pad. Note that if there are many possible sink
1419 * pads that are internally linked to pad, only one will be sent an event.
1420 * Multi-sinkpad elements should implement custom event handlers.
1421 * pad:
1422 * a GstPad to call the default event handler on.
1423 * event:
1424 * the GstEvent to handle.
1425 * Returns:
1426 * TRUE if the event was sent succesfully.
1428 public int eventDefault(Event event)
1430 // gboolean gst_pad_event_default (GstPad *pad, GstEvent *event);
1431 return gst_pad_event_default(gstPad, (event is null) ? null : event.getEventStruct());
1435 * Dispatches a query to a pad. The query should have been allocated by the
1436 * caller via one of the type-specific allocation functions in gstquery.h. The
1437 * element is responsible for filling the query with an appropriate response,
1438 * which should then be parsed with a type-specific query parsing function.
1439 * Again, the caller is responsible for both the allocation and deallocation of
1440 * the query structure.
1441 * pad:
1442 * a GstPad to invoke the default query on.
1443 * query:
1444 * the GstQuery to perform.
1445 * Returns:
1446 * TRUE if the query could be performed.
1448 public int query(Query query)
1450 // gboolean gst_pad_query (GstPad *pad, GstQuery *query);
1451 return gst_pad_query(gstPad, (query is null) ? null : query.getQueryStruct());
1455 * Invokes the default query handler for the given pad.
1456 * The query is sent to all pads internally linked to pad. Note that
1457 * if there are many possible sink pads that are internally linked to
1458 * pad, only one will be sent the query.
1459 * Multi-sinkpad elements should implement custom query handlers.
1460 * pad:
1461 * a GstPad to call the default query handler on.
1462 * query:
1463 * the GstQuery to handle.
1464 * Returns:
1465 * TRUE if the query was performed succesfully.
1467 public int queryDefault(Query query)
1469 // gboolean gst_pad_query_default (GstPad *pad, GstQuery *query);
1470 return gst_pad_query_default(gstPad, (query is null) ? null : query.getQueryStruct());
1474 * Queries a pad for the stream position.
1475 * pad:
1476 * a GstPad to invoke the position query on.
1477 * format:
1478 * a pointer to the GstFormat asked for.
1479 * On return contains the GstFormat used.
1480 * cur:
1481 * A location in which to store the current position, or NULL.
1482 * Returns:
1483 * TRUE if the query could be performed.
1485 public int queryPosition(GstFormat* format, long* cur)
1487 // gboolean gst_pad_query_position (GstPad *pad, GstFormat *format, gint64 *cur);
1488 return gst_pad_query_position(gstPad, format, cur);
1492 * Queries a pad for the total stream duration.
1493 * pad:
1494 * a GstPad to invoke the duration query on.
1495 * format:
1496 * a pointer to the GstFormat asked for.
1497 * On return contains the GstFormat used.
1498 * duration:
1499 * A location in which to store the total duration, or NULL.
1500 * Returns:
1501 * TRUE if the query could be performed.
1503 public int queryDuration(GstFormat* format, long* duration)
1505 // gboolean gst_pad_query_duration (GstPad *pad, GstFormat *format, gint64 *duration);
1506 return gst_pad_query_duration(gstPad, format, duration);
1510 * Queries a pad to convert src_val in src_format to dest_format.
1511 * pad:
1512 * a GstPad to invoke the convert query on.
1513 * src_format:
1514 * a GstFormat to convert from.
1515 * src_val:
1516 * a value to convert.
1517 * dest_format:
1518 * a pointer to the GstFormat to convert to.
1519 * dest_val:
1520 * a pointer to the result.
1521 * Returns:
1522 * TRUE if the query could be performed.
1524 public int queryConvert(GstFormat srcFormat, long srcVal, GstFormat* destFormat, long* destVal)
1526 // gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val, GstFormat *dest_format, gint64 *dest_val);
1527 return gst_pad_query_convert(gstPad, srcFormat, srcVal, destFormat, destVal);
1531 * Queries the peer of a given sink pad for the stream position.
1532 * pad:
1533 * a GstPad on whose peer to invoke the position query on.
1534 * Must be a sink pad.
1535 * format:
1536 * a pointer to the GstFormat asked for.
1537 * On return contains the GstFormat used.
1538 * cur:
1539 * A location in which to store the current position, or NULL.
1540 * Returns:
1541 * TRUE if the query could be performed.
1543 public int queryPeerPosition(GstFormat* format, long* cur)
1545 // gboolean gst_pad_query_peer_position (GstPad *pad, GstFormat *format, gint64 *cur);
1546 return gst_pad_query_peer_position(gstPad, format, cur);
1550 * Queries the peer pad of a given sink pad for the total stream duration.
1551 * pad:
1552 * a GstPad on whose peer pad to invoke the duration query on.
1553 * Must be a sink pad.
1554 * format:
1555 * a pointer to the GstFormat asked for.
1556 * On return contains the GstFormat used.
1557 * duration:
1558 * A location in which to store the total duration, or NULL.
1559 * Returns:
1560 * TRUE if the query could be performed.
1562 public int queryPeerDuration(GstFormat* format, long* duration)
1564 // gboolean gst_pad_query_peer_duration (GstPad *pad, GstFormat *format, gint64 *duration);
1565 return gst_pad_query_peer_duration(gstPad, format, duration);
1569 * Queries the peer pad of a given sink pad to convert src_val in src_format
1570 * to dest_format.
1571 * pad:
1572 * a GstPad, on whose peer pad to invoke the convert query on.
1573 * Must be a sink pad.
1574 * src_format:
1575 * a GstFormat to convert from.
1576 * src_val:
1577 * a value to convert.
1578 * dest_format:
1579 * a pointer to the GstFormat to convert to.
1580 * dest_val:
1581 * a pointer to the result.
1582 * Returns:
1583 * TRUE if the query could be performed.
1585 public int queryPeerConvert(GstFormat srcFormat, long srcVal, GstFormat* destFormat, long* destVal)
1587 // gboolean gst_pad_query_peer_convert (GstPad *pad, GstFormat src_format, gint64 src_val, GstFormat *dest_format, gint64 *dest_val);
1588 return gst_pad_query_peer_convert(gstPad, srcFormat, srcVal, destFormat, destVal);
1592 * Set the given query function for the pad.
1593 * pad:
1594 * a GstPad of either direction.
1595 * query:
1596 * the GstPadQueryFunction to set.
1598 public void setQueryFunction(GstPadQueryFunction query)
1600 // void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
1601 gst_pad_set_query_function(gstPad, query);
1606 * Set the given query type function for the pad.
1607 * pad:
1608 * a GstPad of either direction.
1609 * type_func:
1610 * the GstPadQueryTypeFunction to set.
1612 public void setQueryTypeFunction(GstPadQueryTypeFunction typeFunc)
1614 // void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
1615 gst_pad_set_query_type_function(gstPad, typeFunc);
1620 * Get an array of supported queries that can be performed
1621 * on this pad.
1622 * pad:
1623 * a GstPad.
1624 * Returns:
1625 * a zero-terminated array of GstQueryType.
1627 public GstQueryType* getQueryTypes()
1629 // const GstQueryType* gst_pad_get_query_types (GstPad *pad);
1630 return gst_pad_get_query_types(gstPad);
1634 * Invoke the default dispatcher for the query types on
1635 * the pad.
1636 * pad:
1637 * a GstPad.
1638 * Returns:
1639 * an zero-terminated array of GstQueryType, or NULL if none of the
1640 * internally-linked pads has a query types function.
1642 public GstQueryType* getQueryTypesDefault()
1644 // const GstQueryType* gst_pad_get_query_types_default (GstPad *pad);
1645 return gst_pad_get_query_types_default(gstPad);
1649 * Sets the given internal link function for the pad.
1650 * pad:
1651 * a GstPad of either direction.
1652 * intlink:
1653 * the GstPadIntLinkFunction to set.
1655 public void setInternalLinkFunction(GstPadIntLinkFunction intlink)
1657 // void gst_pad_set_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink);
1658 gst_pad_set_internal_link_function(gstPad, intlink);
1663 * Gets a list of pads to which the given pad is linked to
1664 * inside of the parent element.
1665 * The caller must free this list after use.
1666 * pad:
1667 * the GstPad to get the internal links of.
1668 * Returns:
1669 * a newly allocated GList of pads.
1670 * Not MT safe.
1672 public ListG getInternalLinks()
1674 // GList* gst_pad_get_internal_links (GstPad *pad);
1675 return new ListG( gst_pad_get_internal_links(gstPad) );
1679 * Gets a list of pads to which the given pad is linked to
1680 * inside of the parent element.
1681 * This is the default handler, and thus returns a list of all of the
1682 * pads inside the parent element with opposite direction.
1683 * The caller must free this list after use.
1684 * pad:
1685 * the GstPad to get the internal links of.
1686 * Returns:
1687 * a newly allocated GList of pads, or NULL if the pad has no parent.
1688 * Not MT safe.
1690 public ListG getInternalLinksDefault()
1692 // GList* gst_pad_get_internal_links_default (GstPad *pad);
1693 return new ListG( gst_pad_get_internal_links_default(gstPad) );
1698 * Invokes the given dispatcher function on each respective peer of
1699 * all pads that are internally linked to the given pad.
1700 * The GstPadDispatcherFunction should return TRUE when no further pads
1701 * need to be processed.
1702 * pad:
1703 * a GstPad to dispatch.
1704 * dispatch:
1705 * the GstDispatcherFunction to call.
1706 * data:
1707 * gpointer user data passed to the dispatcher function.
1708 * Returns:
1709 * TRUE if one of the dispatcher functions returned TRUE.
1711 public int dispatcher(GstPadDispatcherFunction dispatch, void* data)
1713 // gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, gpointer data);
1714 return gst_pad_dispatcher(gstPad, dispatch, data);
1719 * Set the given private data gpointer on the pad.
1720 * This function can only be used by the element that owns the pad.
1721 * No locking is performed in this function.
1722 * pad:
1723 * the GstPad to set the private data of.
1724 * priv:
1725 * The private data to attach to the pad.
1727 public void setElementPrivate(void* priv)
1729 // void gst_pad_set_element_private (GstPad *pad, gpointer priv);
1730 gst_pad_set_element_private(gstPad, priv);
1734 * Gets the private data of a pad.
1735 * No locking is performed in this function.
1736 * pad:
1737 * the GstPad to get the private data of.
1738 * Returns:
1739 * a gpointer to the private data.
1741 public void* getElementPrivate()
1743 // gpointer gst_pad_get_element_private (GstPad *pad);
1744 return gst_pad_get_element_private(gstPad);
1748 * Chain a buffer to pad.
1749 * The function returns GST_FLOW_WRONG_STATE if the pad was flushing.
1750 * If the caps on buffer are different from the current caps on pad, this
1751 * function will call any setcaps function (see gst_pad_set_setcaps_function())
1752 * installed on pad. If the new caps are not acceptable for pad, this function
1753 * returns GST_FLOW_NOT_NEGOTIATED.
1754 * The function proceeds calling the chain function installed on pad (see
1755 * gst_pad_set_chain_function()) and the return value of that function is
1756 * returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no
1757 * chain function.
1758 * In all cases, success or failure, the caller loses its reference to buffer
1759 * after calling this function.
1760 * pad:
1761 * a sink GstPad, returns GST_FLOW_ERROR if not.
1762 * buffer:
1763 * the GstBuffer to send, return GST_FLOW_ERROR if not.
1764 * Returns:
1765 * a GstFlowReturn from the pad.
1766 * MT safe.
1768 public GstFlowReturn chain(Buffer buffer)
1770 // GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
1771 return gst_pad_chain(gstPad, (buffer is null) ? null : buffer.getBufferStruct());
1775 * Starts a task that repeatedly calls func with data. This function
1776 * is mostly used in pad activation functions to start the dataflow.
1777 * The GST_PAD_STREAM_LOCK of pad will automatically be acquired
1778 * before func is called.
1779 * pad:
1780 * the GstPad to start the task of
1781 * func:
1782 * the task function to call
1783 * data:
1784 * data passed to the task function
1785 * Returns:
1786 * a TRUE if the task could be started.
1788 public int startTask(GstTaskFunction func, void* data)
1790 // gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func, gpointer data);
1791 return gst_pad_start_task(gstPad, func, data);
1795 * Pause the task of pad. This function will also make sure that the
1796 * function executed by the task will effectively stop.
1797 * pad:
1798 * the GstPad to pause the task of
1799 * Returns:
1800 * a TRUE if the task could be paused or FALSE when the pad
1801 * has no task.
1803 public int pauseTask()
1805 // gboolean gst_pad_pause_task (GstPad *pad);
1806 return gst_pad_pause_task(gstPad);
1810 * Stop the task of pad. This function will also make sure that the
1811 * function executed by the task will effectively stop if not called
1812 * from the GstTaskFunction.
1813 * This function will deadlock if called from the GstTaskFunction of
1814 * the task. Use gst_task_pause() instead.
1815 * Regardless of whether the pad has a task, the stream lock is acquired and
1816 * released so as to ensure that streaming through this pad has finished.
1817 * pad:
1818 * the GstPad to stop the task of
1819 * Returns:
1820 * a TRUE if the task could be stopped or FALSE on error.
1822 public int stopTask()
1824 // gboolean gst_pad_stop_task (GstPad *pad);
1825 return gst_pad_stop_task(gstPad);
1829 * Activates or deactivates the given pad.
1830 * Normally called from within core state change functions.
1831 * If active, makes sure the pad is active. If it is already active, either in
1832 * push or pull mode, just return. Otherwise dispatches to the pad's activate
1833 * function to perform the actual activation.
1834 * If not active, checks the pad's current mode and calls
1835 * gst_pad_activate_push() or gst_pad_activate_pull(), as appropriate, with a
1836 * FALSE argument.
1837 * pad:
1838 * the GstPad to activate or deactivate.
1839 * active:
1840 * whether or not the pad should be active.
1841 * Returns:
1842 * TRUE if the operation was successful.
1843 * MT safe.
1845 public int setActive(int active)
1847 // gboolean gst_pad_set_active (GstPad *pad, gboolean active);
1848 return gst_pad_set_active(gstPad, active);