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