I've no idea here...
[gtkD.git] / gtkD / srcgstreamer / gstreamer / Pad.d
blob149c263dfdd07b10d1674f263eebf869c0978d9a
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 version(noAssert)
74 version(Tango)
76 import tango.io.Stdout; // use the tango loging?
80 private import gstreamerc.gstreamertypes;
82 private import gstreamerc.gstreamer;
85 private import glib.Str;
86 private import gstreamer.Element;
87 private import gstreamer.MiniObject;
88 private import gstreamer.PadTemplate;
89 private import gstreamer.Caps;
90 private import gstreamer.Buffer;
91 private import gstreamer.Event;
92 private import gstreamer.Query;
93 private import glib.ListG;
98 /**
99 * Description
100 * A GstElement is linked to other elements via "pads", which are extremely
101 * light-weight generic link points.
102 * After two pads are retrieved from an element with gst_element_get_pad(),
103 * the pads can be link with gst_pad_link(). (For quick links,
104 * you can also use gst_element_link(), which will make the obvious
105 * link for you if it's straightforward.)
106 * Pads are typically created from a GstPadTemplate with
107 * gst_pad_new_from_template().
108 * Pads have GstCaps attached to it to describe the media type they are
109 * capable of dealing with. gst_pad_get_caps() and gst_pad_set_caps() are
110 * used to manipulate the caps of the pads.
111 * Pads created from a pad template cannot set capabilities that are
112 * incompatible with the pad template capabilities.
113 * Pads without pad templates can be created with gst_pad_new(),
114 * which takes a direction and a name as an argument. If the name is NULL,
115 * then a guaranteed unique name will be assigned to it.
116 * gst_pad_get_parent() will retrieve the GstElement that owns the pad.
117 * A GstElement creating a pad will typically use the various
118 * gst_pad_set_*_function() calls to register callbacks for various events
119 * on the pads.
120 * GstElements will use gst_pad_push() and gst_pad_pull_range() to push out
121 * or pull in a buffer.
122 * To send a GstEvent on a pad, use gst_pad_send_event() and
123 * gst_pad_push_event().
124 * Last reviewed on 2006-07-06 (0.10.9)
126 private import gstreamer.ObjectGst;
127 public class Pad : ObjectGst
130 /** the main Gtk struct */
131 protected GstPad* gstPad;
134 public GstPad* getPadStruct()
136 return gstPad;
140 /** the main Gtk struct as a void* */
141 protected void* getStruct()
143 return cast(void*)gstPad;
147 * Sets our main struct and passes it to the parent class
149 public this (GstPad* gstPad)
151 version(noAssert)
153 if ( gstPad is null )
155 int zero = 0;
156 version(Tango)
158 Stdout("struct gstPad is null on constructor").newline;
160 else
162 printf("struct gstPad is null on constructor");
164 zero = zero / zero;
167 else
169 assert(gstPad !is null, "struct gstPad is null on constructor");
171 super(cast(GstObject*)gstPad);
172 this.gstPad = gstPad;
176 * Sets our main struct and passes it to the parent class.
177 * This one is additional to make gstreamer.Element addOnPadAdded()
178 * working without changes.
180 public this (GObject* gstPad)
182 super(cast(GstObject*)gstPad);
183 this.gstPad = cast(GstPad*) gstPad;
187 * Queries a pad for the stream position.
188 * This is a convenience function for gstreamerD.
189 * Returns:
190 * The current position in nanoseconds - GstFormat.TIME.
192 public long queryPosition()
194 GstFormat form = GstFormat.TIME;
195 long cur_pos;
196 queryPosition( &form, &cur_pos );
197 return cur_pos;
201 * Queries a pad for the stream duration.
202 * This is a convenience function for gstreamerD.
203 * Returns:
204 * The duration in nanoseconds - GstFormat.TIME.
206 public long queryDuration()
208 GstFormat form = GstFormat.TIME;
209 long cur_dur;
210 queryDuration( &form, &cur_dur );
211 return cur_dur;
218 // imports for the signal processing
219 private import gobject.Signals;
220 private import gtkc.gdktypes;
221 int[char[]] connectedSignals;
223 gboolean delegate(MiniObject, Pad)[] onHaveDataListeners;
224 void addOnHaveData(gboolean delegate(MiniObject, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
226 if ( !("have-data" in connectedSignals) )
228 Signals.connectData(
229 getStruct(),
230 "have-data",
231 cast(GCallback)&callBackHaveData,
232 cast(void*)this,
233 null,
234 connectFlags);
235 connectedSignals["have-data"] = 1;
237 onHaveDataListeners ~= dlg;
239 extern(C) static void callBackHaveData(GstPad* padStruct, GstMiniObject* miniObj, Pad pad)
241 bool consumed = false;
243 foreach ( gboolean delegate(MiniObject, Pad) dlg ; pad.onHaveDataListeners )
245 dlg(new MiniObject(miniObj), pad);
248 return consumed;
251 void delegate(Pad, Pad)[] onLinkedListeners;
252 void addOnLinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
254 if ( !("linked" in connectedSignals) )
256 Signals.connectData(
257 getStruct(),
258 "linked",
259 cast(GCallback)&callBackLinked,
260 cast(void*)this,
261 null,
262 connectFlags);
263 connectedSignals["linked"] = 1;
265 onLinkedListeners ~= dlg;
267 extern(C) static void callBackLinked(GstPad* padStruct, GstPad* peer, Pad pad)
269 bool consumed = false;
271 foreach ( void delegate(Pad, Pad) dlg ; pad.onLinkedListeners )
273 dlg(new Pad(peer), pad);
276 return consumed;
279 void delegate(Pad)[] onRequestLinkListeners;
280 void addOnRequestLink(void delegate(Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
282 if ( !("request-link" in connectedSignals) )
284 Signals.connectData(
285 getStruct(),
286 "request-link",
287 cast(GCallback)&callBackRequestLink,
288 cast(void*)this,
289 null,
290 connectFlags);
291 connectedSignals["request-link"] = 1;
293 onRequestLinkListeners ~= dlg;
295 extern(C) static void callBackRequestLink(GstPad* padStruct, Pad pad)
297 bool consumed = false;
299 foreach ( void delegate(Pad) dlg ; pad.onRequestLinkListeners )
301 dlg(pad);
304 return consumed;
307 void delegate(Pad, Pad)[] onUnlinkedListeners;
308 void addOnUnlinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
310 if ( !("unlinked" in connectedSignals) )
312 Signals.connectData(
313 getStruct(),
314 "unlinked",
315 cast(GCallback)&callBackUnlinked,
316 cast(void*)this,
317 null,
318 connectFlags);
319 connectedSignals["unlinked"] = 1;
321 onUnlinkedListeners ~= dlg;
323 extern(C) static void callBackUnlinked(GstPad* padStruct, GstPad* peer, Pad pad)
325 bool consumed = false;
327 foreach ( void delegate(Pad, Pad) dlg ; pad.onUnlinkedListeners )
329 dlg(new Pad(peer), pad);
332 return consumed;
346 * Gets the direction of the pad. The direction of the pad is
347 * decided at construction time so this function does not take
348 * the LOCK.
349 * pad:
350 * a GstPad to get the direction of.
351 * Returns:
352 * the GstPadDirection of the pad.
353 * MT safe.
355 public GstPadDirection getDirection()
357 // GstPadDirection gst_pad_get_direction (GstPad *pad);
358 return gst_pad_get_direction(gstPad);
363 * Gets the parent of pad, cast to a GstElement. If a pad has no parent or
364 * its parent is not an element, return NULL.
365 * pad:
366 * a pad
367 * Returns:
368 * The parent of the pad. The caller has a reference on the parent, so
369 * unref when you're finished with it.
370 * MT safe.
372 public Element getParentElement()
374 // GstElement* gst_pad_get_parent_element (GstPad *pad);
375 return new Element( gst_pad_get_parent_element(gstPad) );
379 * Gets the template for pad.
380 * pad:
381 * a GstPad.
382 * Returns:
383 * the GstPadTemplate from which this pad was instantiated, or NULL
384 * if this pad has no template.
385 * FIXME: currently returns an unrefcounted padtemplate.
387 public PadTemplate getPadTemplate()
389 // GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
390 return new PadTemplate( gst_pad_get_pad_template(gstPad) );
394 * Links the source pad and the sink pad.
395 * srcpad:
396 * the source GstPad to link.
397 * sinkpad:
398 * the sink GstPad to link.
399 * Returns:
400 * A result code indicating if the connection worked or
401 * what went wrong.
402 * MT Safe.
404 public GstPadLinkReturn link(Pad sinkpad)
406 // GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
407 return gst_pad_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
411 * Unlinks the source pad from the sink pad. Will emit the "unlinked" signal on
412 * both pads.
413 * srcpad:
414 * the source GstPad to unlink.
415 * sinkpad:
416 * the sink GstPad to unlink.
417 * Returns:
418 * TRUE if the pads were unlinked. This function returns FALSE if
419 * the pads were not linked together.
420 * MT safe.
422 public int unlink(Pad sinkpad)
424 // gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
425 return gst_pad_unlink(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
429 * Checks if a pad is linked to another pad or not.
430 * pad:
431 * pad to check
432 * Returns:
433 * TRUE if the pad is linked, FALSE otherwise.
434 * MT safe.
436 public int isLinked()
438 // gboolean gst_pad_is_linked (GstPad *pad);
439 return gst_pad_is_linked(gstPad);
443 * Checks if the source pad and the sink pad can be linked.
444 * Both srcpad and sinkpad must be unlinked.
445 * srcpad:
446 * the source GstPad to link.
447 * sinkpad:
448 * the sink GstPad to link.
449 * Returns:
450 * TRUE if the pads can be linked, FALSE otherwise.
452 public int canLink(Pad sinkpad)
454 // gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
455 return gst_pad_can_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
459 * Gets the capabilities this pad can produce or consume.
460 * Note that this method doesn't necessarily return the caps set by
461 * gst_pad_set_caps() - use GST_PAD_CAPS for that instead.
462 * gst_pad_get_caps returns all possible caps a pad can operate with, using
463 * the pad's get_caps function;
464 * this returns the pad template caps if not explicitly set.
465 * pad:
466 * a GstPad to get the capabilities of.
467 * Returns:
468 * a newly allocated copy of the GstCaps of this pad.
469 * MT safe.
471 public Caps getCaps()
473 // GstCaps* gst_pad_get_caps (GstPad *pad);
474 return new Caps( gst_pad_get_caps(gstPad) );
478 * Gets the capabilities of the allowed media types that can flow through
479 * pad and its peer.
480 * The allowed capabilities is calculated as the intersection of the results of
481 * calling gst_pad_get_caps() on pad and its peer. The caller owns a reference
482 * on the resulting caps.
483 * pad:
484 * a GstPad.
485 * Returns:
486 * the allowed GstCaps of the pad link. Unref the caps when you no
487 * longer need it. This function returns NULL when pad has no peer.
488 * MT safe.
490 public Caps getAllowedCaps()
492 // GstCaps* gst_pad_get_allowed_caps (GstPad *pad);
493 return new Caps( gst_pad_get_allowed_caps(gstPad) );
497 * Gets the capabilities of the media type that currently flows through pad
498 * and its peer.
499 * This function can be used on both src and sinkpads. Note that srcpads are
500 * always negotiated before sinkpads so it is possible that the negotiated caps
501 * on the srcpad do not match the negotiated caps of the peer.
502 * pad:
503 * a GstPad.
504 * Returns:
505 * the negotiated GstCaps of the pad link. Free the caps when
506 * you no longer need it. This function returns NULL when the pad has no
507 * peer or is not negotiated yet.
508 * MT safe.
510 public Caps getNegotiatedCaps()
512 // GstCaps* gst_pad_get_negotiated_caps (GstPad *pad);
513 return new Caps( gst_pad_get_negotiated_caps(gstPad) );
517 * Gets the capabilities for pad's template.
518 * pad:
519 * a GstPad to get the template capabilities from.
520 * Returns:
521 * the GstCaps of this pad template. If you intend to keep a reference
522 * on the caps, make a copy (see gst_caps_copy()).
524 public Caps getPadTemplateCaps()
526 // const GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
527 return new Caps( gst_pad_get_pad_template_caps(gstPad) );
531 * Sets the capabilities of this pad. The caps must be fixed. Any previous
532 * caps on the pad will be unreffed. This function refs the caps so you should
533 * unref if as soon as you don't need it anymore.
534 * It is possible to set NULL caps, which will make the pad unnegotiated
535 * again.
536 * pad:
537 * a GstPad to set the capabilities of.
538 * caps:
539 * a GstCaps to set.
540 * Returns:
541 * TRUE if the caps could be set. FALSE if the caps were not fixed
542 * or bad parameters were provided to this function.
543 * MT safe.
545 public int setCaps(Caps caps)
547 // gboolean gst_pad_set_caps (GstPad *pad, GstCaps *caps);
548 return gst_pad_set_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
552 * Gets the peer of pad. This function refs the peer pad so
553 * you need to unref it after use.
554 * pad:
555 * a GstPad to get the peer of.
556 * Returns:
557 * the peer GstPad. Unref after usage.
558 * MT safe.
560 public Pad getPeer()
562 // GstPad* gst_pad_get_peer (GstPad *pad);
563 return new Pad( gst_pad_get_peer(gstPad) );
567 * Gets the capabilities of the peer connected to this pad.
568 * pad:
569 * a GstPad to get the peer capabilities of.
570 * Returns:
571 * the GstCaps of the peer pad. This function returns a new caps, so use
572 * gst_caps_unref to get rid of it. this function returns NULL if there is no
573 * peer pad.
575 public Caps peerGetCaps()
577 // GstCaps* gst_pad_peer_get_caps (GstPad *pad);
578 return new Caps( gst_pad_peer_get_caps(gstPad) );
582 * A helper function you can use that sets the
583 * gst_pad_get_fixed_caps_func as the getcaps function for the
584 * pad. This way the function will always return the negotiated caps
585 * or in case the pad is not negotiated, the padtemplate caps.
586 * Use this function on a pad that, once _set_caps() has been called
587 * on it, cannot be renegotiated to something else.
588 * pad:
589 * the pad to use
591 public void useFixedCaps()
593 // void gst_pad_use_fixed_caps (GstPad *pad);
594 gst_pad_use_fixed_caps(gstPad);
598 * Query if a pad is active
599 * pad:
600 * the GstPad to query
601 * Returns:
602 * TRUE if the pad is active.
603 * MT safe.
605 public int isActive()
607 // gboolean gst_pad_is_active (GstPad *pad);
608 return gst_pad_is_active(gstPad);
612 * Blocks or unblocks the dataflow on a pad. This function is
613 * a shortcut for gst_pad_set_blocked_async() with a NULL
614 * callback.
615 * pad:
616 * the GstPad to block or unblock
617 * blocked:
618 * boolean indicating we should block or unblock
619 * Returns:
620 * TRUE if the pad could be blocked. This function can fail
621 * wrong parameters were passed or the pad was already in the
622 * requested state.
623 * MT safe.
625 public int setBlocked(int blocked)
627 // gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked);
628 return gst_pad_set_blocked(gstPad, blocked);
632 * Blocks or unblocks the dataflow on a pad. The provided callback
633 * is called when the operation succeeds; this happens right before the next
634 * attempt at pushing a buffer on the pad.
635 * This can take a while as the pad can only become blocked when real dataflow
636 * is happening.
637 * When the pipeline is stalled, for example in PAUSED, this can
638 * take an indeterminate amount of time.
639 * You can pass NULL as the callback to make this call block. Be careful with
640 * this blocking call as it might not return for reasons stated above.
641 * pad:
642 * the GstPad to block or unblock
643 * blocked:
644 * boolean indicating whether the pad should be blocked or unblocked
645 * callback:
646 * GstPadBlockCallback that will be called when the
647 * operation succeeds
648 * user_data:
649 * user data passed to the callback
650 * Returns:
651 * TRUE if the pad could be blocked. This function can fail
652 * if wrong parameters were passed or the pad was already in the
653 * requested state.
654 * MT safe.
656 public int setBlockedAsync(int blocked, GstPadBlockCallback callback, void* userData)
658 // gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked, GstPadBlockCallback callback, gpointer user_data);
659 return gst_pad_set_blocked_async(gstPad, blocked, callback, userData);
664 * Checks if the pad is blocked or not. This function returns the
665 * last requested state of the pad. It is not certain that the pad
666 * is actually blocking at this point (see gst_pad_is_blocking()).
667 * pad:
668 * the GstPad to query
669 * Returns:
670 * TRUE if the pad is blocked.
671 * MT safe.
673 public int isBlocked()
675 // gboolean gst_pad_is_blocked (GstPad *pad);
676 return gst_pad_is_blocked(gstPad);
680 * Checks if the pad is blocking or not. This is a guaranteed state
681 * of whether the pad is actually blocking on a GstBuffer or a GstEvent.
682 * pad:
683 * the GstPad to query
684 * Returns:
685 * TRUE if the pad is blocking.
686 * MT safe.
687 * Since 0.10.11
689 public int isBlocking()
691 // gboolean gst_pad_is_blocking (GstPad *pad);
692 return gst_pad_is_blocking(gstPad);
696 * Adds a "data probe" to a pad. This function will be called whenever data
697 * passes through a pad. In this case data means both events and buffers. The
698 * probe will be called with the data as an argument, meaning handler should
699 * have the same callback signature as the 'have-data' signal of GstPad.
700 * Note that the data will have a reference count greater than 1, so it will
701 * be immutable -- you must not change it.
702 * For source pads, the probe will be called after the blocking function, if any
703 * (see gst_pad_set_blocked_async()), but before looking up the peer to chain
704 * to. For sink pads, the probe function will be called before configuring the
705 * sink with new caps, if any, and before calling the pad's chain function.
706 * Your data probe should return TRUE to let the data continue to flow, or FALSE
707 * to drop it. Dropping data is rarely useful, but occasionally comes in handy
708 * with events.
709 * Although probes are implemented internally by connecting handler to the
710 * have-data signal on the pad, if you want to remove a probe it is insufficient
711 * to only call g_signal_handler_disconnect on the returned handler id. To
712 * remove a probe, use the appropriate function, such as
713 * gst_pad_remove_data_probe().
714 * pad:
715 * pad to add the data probe handler to
716 * handler:
717 * function to call when data is passed over pad
718 * data:
719 * data to pass along with the handler
720 * Returns:
721 * The handler id.
723 public uint addDataProbe(GCallback handler, void* data)
725 // gulong gst_pad_add_data_probe (GstPad *pad, GCallback handler, gpointer data);
726 return gst_pad_add_data_probe(gstPad, handler, data);
730 * Adds a probe that will be called for all buffers passing through a pad. See
731 * gst_pad_add_data_probe() for more information.
732 * pad:
733 * pad to add the buffer probe handler to
734 * handler:
735 * function to call when data is passed over pad
736 * data:
737 * data to pass along with the handler
738 * Returns:
739 * The handler id
741 public uint addBufferProbe(GCallback handler, void* data)
743 // gulong gst_pad_add_buffer_probe (GstPad *pad, GCallback handler, gpointer data);
744 return gst_pad_add_buffer_probe(gstPad, handler, data);
748 * Adds a probe that will be called for all events passing through a pad. See
749 * gst_pad_add_data_probe() for more information.
750 * pad:
751 * pad to add the event probe handler to
752 * handler:
753 * function to call when data is passed over pad
754 * data:
755 * data to pass along with the handler
756 * Returns:
757 * The handler id
759 public uint addEventProbe(GCallback handler, void* data)
761 // gulong gst_pad_add_event_probe (GstPad *pad, GCallback handler, gpointer data);
762 return gst_pad_add_event_probe(gstPad, handler, data);
766 * Removes a data probe from pad.
767 * pad:
768 * pad to remove the data probe handler from
769 * handler_id:
770 * handler id returned from gst_pad_add_data_probe
772 public void removeDataProbe(uint handlerId)
774 // void gst_pad_remove_data_probe (GstPad *pad, guint handler_id);
775 gst_pad_remove_data_probe(gstPad, handlerId);
779 * Removes a buffer probe from pad.
780 * pad:
781 * pad to remove the buffer probe handler from
782 * handler_id:
783 * handler id returned from gst_pad_add_buffer_probe
785 public void removeBufferProbe(uint handlerId)
787 // void gst_pad_remove_buffer_probe (GstPad *pad, guint handler_id);
788 gst_pad_remove_buffer_probe(gstPad, handlerId);
792 * Removes an event probe from pad.
793 * pad:
794 * pad to remove the event probe handler from
795 * handler_id:
796 * handler id returned from gst_pad_add_event_probe
798 public void removeEventProbe(uint handlerId)
800 // void gst_pad_remove_event_probe (GstPad *pad, guint handler_id);
801 gst_pad_remove_event_probe(gstPad, handlerId);
805 * Creates a new pad with the given name in the given direction.
806 * If name is NULL, a guaranteed unique name (across all pads)
807 * will be assigned.
808 * This function makes a copy of the name so you can safely free the name.
809 * name:
810 * the name of the new pad.
811 * direction:
812 * the GstPadDirection of the pad.
813 * Returns:
814 * a new GstPad, or NULL in case of an error.
815 * MT safe.
817 public this (char[] name, GstPadDirection direction)
819 // GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
820 this(cast(GstPad*)gst_pad_new(Str.toStringz(name), direction) );
824 * Creates a new pad with the given name from the given template.
825 * If name is NULL, a guaranteed unique name (across all pads)
826 * will be assigned.
827 * This function makes a copy of the name so you can safely free the name.
828 * templ:
829 * the pad template to use
830 * name:
831 * the name of the element
832 * Returns:
833 * a new GstPad, or NULL in case of an error.
835 public this (PadTemplate templ, char[] name)
837 // GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
838 this(cast(GstPad*)gst_pad_new_from_template((templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name)) );
842 * Creates a new pad with the given name from the given static template.
843 * If name is NULL, a guaranteed unique name (across all pads)
844 * will be assigned.
845 * This function makes a copy of the name so you can safely free the name.
846 * templ:
847 * the GstStaticPadTemplate to use
848 * name:
849 * the name of the element
850 * Returns:
851 * a new GstPad, or NULL in case of an error.
853 public this (GstStaticPadTemplate* templ, char[] name)
855 // GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
856 this(cast(GstPad*)gst_pad_new_from_static_template(templ, Str.toStringz(name)) );
860 * Allocates a new, empty buffer optimized to push to pad pad. This
861 * function only works if pad is a source pad and has a peer.
862 * A new, empty GstBuffer will be put in the buf argument.
863 * You need to check the caps of the buffer after performing this
864 * function and renegotiate to the format if needed.
865 * pad:
866 * a source GstPad
867 * offset:
868 * the offset of the new buffer in the stream
869 * size:
870 * the size of the new buffer
871 * caps:
872 * the caps of the new buffer
873 * buf:
874 * a newly allocated buffer
875 * Returns:
876 * a result code indicating success of the operation. Any
877 * result code other than GST_FLOW_OK is an error and buf should
878 * not be used.
879 * An error can occur if the pad is not connected or when the downstream
880 * peer elements cannot provide an acceptable buffer.
881 * MT safe.
883 public GstFlowReturn allocBuffer(ulong offset, int size, Caps caps, GstBuffer** buf)
885 // GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf);
886 return gst_pad_alloc_buffer(gstPad, offset, size, (caps is null) ? null : caps.getCapsStruct(), buf);
890 * In addition to the function gst_pad_alloc_buffer(), this function
891 * automatically calls gst_pad_set_caps() when the caps of the
892 * newly allocated buffer are different from the pad caps.
893 * pad:
894 * a source GstPad
895 * offset:
896 * the offset of the new buffer in the stream
897 * size:
898 * the size of the new buffer
899 * caps:
900 * the caps of the new buffer
901 * buf:
902 * a newly allocated buffer
903 * Returns:
904 * a result code indicating success of the operation. Any
905 * result code other than GST_FLOW_OK is an error and buf should
906 * not be used.
907 * An error can occur if the pad is not connected or when the downstream
908 * peer elements cannot provide an acceptable buffer.
909 * MT safe.
911 public GstFlowReturn allocBufferAndSetCaps(ulong offset, int size, Caps caps, GstBuffer** buf)
913 // GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size, GstCaps *caps, GstBuffer **buf);
914 return gst_pad_alloc_buffer_and_set_caps(gstPad, offset, size, (caps is null) ? null : caps.getCapsStruct(), buf);
918 * Sets the given bufferalloc function for the pad. Note that the
919 * bufferalloc function can only be set on sinkpads.
920 * pad:
921 * a sink GstPad.
922 * bufalloc:
923 * the GstPadBufferAllocFunction to set.
925 public void setBufferallocFunction(GstPadBufferAllocFunction bufalloc)
927 // void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc);
928 gst_pad_set_bufferalloc_function(gstPad, bufalloc);
933 * Sets the given chain function for the pad. The chain function is called to
934 * process a GstBuffer input buffer. see GstPadChainFunction for more details.
935 * pad:
936 * a sink GstPad.
937 * chain:
938 * the GstPadChainFunction to set.
940 public void setChainFunction(GstPadChainFunction chain)
942 // void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
943 gst_pad_set_chain_function(gstPad, chain);
948 * Sets the given checkgetrange function for the pad. Implement this function on
949 * a pad if you dynamically support getrange based scheduling on the pad.
950 * pad:
951 * a source GstPad.
952 * check:
953 * the GstPadCheckGetRangeFunction to set.
955 public void setCheckgetrangeFunction(GstPadCheckGetRangeFunction check)
957 // void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check);
958 gst_pad_set_checkgetrange_function(gstPad, check);
963 * When pad is flushing this function returns GST_FLOW_WRONG_STATE
964 * immediatly.
965 * Calls the getrange function of pad, see GstPadGetRangeFunction for a
966 * description of a getrange function. If pad has no getrange function
967 * installed (see gst_pad_set_getrange_function()) this function returns
968 * GST_FLOW_NOT_SUPPORTED.
969 * buffer's caps must either be unset or the same as what is already configured
970 * on pad. Renegotiation within a running pull-mode pipeline is not supported.
971 * pad:
972 * a src GstPad, returns GST_FLOW_ERROR if not.
973 * offset:
974 * The start offset of the buffer
975 * size:
976 * The length of the buffer
977 * buffer:
978 * a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if NULL.
979 * Returns:
980 * a GstFlowReturn from the pad.
981 * MT safe.
983 public GstFlowReturn getRange(ulong offset, uint size, GstBuffer** buffer)
985 // GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer);
986 return gst_pad_get_range(gstPad, offset, size, buffer);
990 * Sets the given getrange function for the pad. The getrange function is called to
991 * produce a new GstBuffer to start the processing pipeline. see
992 * GstPadGetRangeFunction for a description of the getrange function.
993 * pad:
994 * a source GstPad.
995 * get:
996 * the GstPadGetRangeFunction to set.
998 public void setGetrangeFunction(GstPadGetRangeFunction get)
1000 // void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get);
1001 gst_pad_set_getrange_function(gstPad, get);
1006 * Sets the given event handler for the pad.
1007 * pad:
1008 * a source GstPad.
1009 * event:
1010 * the GstPadEventFunction to set.
1012 public void setEventFunction(GstPadEventFunction event)
1014 // void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
1015 gst_pad_set_event_function(gstPad, event);
1020 * Sets the given link function for the pad. It will be called when
1021 * the pad is linked with another pad.
1022 * The return value GST_PAD_LINK_OK should be used when the connection can be
1023 * made.
1024 * The return value GST_PAD_LINK_REFUSED should be used when the connection
1025 * cannot be made for some reason.
1026 * If link is installed on a source pad, it should call the GstPadLinkFunction
1027 * of the peer sink pad, if present.
1028 * pad:
1029 * a GstPad.
1030 * link:
1031 * the GstPadLinkFunction to set.
1033 public void setLinkFunction(GstPadLinkFunction link)
1035 // void gst_pad_set_link_function (GstPad *pad, GstPadLinkFunction link);
1036 gst_pad_set_link_function(gstPad, link);
1041 * Sets the given unlink function for the pad. It will be called
1042 * when the pad is unlinked.
1043 * pad:
1044 * a GstPad.
1045 * unlink:
1046 * the GstPadUnlinkFunction to set.
1048 public void setUnlinkFunction(GstPadUnlinkFunction unlink)
1050 // void gst_pad_set_unlink_function (GstPad *pad, GstPadUnlinkFunction unlink);
1051 gst_pad_set_unlink_function(gstPad, unlink);
1056 * Check if the given pad accepts the caps.
1057 * pad:
1058 * a GstPad to check
1059 * caps:
1060 * a GstCaps to check on the pad
1061 * Returns:
1062 * TRUE if the pad can accept the caps.
1064 public int acceptCaps(Caps caps)
1066 // gboolean gst_pad_accept_caps (GstPad *pad, GstCaps *caps);
1067 return gst_pad_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1071 * Sets the given acceptcaps function for the pad. The acceptcaps function
1072 * will be called to check if the pad can accept the given caps. Setting the
1073 * acceptcaps function to NULL restores the default behaviour of allowing
1074 * any caps that matches the caps from gst_pad_get_caps.
1075 * pad:
1076 * a GstPad.
1077 * acceptcaps:
1078 * the GstPadAcceptCapsFunction to set.
1080 public void setAcceptcapsFunction(GstPadAcceptCapsFunction acceptcaps)
1082 // void gst_pad_set_acceptcaps_function (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
1083 gst_pad_set_acceptcaps_function(gstPad, acceptcaps);
1088 * Sets the given getcaps function for the pad. getcaps should return the
1089 * allowable caps for a pad in the context of the element's state, its link to
1090 * other elements, and the devices or files it has opened. These caps must be a
1091 * subset of the pad template caps. In the NULL state with no links, getcaps
1092 * should ideally return the same caps as the pad template. In rare
1093 * circumstances, an object property can affect the caps returned by getcaps,
1094 * but this is discouraged.
1095 * You do not need to call this function if pad's allowed caps are always the
1096 * same as the pad template caps. This can only be true if the padtemplate
1097 * has fixed simple caps.
1098 * For most filters, the caps returned by getcaps is directly affected by the
1099 * allowed caps on other pads. For demuxers and decoders, the caps returned by
1100 * the srcpad's getcaps function is directly related to the stream data. Again,
1101 * getcaps should return the most specific caps it reasonably can, since this
1102 * helps with autoplugging.
1103 * Note that the return value from getcaps is owned by the caller, so the caller
1104 * should unref the caps after usage.
1105 * pad:
1106 * a GstPad.
1107 * getcaps:
1108 * the GstPadGetCapsFunction to set.
1110 public void setGetcapsFunction(GstPadGetCapsFunction getcaps)
1112 // void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
1113 gst_pad_set_getcaps_function(gstPad, getcaps);
1118 * Calls gst_pad_get_allowed_caps() for every other pad belonging to the
1119 * same element as pad, and returns the intersection of the results.
1120 * This function is useful as a default getcaps function for an element
1121 * that can handle any stream format, but requires all its pads to have
1122 * the same caps. Two such elements are tee and aggregator.
1123 * pad:
1124 * a GstPad to proxy.
1125 * Returns:
1126 * the intersection of the other pads' allowed caps.
1128 public Caps proxyGetcaps()
1130 // GstCaps* gst_pad_proxy_getcaps (GstPad *pad);
1131 return new Caps( gst_pad_proxy_getcaps(gstPad) );
1135 * Sets the given setcaps function for the pad. The setcaps function
1136 * will be called whenever a buffer with a new media type is pushed or
1137 * pulled from the pad. The pad/element needs to update its internal
1138 * structures to process the new media type. If this new type is not
1139 * acceptable, the setcaps function should return FALSE.
1140 * pad:
1141 * a GstPad.
1142 * setcaps:
1143 * the GstPadSetCapsFunction to set.
1145 public void setSetcapsFunction(GstPadSetCapsFunction setcaps)
1147 // void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
1148 gst_pad_set_setcaps_function(gstPad, setcaps);
1153 * Calls gst_pad_set_caps() for every other pad belonging to the
1154 * same element as pad. If gst_pad_set_caps() fails on any pad,
1155 * the proxy setcaps fails. May be used only during negotiation.
1156 * pad:
1157 * a GstPad to proxy from
1158 * caps:
1159 * the GstCaps to link with
1160 * Returns:
1161 * TRUE if sucessful
1163 public int proxySetcaps(Caps caps)
1165 // gboolean gst_pad_proxy_setcaps (GstPad *pad, GstCaps *caps);
1166 return gst_pad_proxy_setcaps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1170 * Fixate a caps on the given pad. Modifies the caps in place, so you should
1171 * make sure that the caps are actually writable (see gst_caps_make_writable()).
1172 * pad:
1173 * a GstPad to fixate
1174 * caps:
1175 * the GstCaps to fixate
1177 public void fixateCaps(Caps caps)
1179 // void gst_pad_fixate_caps (GstPad *pad, GstCaps *caps);
1180 gst_pad_fixate_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1184 * Sets the given fixatecaps function for the pad. The fixatecaps function
1185 * will be called whenever the default values for a GstCaps needs to be
1186 * filled in.
1187 * pad:
1188 * a GstPad.
1189 * fixatecaps:
1190 * the GstPadFixateCapsFunction to set.
1192 public void setFixatecapsFunction(GstPadFixateCapsFunction fixatecaps)
1194 // void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
1195 gst_pad_set_fixatecaps_function(gstPad, fixatecaps);
1200 * A helper function you can use as a GetCaps function that
1201 * will return the currently negotiated caps or the padtemplate
1202 * when NULL.
1203 * pad:
1204 * the pad to use
1205 * Returns:
1206 * The currently negotiated caps or the padtemplate.
1208 public Caps getFixedCapsFunc()
1210 // GstCaps* gst_pad_get_fixed_caps_func (GstPad *pad);
1211 return new Caps( gst_pad_get_fixed_caps_func(gstPad) );
1215 * Check if the peer of pad accepts caps. If pad has no peer, this function
1216 * returns TRUE.
1217 * pad:
1218 * a GstPad to check the peer of
1219 * caps:
1220 * a GstCaps to check on the pad
1221 * Returns:
1222 * TRUE if the peer of pad can accept the caps or pad has no peer.
1224 public int peerAcceptCaps(Caps caps)
1226 // gboolean gst_pad_peer_accept_caps (GstPad *pad, GstCaps *caps);
1227 return gst_pad_peer_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct());
1231 * Sets the given activate function for pad. The activate function will
1232 * dispatch to gst_pad_activate_push() or gst_pad_activate_pull() to perform
1233 * the actual activation. Only makes sense to set on sink pads.
1234 * Call this function if your sink pad can start a pull-based task.
1235 * pad:
1236 * a GstPad.
1237 * activate:
1238 * the GstPadActivateFunction to set.
1240 public void setActivateFunction(GstPadActivateFunction activate)
1242 // void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activate);
1243 gst_pad_set_activate_function(gstPad, activate);
1248 * Sets the given activate_push function for the pad. An activate_push function
1249 * prepares the element for pushing. See XXX part-activation.txt for details.
1250 * pad:
1251 * a GstPad.
1252 * activatepush:
1253 * the GstPadActivateModeFunction to set.
1255 public void setActivatepushFunction(GstPadActivateModeFunction activatepush)
1257 // void gst_pad_set_activatepush_function (GstPad *pad, GstPadActivateModeFunction activatepush);
1258 gst_pad_set_activatepush_function(gstPad, activatepush);
1262 * Sets the given activate_pull function for the pad. An activate_pull function
1263 * prepares the element and any upstream connections for pulling. See XXX
1264 * part-activation.txt for details.
1265 * pad:
1266 * a GstPad.
1267 * activatepull:
1268 * the GstPadActivateModeFunction to set.
1270 public void setActivatepullFunction(GstPadActivateModeFunction activatepull)
1272 // void gst_pad_set_activatepull_function (GstPad *pad, GstPadActivateModeFunction activatepull);
1273 gst_pad_set_activatepull_function(gstPad, activatepull);
1278 * Pushes a buffer to the peer of pad.
1279 * This function will call an installed pad block before triggering any
1280 * installed pad probes.
1281 * If the caps on buffer are different from the currently configured caps on
1282 * pad, this function will call any installed setcaps function on pad (see
1283 * gst_pad_set_setcaps_function()). In case of failure to renegotiate the new
1284 * format, this function returns GST_FLOW_NOT_NEGOTIATED.
1285 * The function proceeds calling gst_pad_chain() on the peer pad and returns the
1286 * value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be
1287 * returned.
1288 * In all cases, success or failure, the caller loses its reference to buffer
1289 * after calling this function.
1290 * pad:
1291 * a source GstPad, returns GST_FLOW_ERROR if not.
1292 * buffer:
1293 * the GstBuffer to push returns GST_FLOW_ERROR if not.
1294 * Returns:
1295 * a GstFlowReturn from the peer pad.
1296 * MT safe.
1298 public GstFlowReturn push(Buffer buffer)
1300 // GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
1301 return gst_pad_push(gstPad, (buffer is null) ? null : buffer.getBufferStruct());
1305 * Sends the event to the peer of the given pad. This function is
1306 * mainly used by elements to send events to their peer
1307 * elements.
1308 * This function takes owership of the provided event so you should
1309 * gst_event_ref() it if you want to reuse the event after this call.
1310 * pad:
1311 * a GstPad to push the event to.
1312 * event:
1313 * the GstEvent to send to the pad.
1314 * Returns:
1315 * TRUE if the event was handled.
1316 * MT safe.
1318 public int pushEvent(Event event)
1320 // gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
1321 return gst_pad_push_event(gstPad, (event is null) ? null : event.getEventStruct());
1325 * Checks if a gst_pad_pull_range() can be performed on the peer
1326 * source pad. This function is used by plugins that want to check
1327 * if they can use random access on the peer source pad.
1328 * The peer sourcepad can implement a custom GstPadCheckGetRangeFunction
1329 * if it needs to perform some logic to determine if pull_range is
1330 * possible.
1331 * pad:
1332 * a sink GstPad.
1333 * Returns:
1334 * a gboolean with the result.
1335 * MT safe.
1337 public int checkPullRange()
1339 // gboolean gst_pad_check_pull_range (GstPad *pad);
1340 return gst_pad_check_pull_range(gstPad);
1344 * Pulls a buffer from the peer pad.
1345 * This function will first trigger the pad block signal if it was
1346 * installed.
1347 * When pad is not linked GST_FLOW_NOT_LINKED is returned else this
1348 * function returns the result of gst_pad_get_range() on the peer pad.
1349 * See gst_pad_get_range() for a list of return values and for the
1350 * semantics of the arguments of this function.
1351 * buffer's caps must either be unset or the same as what is already configured
1352 * on pad. Renegotiation within a running pull-mode pipeline is not supported.
1353 * pad:
1354 * a sink GstPad, returns GST_FLOW_ERROR if not.
1355 * offset:
1356 * The start offset of the buffer
1357 * size:
1358 * The length of the buffer
1359 * buffer:
1360 * a pointer to hold the GstBuffer, returns GST_FLOW_ERROR if NULL.
1361 * Returns:
1362 * a GstFlowReturn from the peer pad.
1363 * When this function returns GST_FLOW_OK, buffer will contain a valid
1364 * GstBuffer that should be freed with gst_buffer_unref() after usage.
1365 * buffer may not be used or freed when any other return value than
1366 * GST_FLOW_OK is returned.
1367 * MT safe.
1369 public GstFlowReturn pullRange(ulong offset, uint size, GstBuffer** buffer)
1371 // GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer);
1372 return gst_pad_pull_range(gstPad, offset, size, buffer);
1376 * Activates or deactivates the given pad in pull mode via dispatching to the
1377 * pad's activatepullfunc. For use from within pad activation functions only.
1378 * When called on sink pads, will first proxy the call to the peer pad, which is
1379 * expected to activate its internally linked pads from within its activate_pull
1380 * function.
1381 * If you don't know what this is, you probably don't want to call it.
1382 * pad:
1383 * the GstPad to activate or deactivate.
1384 * active:
1385 * whether or not the pad should be active.
1386 * Returns:
1387 * TRUE if the operation was successful.
1388 * MT safe.
1390 public int activatePull(int active)
1392 // gboolean gst_pad_activate_pull (GstPad *pad, gboolean active);
1393 return gst_pad_activate_pull(gstPad, active);
1397 * Activates or deactivates the given pad in push mode via dispatching to the
1398 * pad's activatepushfunc. For use from within pad activation functions only.
1399 * If you don't know what this is, you probably don't want to call it.
1400 * pad:
1401 * the GstPad to activate or deactivate.
1402 * active:
1403 * whether the pad should be active or not.
1404 * Returns:
1405 * TRUE if the operation was successful.
1406 * MT safe.
1408 public int activatePush(int active)
1410 // gboolean gst_pad_activate_push (GstPad *pad, gboolean active);
1411 return gst_pad_activate_push(gstPad, active);
1415 * Sends the event to the pad. This function can be used
1416 * by applications to send events in the pipeline.
1417 * If pad is a source pad, event should be an upstream event. If pad is a
1418 * sink pad, event should be a downstream event. For example, you would not
1419 * send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream.
1420 * Furthermore, some downstream events have to be serialized with data flow,
1421 * like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If
1422 * the event needs to be serialized with data flow, this function will take the
1423 * pad's stream lock while calling its event function.
1424 * To find out whether an event type is upstream, downstream, or downstream and
1425 * serialized, see GstEventTypeFlags, gst_event_type_get_flags(),
1426 * GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and
1427 * GST_EVENT_IS_SERIALIZED. Note that in practice that an application or plugin
1428 * doesn't need to bother itself with this information; the core handles all
1429 * necessary locks and checks.
1430 * This function takes owership of the provided event so you should
1431 * gst_event_ref() it if you want to reuse the event after this call.
1432 * pad:
1433 * a GstPad to send the event to.
1434 * event:
1435 * the GstEvent to send to the pad.
1436 * Returns:
1437 * TRUE if the event was handled.
1439 public int sendEvent(Event event)
1441 // gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
1442 return gst_pad_send_event(gstPad, (event is null) ? null : event.getEventStruct());
1446 * Invokes the default event handler for the given pad. End-of-stream and
1447 * discontinuity events are handled specially, and then the event is sent to all
1448 * pads internally linked to pad. Note that if there are many possible sink
1449 * pads that are internally linked to pad, only one will be sent an event.
1450 * Multi-sinkpad elements should implement custom event handlers.
1451 * pad:
1452 * a GstPad to call the default event handler on.
1453 * event:
1454 * the GstEvent to handle.
1455 * Returns:
1456 * TRUE if the event was sent succesfully.
1458 public int eventDefault(Event event)
1460 // gboolean gst_pad_event_default (GstPad *pad, GstEvent *event);
1461 return gst_pad_event_default(gstPad, (event is null) ? null : event.getEventStruct());
1465 * Dispatches a query to a pad. The query should have been allocated by the
1466 * caller via one of the type-specific allocation functions in gstquery.h. The
1467 * element is responsible for filling the query with an appropriate response,
1468 * which should then be parsed with a type-specific query parsing function.
1469 * Again, the caller is responsible for both the allocation and deallocation of
1470 * the query structure.
1471 * pad:
1472 * a GstPad to invoke the default query on.
1473 * query:
1474 * the GstQuery to perform.
1475 * Returns:
1476 * TRUE if the query could be performed.
1478 public int query(Query query)
1480 // gboolean gst_pad_query (GstPad *pad, GstQuery *query);
1481 return gst_pad_query(gstPad, (query is null) ? null : query.getQueryStruct());
1485 * Invokes the default query handler for the given pad.
1486 * The query is sent to all pads internally linked to pad. Note that
1487 * if there are many possible sink pads that are internally linked to
1488 * pad, only one will be sent the query.
1489 * Multi-sinkpad elements should implement custom query handlers.
1490 * pad:
1491 * a GstPad to call the default query handler on.
1492 * query:
1493 * the GstQuery to handle.
1494 * Returns:
1495 * TRUE if the query was performed succesfully.
1497 public int queryDefault(Query query)
1499 // gboolean gst_pad_query_default (GstPad *pad, GstQuery *query);
1500 return gst_pad_query_default(gstPad, (query is null) ? null : query.getQueryStruct());
1504 * Queries a pad for the stream position.
1505 * pad:
1506 * a GstPad to invoke the position query on.
1507 * format:
1508 * a pointer to the GstFormat asked for.
1509 * On return contains the GstFormat used.
1510 * cur:
1511 * A location in which to store the current position, or NULL.
1512 * Returns:
1513 * TRUE if the query could be performed.
1515 public int queryPosition(GstFormat* format, long* cur)
1517 // gboolean gst_pad_query_position (GstPad *pad, GstFormat *format, gint64 *cur);
1518 return gst_pad_query_position(gstPad, format, cur);
1522 * Queries a pad for the total stream duration.
1523 * pad:
1524 * a GstPad to invoke the duration query on.
1525 * format:
1526 * a pointer to the GstFormat asked for.
1527 * On return contains the GstFormat used.
1528 * duration:
1529 * A location in which to store the total duration, or NULL.
1530 * Returns:
1531 * TRUE if the query could be performed.
1533 public int queryDuration(GstFormat* format, long* duration)
1535 // gboolean gst_pad_query_duration (GstPad *pad, GstFormat *format, gint64 *duration);
1536 return gst_pad_query_duration(gstPad, format, duration);
1540 * Queries a pad to convert src_val in src_format to dest_format.
1541 * pad:
1542 * a GstPad to invoke the convert query on.
1543 * src_format:
1544 * a GstFormat to convert from.
1545 * src_val:
1546 * a value to convert.
1547 * dest_format:
1548 * a pointer to the GstFormat to convert to.
1549 * dest_val:
1550 * a pointer to the result.
1551 * Returns:
1552 * TRUE if the query could be performed.
1554 public int queryConvert(GstFormat srcFormat, long srcVal, GstFormat* destFormat, long* destVal)
1556 // gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val, GstFormat *dest_format, gint64 *dest_val);
1557 return gst_pad_query_convert(gstPad, srcFormat, srcVal, destFormat, destVal);
1561 * Queries the peer of a given sink pad for the stream position.
1562 * pad:
1563 * a GstPad on whose peer to invoke the position query on.
1564 * Must be a sink pad.
1565 * format:
1566 * a pointer to the GstFormat asked for.
1567 * On return contains the GstFormat used.
1568 * cur:
1569 * A location in which to store the current position, or NULL.
1570 * Returns:
1571 * TRUE if the query could be performed.
1573 public int queryPeerPosition(GstFormat* format, long* cur)
1575 // gboolean gst_pad_query_peer_position (GstPad *pad, GstFormat *format, gint64 *cur);
1576 return gst_pad_query_peer_position(gstPad, format, cur);
1580 * Queries the peer pad of a given sink pad for the total stream duration.
1581 * pad:
1582 * a GstPad on whose peer pad to invoke the duration query on.
1583 * Must be a sink pad.
1584 * format:
1585 * a pointer to the GstFormat asked for.
1586 * On return contains the GstFormat used.
1587 * duration:
1588 * A location in which to store the total duration, or NULL.
1589 * Returns:
1590 * TRUE if the query could be performed.
1592 public int queryPeerDuration(GstFormat* format, long* duration)
1594 // gboolean gst_pad_query_peer_duration (GstPad *pad, GstFormat *format, gint64 *duration);
1595 return gst_pad_query_peer_duration(gstPad, format, duration);
1599 * Queries the peer pad of a given sink pad to convert src_val in src_format
1600 * to dest_format.
1601 * pad:
1602 * a GstPad, on whose peer pad to invoke the convert query on.
1603 * Must be a sink pad.
1604 * src_format:
1605 * a GstFormat to convert from.
1606 * src_val:
1607 * a value to convert.
1608 * dest_format:
1609 * a pointer to the GstFormat to convert to.
1610 * dest_val:
1611 * a pointer to the result.
1612 * Returns:
1613 * TRUE if the query could be performed.
1615 public int queryPeerConvert(GstFormat srcFormat, long srcVal, GstFormat* destFormat, long* destVal)
1617 // gboolean gst_pad_query_peer_convert (GstPad *pad, GstFormat src_format, gint64 src_val, GstFormat *dest_format, gint64 *dest_val);
1618 return gst_pad_query_peer_convert(gstPad, srcFormat, srcVal, destFormat, destVal);
1622 * Set the given query function for the pad.
1623 * pad:
1624 * a GstPad of either direction.
1625 * query:
1626 * the GstPadQueryFunction to set.
1628 public void setQueryFunction(GstPadQueryFunction query)
1630 // void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
1631 gst_pad_set_query_function(gstPad, query);
1636 * Set the given query type function for the pad.
1637 * pad:
1638 * a GstPad of either direction.
1639 * type_func:
1640 * the GstPadQueryTypeFunction to set.
1642 public void setQueryTypeFunction(GstPadQueryTypeFunction typeFunc)
1644 // void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
1645 gst_pad_set_query_type_function(gstPad, typeFunc);
1650 * Get an array of supported queries that can be performed
1651 * on this pad.
1652 * pad:
1653 * a GstPad.
1654 * Returns:
1655 * a zero-terminated array of GstQueryType.
1657 public GstQueryType* getQueryTypes()
1659 // const GstQueryType* gst_pad_get_query_types (GstPad *pad);
1660 return gst_pad_get_query_types(gstPad);
1664 * Invoke the default dispatcher for the query types on
1665 * the pad.
1666 * pad:
1667 * a GstPad.
1668 * Returns:
1669 * an zero-terminated array of GstQueryType, or NULL if none of the
1670 * internally-linked pads has a query types function.
1672 public GstQueryType* getQueryTypesDefault()
1674 // const GstQueryType* gst_pad_get_query_types_default (GstPad *pad);
1675 return gst_pad_get_query_types_default(gstPad);
1679 * Sets the given internal link function for the pad.
1680 * pad:
1681 * a GstPad of either direction.
1682 * intlink:
1683 * the GstPadIntLinkFunction to set.
1685 public void setInternalLinkFunction(GstPadIntLinkFunction intlink)
1687 // void gst_pad_set_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink);
1688 gst_pad_set_internal_link_function(gstPad, intlink);
1693 * Gets a list of pads to which the given pad is linked to
1694 * inside of the parent element.
1695 * The caller must free this list after use.
1696 * pad:
1697 * the GstPad to get the internal links of.
1698 * Returns:
1699 * a newly allocated GList of pads.
1700 * Not MT safe.
1702 public ListG getInternalLinks()
1704 // GList* gst_pad_get_internal_links (GstPad *pad);
1705 return new ListG( gst_pad_get_internal_links(gstPad) );
1709 * Gets a list of pads to which the given pad is linked to
1710 * inside of the parent element.
1711 * This is the default handler, and thus returns a list of all of the
1712 * pads inside the parent element with opposite direction.
1713 * The caller must free this list after use.
1714 * pad:
1715 * the GstPad to get the internal links of.
1716 * Returns:
1717 * a newly allocated GList of pads, or NULL if the pad has no parent.
1718 * Not MT safe.
1720 public ListG getInternalLinksDefault()
1722 // GList* gst_pad_get_internal_links_default (GstPad *pad);
1723 return new ListG( gst_pad_get_internal_links_default(gstPad) );
1728 * Invokes the given dispatcher function on each respective peer of
1729 * all pads that are internally linked to the given pad.
1730 * The GstPadDispatcherFunction should return TRUE when no further pads
1731 * need to be processed.
1732 * pad:
1733 * a GstPad to dispatch.
1734 * dispatch:
1735 * the GstDispatcherFunction to call.
1736 * data:
1737 * gpointer user data passed to the dispatcher function.
1738 * Returns:
1739 * TRUE if one of the dispatcher functions returned TRUE.
1741 public int dispatcher(GstPadDispatcherFunction dispatch, void* data)
1743 // gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, gpointer data);
1744 return gst_pad_dispatcher(gstPad, dispatch, data);
1749 * Set the given private data gpointer on the pad.
1750 * This function can only be used by the element that owns the pad.
1751 * No locking is performed in this function.
1752 * pad:
1753 * the GstPad to set the private data of.
1754 * priv:
1755 * The private data to attach to the pad.
1757 public void setElementPrivate(void* priv)
1759 // void gst_pad_set_element_private (GstPad *pad, gpointer priv);
1760 gst_pad_set_element_private(gstPad, priv);
1764 * Gets the private data of a pad.
1765 * No locking is performed in this function.
1766 * pad:
1767 * the GstPad to get the private data of.
1768 * Returns:
1769 * a gpointer to the private data.
1771 public void* getElementPrivate()
1773 // gpointer gst_pad_get_element_private (GstPad *pad);
1774 return gst_pad_get_element_private(gstPad);
1778 * Chain a buffer to pad.
1779 * The function returns GST_FLOW_WRONG_STATE if the pad was flushing.
1780 * If the caps on buffer are different from the current caps on pad, this
1781 * function will call any setcaps function (see gst_pad_set_setcaps_function())
1782 * installed on pad. If the new caps are not acceptable for pad, this function
1783 * returns GST_FLOW_NOT_NEGOTIATED.
1784 * The function proceeds calling the chain function installed on pad (see
1785 * gst_pad_set_chain_function()) and the return value of that function is
1786 * returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no
1787 * chain function.
1788 * In all cases, success or failure, the caller loses its reference to buffer
1789 * after calling this function.
1790 * pad:
1791 * a sink GstPad, returns GST_FLOW_ERROR if not.
1792 * buffer:
1793 * the GstBuffer to send, return GST_FLOW_ERROR if not.
1794 * Returns:
1795 * a GstFlowReturn from the pad.
1796 * MT safe.
1798 public GstFlowReturn chain(Buffer buffer)
1800 // GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
1801 return gst_pad_chain(gstPad, (buffer is null) ? null : buffer.getBufferStruct());
1805 * Starts a task that repeatedly calls func with data. This function
1806 * is mostly used in pad activation functions to start the dataflow.
1807 * The GST_PAD_STREAM_LOCK of pad will automatically be acquired
1808 * before func is called.
1809 * pad:
1810 * the GstPad to start the task of
1811 * func:
1812 * the task function to call
1813 * data:
1814 * data passed to the task function
1815 * Returns:
1816 * a TRUE if the task could be started.
1818 public int startTask(GstTaskFunction func, void* data)
1820 // gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func, gpointer data);
1821 return gst_pad_start_task(gstPad, func, data);
1825 * Pause the task of pad. This function will also make sure that the
1826 * function executed by the task will effectively stop.
1827 * pad:
1828 * the GstPad to pause the task of
1829 * Returns:
1830 * a TRUE if the task could be paused or FALSE when the pad
1831 * has no task.
1833 public int pauseTask()
1835 // gboolean gst_pad_pause_task (GstPad *pad);
1836 return gst_pad_pause_task(gstPad);
1840 * Stop the task of pad. This function will also make sure that the
1841 * function executed by the task will effectively stop if not called
1842 * from the GstTaskFunction.
1843 * This function will deadlock if called from the GstTaskFunction of
1844 * the task. Use gst_task_pause() instead.
1845 * Regardless of whether the pad has a task, the stream lock is acquired and
1846 * released so as to ensure that streaming through this pad has finished.
1847 * pad:
1848 * the GstPad to stop the task of
1849 * Returns:
1850 * a TRUE if the task could be stopped or FALSE on error.
1852 public int stopTask()
1854 // gboolean gst_pad_stop_task (GstPad *pad);
1855 return gst_pad_stop_task(gstPad);
1859 * Activates or deactivates the given pad.
1860 * Normally called from within core state change functions.
1861 * If active, makes sure the pad is active. If it is already active, either in
1862 * push or pull mode, just return. Otherwise dispatches to the pad's activate
1863 * function to perform the actual activation.
1864 * If not active, checks the pad's current mode and calls
1865 * gst_pad_activate_push() or gst_pad_activate_pull(), as appropriate, with a
1866 * FALSE argument.
1867 * pad:
1868 * the GstPad to activate or deactivate.
1869 * active:
1870 * whether or not the pad should be active.
1871 * Returns:
1872 * TRUE if the operation was successful.
1873 * MT safe.
1875 public int setActive(int active)
1877 // gboolean gst_pad_set_active (GstPad *pad, gboolean active);
1878 return gst_pad_set_active(gstPad, active);