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.Element;
26 
27 private import glib.ErrorG;
28 private import glib.GException;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gobject.Type;
33 private import gstreamer.Bus;
34 private import gstreamer.Caps;
35 private import gstreamer.Clock;
36 private import gstreamer.Context;
37 private import gstreamer.ElementFactory;
38 private import gstreamer.Event;
39 private import gstreamer.Iterator;
40 private import gstreamer.Message;
41 private import gstreamer.ObjectGst;
42 private import gstreamer.Pad;
43 private import gstreamer.PadTemplate;
44 private import gstreamer.Plugin;
45 private import gstreamer.Query;
46 private import gstreamerc.gstreamer;
47 public  import gstreamerc.gstreamertypes;
48 public  import gtkc.gdktypes;
49 private import gtkc.gobject;
50 
51 
52 /**
53  * GstElement is the abstract base class needed to construct an element that
54  * can be used in a GStreamer pipeline. Please refer to the plugin writers
55  * guide for more information on creating #GstElement subclasses.
56  * 
57  * The name of a #GstElement can be get with gst_element_get_name() and set with
58  * gst_element_set_name().  For speed, GST_ELEMENT_NAME() can be used in the
59  * core when using the appropriate locking. Do not use this in plug-ins or
60  * applications in order to retain ABI compatibility.
61  * 
62  * Elements can have pads (of the type #GstPad).  These pads link to pads on
63  * other elements.  #GstBuffer flow between these linked pads.
64  * A #GstElement has a #GList of #GstPad structures for all their input (or sink)
65  * and output (or source) pads.
66  * Core and plug-in writers can add and remove pads with gst_element_add_pad()
67  * and gst_element_remove_pad().
68  * 
69  * An existing pad of an element can be retrieved by name with
70  * gst_element_get_static_pad(). A new dynamic pad can be created using
71  * gst_element_request_pad() with a #GstPadTemplate.
72  * An iterator of all pads can be retrieved with gst_element_iterate_pads().
73  * 
74  * Elements can be linked through their pads.
75  * If the link is straightforward, use the gst_element_link()
76  * convenience function to link two elements, or gst_element_link_many()
77  * for more elements in a row.
78  * Use gst_element_link_filtered() to link two elements constrained by
79  * a specified set of #GstCaps.
80  * For finer control, use gst_element_link_pads() and
81  * gst_element_link_pads_filtered() to specify the pads to link on
82  * each element by name.
83  * 
84  * Each element has a state (see #GstState).  You can get and set the state
85  * of an element with gst_element_get_state() and gst_element_set_state().
86  * Setting a state triggers a #GstStateChange. To get a string representation
87  * of a #GstState, use gst_element_state_get_name().
88  * 
89  * You can get and set a #GstClock on an element using gst_element_get_clock()
90  * and gst_element_set_clock().
91  * Some elements can provide a clock for the pipeline if
92  * the #GST_ELEMENT_FLAG_PROVIDE_CLOCK flag is set. With the
93  * gst_element_provide_clock() method one can retrieve the clock provided by
94  * such an element.
95  * Not all elements require a clock to operate correctly. If the
96  * #GST_ELEMENT_FLAG_REQUIRE_CLOCK() flag is set, a clock should be set on the
97  * element with gst_element_set_clock().
98  * 
99  * Note that clock selection and distribution is normally handled by the
100  * toplevel #GstPipeline so the clock functions are only to be used in very
101  * specific situations.
102  */
103 public class Element : ObjectGst
104 {
105 	/** the main Gtk struct */
106 	protected GstElement* gstElement;
107 
108 	/** Get the main Gtk struct */
109 	public GstElement* getElementStruct()
110 	{
111 		return gstElement;
112 	}
113 
114 	/** the main Gtk struct as a void* */
115 	protected override void* getStruct()
116 	{
117 		return cast(void*)gstElement;
118 	}
119 
120 	protected override void setStruct(GObject* obj)
121 	{
122 		gstElement = cast(GstElement*)obj;
123 		super.setStruct(obj);
124 	}
125 
126 	/**
127 	 * Sets our main struct and passes it to the parent class.
128 	 */
129 	public this (GstElement* gstElement, bool ownedRef = false)
130 	{
131 		this.gstElement = gstElement;
132 		super(cast(GstObject*)gstElement, ownedRef);
133 	}
134 
135 	/**
136 	 * Queries an element for the stream position.
137 	 * This is a convenience function for gstreamerD.
138 	 * Returns:
139 	 *  The current position in nanoseconds - GstFormat.TIME.
140 	 */
141 	public long queryPosition()
142 	{
143 		GstFormat form = GstFormat.TIME;
144 		long cur_pos;
145 		queryPosition( form, cur_pos );
146 		return cur_pos;
147 	}
148 	
149 	/**
150 	 * Queries an element for the stream duration.
151 	 * This is a convenience function for gstreamerD.
152 	 * Returns:
153 	 *  The duration in nanoseconds - GstFormat.TIME.
154 	 */
155 	public long queryDuration()
156 	{
157 		GstFormat form = GstFormat.TIME;
158 		long cur_dur;
159 		queryDuration( form, cur_dur );
160 		return cur_dur;
161 	}
162 	
163 	/**
164 	 *	This set's the filename for a filesrc element.
165 	 */
166 	public void location( string set )
167 	{
168 		//g_object_set( G_OBJECT(getElementStruct()), "location", set, NULL);
169 		setProperty("location", set);
170 	}
171 	
172 	/**
173 	 * Set the caps property of an Element.
174 	 */
175 	void caps( Caps cp )
176 	{
177 		g_object_set( getElementStruct(), Str.toStringz("caps"), cp.getCapsStruct(), null );
178 	}
179 	
180 	/**
181 	 * For your convenience in gstreamerD: you can seek to the
182 	 * position of the pipeline measured in time_nanoseconds.
183 	 */
184 	public int seek( long time_nanoseconds ) //gint64
185 	{
186 		return seek( 1.0, GstFormat.TIME, GstSeekFlags.FLUSH,
187 		GstSeekType.SET, time_nanoseconds,
188 		GstSeekType.NONE, GST_CLOCK_TIME_NONE);
189 	}
190 	
191 	/**
192 	 * Get's all the pads from an element in a Pad[].
193 	 */
194 	public Pad[] pads()
195 	{
196 		Pad[] result;
197 		GValue* pad = g_value_init(new GValue(), Type.fromName("GstPad"));
198 		GstIterator* iter = gst_element_iterate_pads(gstElement);
199 		
200 		while ( gst_iterator_next(iter, pad) == GstIteratorResult.OK )
201 		{
202 			result ~= new Pad(cast(GstPad*)g_value_get_object(pad));
203 			g_value_reset(pad);
204 		}
205 		
206 		g_value_unset(pad);
207 		
208 		return result;
209 	}
210 
211 	/**
212 	 */
213 
214 	public static GType getType()
215 	{
216 		return gst_element_get_type();
217 	}
218 
219 	/**
220 	 * Creates an element for handling the given URI.
221 	 *
222 	 * Params:
223 	 *     type = Whether to create a source or a sink
224 	 *     uri = URI to create an element for
225 	 *     elementname = Name of created element, can be %NULL.
226 	 *
227 	 * Return: a new element or %NULL if none could be created
228 	 *
229 	 * Throws: GException on failure.
230 	 */
231 	public static Element makeFromUri(GstURIType type, string uri, string elementname)
232 	{
233 		GError* err = null;
234 		
235 		auto p = gst_element_make_from_uri(type, Str.toStringz(uri), Str.toStringz(elementname), &err);
236 		
237 		if (err !is null)
238 		{
239 			throw new GException( new ErrorG(err) );
240 		}
241 		
242 		if(p is null)
243 		{
244 			return null;
245 		}
246 		
247 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
248 	}
249 
250 	/**
251 	 * Create a new elementfactory capable of instantiating objects of the
252 	 * @type and add the factory to @plugin.
253 	 *
254 	 * Params:
255 	 *     plugin = #GstPlugin to register the element with, or %NULL for
256 	 *         a static element.
257 	 *     name = name of elements of this type
258 	 *     rank = rank of element (higher rank means more importance when autoplugging)
259 	 *     type = GType of element to register
260 	 *
261 	 * Return: %TRUE, if the registering succeeded, %FALSE on error
262 	 */
263 	public static bool register(Plugin plugin, string name, uint rank, GType type)
264 	{
265 		return gst_element_register((plugin is null) ? null : plugin.getPluginStruct(), Str.toStringz(name), rank, type) != 0;
266 	}
267 
268 	/**
269 	 * Gets a string representing the given state change result.
270 	 *
271 	 * Params:
272 	 *     stateRet = a #GstStateChangeReturn to get the name of.
273 	 *
274 	 * Return: a string with the name of the state
275 	 *     result.
276 	 */
277 	public static string stateChangeReturnGetName(GstStateChangeReturn stateRet)
278 	{
279 		return Str.toString(gst_element_state_change_return_get_name(stateRet));
280 	}
281 
282 	/**
283 	 * Gets a string representing the given state.
284 	 *
285 	 * Params:
286 	 *     state = a #GstState to get the name of.
287 	 *
288 	 * Return: a string with the name of the state.
289 	 */
290 	public static string stateGetName(GstState state)
291 	{
292 		return Str.toString(gst_element_state_get_name(state));
293 	}
294 
295 	/**
296 	 * Abort the state change of the element. This function is used
297 	 * by elements that do asynchronous state changes and find out
298 	 * something is wrong.
299 	 *
300 	 * This function should be called with the STATE_LOCK held.
301 	 *
302 	 * MT safe.
303 	 */
304 	public void abortState()
305 	{
306 		gst_element_abort_state(gstElement);
307 	}
308 
309 	/**
310 	 * Adds a pad (link point) to @element. @pad's parent will be set to @element;
311 	 * see gst_object_set_parent() for refcounting information.
312 	 *
313 	 * Pads are not automatically activated so elements should perform the needed
314 	 * steps to activate the pad in case this pad is added in the PAUSED or PLAYING
315 	 * state. See gst_pad_set_active() for more information about activating pads.
316 	 *
317 	 * The pad and the element should be unlocked when calling this function.
318 	 *
319 	 * This function will emit the #GstElement::pad-added signal on the element.
320 	 *
321 	 * Params:
322 	 *     pad = the #GstPad to add to the element.
323 	 *
324 	 * Return: %TRUE if the pad could be added. This function can fail when
325 	 *     a pad with the same name already existed or the pad already had another
326 	 *     parent.
327 	 *
328 	 *     MT safe.
329 	 */
330 	public bool addPad(Pad pad)
331 	{
332 		return gst_element_add_pad(gstElement, (pad is null) ? null : pad.getPadStruct()) != 0;
333 	}
334 
335 	/**
336 	 * Perform @transition on @element.
337 	 *
338 	 * This function must be called with STATE_LOCK held and is mainly used
339 	 * internally.
340 	 *
341 	 * Params:
342 	 *     transition = the requested transition
343 	 *
344 	 * Return: the #GstStateChangeReturn of the state transition.
345 	 */
346 	public GstStateChangeReturn changeState(GstStateChange transition)
347 	{
348 		return gst_element_change_state(gstElement, transition);
349 	}
350 
351 	/**
352 	 * Commit the state change of the element and proceed to the next
353 	 * pending state if any. This function is used
354 	 * by elements that do asynchronous state changes.
355 	 * The core will normally call this method automatically when an
356 	 * element returned %GST_STATE_CHANGE_SUCCESS from the state change function.
357 	 *
358 	 * If after calling this method the element still has not reached
359 	 * the pending state, the next state change is performed.
360 	 *
361 	 * This method is used internally and should normally not be called by plugins
362 	 * or applications.
363 	 *
364 	 * Params:
365 	 *     ret = The previous state return value
366 	 *
367 	 * Return: The result of the commit state change.
368 	 *
369 	 *     MT safe.
370 	 */
371 	public GstStateChangeReturn continueState(GstStateChangeReturn ret)
372 	{
373 		return gst_element_continue_state(gstElement, ret);
374 	}
375 
376 	/**
377 	 * Creates a pad for each pad template that is always available.
378 	 * This function is only useful during object initialization of
379 	 * subclasses of #GstElement.
380 	 */
381 	public void createAllPads()
382 	{
383 		gst_element_create_all_pads(gstElement);
384 	}
385 
386 	/**
387 	 * Returns the base time of the element. The base time is the
388 	 * absolute time of the clock when this element was last put to
389 	 * PLAYING. Subtracting the base time from the clock time gives
390 	 * the running time of the element.
391 	 *
392 	 * Return: the base time of the element.
393 	 *
394 	 *     MT safe.
395 	 */
396 	public GstClockTime getBaseTime()
397 	{
398 		return gst_element_get_base_time(gstElement);
399 	}
400 
401 	/**
402 	 * Returns the bus of the element. Note that only a #GstPipeline will provide a
403 	 * bus for the application.
404 	 *
405 	 * Return: the element's #GstBus. unref after usage.
406 	 *
407 	 *     MT safe.
408 	 */
409 	public Bus getBus()
410 	{
411 		auto p = gst_element_get_bus(gstElement);
412 		
413 		if(p is null)
414 		{
415 			return null;
416 		}
417 		
418 		return ObjectG.getDObject!(Bus)(cast(GstBus*) p, true);
419 	}
420 
421 	/**
422 	 * Gets the currently configured clock of the element. This is the clock as was
423 	 * last set with gst_element_set_clock().
424 	 *
425 	 * Return: the #GstClock of the element. unref after usage.
426 	 *
427 	 *     MT safe.
428 	 */
429 	public Clock getClock()
430 	{
431 		auto p = gst_element_get_clock(gstElement);
432 		
433 		if(p is null)
434 		{
435 			return null;
436 		}
437 		
438 		return ObjectG.getDObject!(Clock)(cast(GstClock*) p, true);
439 	}
440 
441 	/**
442 	 * Looks for an unlinked pad to which the given pad can link. It is not
443 	 * guaranteed that linking the pads will work, though it should work in most
444 	 * cases.
445 	 *
446 	 * This function will first attempt to find a compatible unlinked ALWAYS pad,
447 	 * and if none can be found, it will request a compatible REQUEST pad by looking
448 	 * at the templates of @element.
449 	 *
450 	 * Params:
451 	 *     pad = the #GstPad to find a compatible one for.
452 	 *     caps = the #GstCaps to use as a filter.
453 	 *
454 	 * Return: the #GstPad to which a link
455 	 *     can be made, or %NULL if one cannot be found. gst_object_unref()
456 	 *     after usage.
457 	 */
458 	public Pad getCompatiblePad(Pad pad, Caps caps)
459 	{
460 		auto p = gst_element_get_compatible_pad(gstElement, (pad is null) ? null : pad.getPadStruct(), (caps is null) ? null : caps.getCapsStruct());
461 		
462 		if(p is null)
463 		{
464 			return null;
465 		}
466 		
467 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
468 	}
469 
470 	/**
471 	 * Retrieves a pad template from @element that is compatible with @compattempl.
472 	 * Pads from compatible templates can be linked together.
473 	 *
474 	 * Params:
475 	 *     compattempl = the #GstPadTemplate to find a compatible
476 	 *         template for
477 	 *
478 	 * Return: a compatible #GstPadTemplate,
479 	 *     or %NULL if none was found. No unreferencing is necessary.
480 	 */
481 	public PadTemplate getCompatiblePadTemplate(PadTemplate compattempl)
482 	{
483 		auto p = gst_element_get_compatible_pad_template(gstElement, (compattempl is null) ? null : compattempl.getPadTemplateStruct());
484 		
485 		if(p is null)
486 		{
487 			return null;
488 		}
489 		
490 		return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p);
491 	}
492 
493 	/**
494 	 * Retrieves the factory that was used to create this element.
495 	 *
496 	 * Return: the #GstElementFactory used for creating this
497 	 *     element. no refcounting is needed.
498 	 */
499 	public ElementFactory getFactory()
500 	{
501 		auto p = gst_element_get_factory(gstElement);
502 		
503 		if(p is null)
504 		{
505 			return null;
506 		}
507 		
508 		return ObjectG.getDObject!(ElementFactory)(cast(GstElementFactory*) p);
509 	}
510 
511 	/**
512 	 * Retrieves a pad from the element by name (e.g. "src_\%d"). This version only
513 	 * retrieves request pads. The pad should be released with
514 	 * gst_element_release_request_pad().
515 	 *
516 	 * This method is slower than manually getting the pad template and calling
517 	 * gst_element_request_pad() if the pads should have a specific name (e.g.
518 	 * @name is "src_1" instead of "src_%u").
519 	 *
520 	 * Params:
521 	 *     name = the name of the request #GstPad to retrieve.
522 	 *
523 	 * Return: requested #GstPad if found,
524 	 *     otherwise %NULL.  Release after usage.
525 	 */
526 	public Pad getRequestPad(string name)
527 	{
528 		auto p = gst_element_get_request_pad(gstElement, Str.toStringz(name));
529 		
530 		if(p is null)
531 		{
532 			return null;
533 		}
534 		
535 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
536 	}
537 
538 	/**
539 	 * Returns the start time of the element. The start time is the
540 	 * running time of the clock when this element was last put to PAUSED.
541 	 *
542 	 * Usually the start_time is managed by a toplevel element such as
543 	 * #GstPipeline.
544 	 *
545 	 * MT safe.
546 	 *
547 	 * Return: the start time of the element.
548 	 */
549 	public GstClockTime getStartTime()
550 	{
551 		return gst_element_get_start_time(gstElement);
552 	}
553 
554 	/**
555 	 * Gets the state of the element.
556 	 *
557 	 * For elements that performed an ASYNC state change, as reported by
558 	 * gst_element_set_state(), this function will block up to the
559 	 * specified timeout value for the state change to complete.
560 	 * If the element completes the state change or goes into
561 	 * an error, this function returns immediately with a return value of
562 	 * %GST_STATE_CHANGE_SUCCESS or %GST_STATE_CHANGE_FAILURE respectively.
563 	 *
564 	 * For elements that did not return %GST_STATE_CHANGE_ASYNC, this function
565 	 * returns the current and pending state immediately.
566 	 *
567 	 * This function returns %GST_STATE_CHANGE_NO_PREROLL if the element
568 	 * successfully changed its state but is not able to provide data yet.
569 	 * This mostly happens for live sources that only produce data in
570 	 * %GST_STATE_PLAYING. While the state change return is equivalent to
571 	 * %GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that
572 	 * some sink elements might not be able to complete their state change because
573 	 * an element is not producing data to complete the preroll. When setting the
574 	 * element to playing, the preroll will complete and playback will start.
575 	 *
576 	 * Params:
577 	 *     state = a pointer to #GstState to hold the state.
578 	 *         Can be %NULL.
579 	 *     pending = a pointer to #GstState to hold the pending
580 	 *         state. Can be %NULL.
581 	 *     timeout = a #GstClockTime to specify the timeout for an async
582 	 *         state change or %GST_CLOCK_TIME_NONE for infinite timeout.
583 	 *
584 	 * Return: %GST_STATE_CHANGE_SUCCESS if the element has no more pending state
585 	 *     and the last state change succeeded, %GST_STATE_CHANGE_ASYNC if the
586 	 *     element is still performing a state change or
587 	 *     %GST_STATE_CHANGE_FAILURE if the last state change failed.
588 	 *
589 	 *     MT safe.
590 	 */
591 	public GstStateChangeReturn getState(out GstState state, out GstState pending, GstClockTime timeout)
592 	{
593 		return gst_element_get_state(gstElement, &state, &pending, timeout);
594 	}
595 
596 	/**
597 	 * Retrieves a pad from @element by name. This version only retrieves
598 	 * already-existing (i.e. 'static') pads.
599 	 *
600 	 * Params:
601 	 *     name = the name of the static #GstPad to retrieve.
602 	 *
603 	 * Return: the requested #GstPad if
604 	 *     found, otherwise %NULL.  unref after usage.
605 	 *
606 	 *     MT safe.
607 	 */
608 	public Pad getStaticPad(string name)
609 	{
610 		auto p = gst_element_get_static_pad(gstElement, Str.toStringz(name));
611 		
612 		if(p is null)
613 		{
614 			return null;
615 		}
616 		
617 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
618 	}
619 
620 	/**
621 	 * Checks if the state of an element is locked.
622 	 * If the state of an element is locked, state changes of the parent don't
623 	 * affect the element.
624 	 * This way you can leave currently unused elements inside bins. Just lock their
625 	 * state before changing the state from #GST_STATE_NULL.
626 	 *
627 	 * MT safe.
628 	 *
629 	 * Return: %TRUE, if the element's state is locked.
630 	 */
631 	public bool isLockedState()
632 	{
633 		return gst_element_is_locked_state(gstElement) != 0;
634 	}
635 
636 	/**
637 	 * Retrieves an iterator of @element's pads. The iterator should
638 	 * be freed after usage. Also more specialized iterators exists such as
639 	 * gst_element_iterate_src_pads() or gst_element_iterate_sink_pads().
640 	 *
641 	 * The order of pads returned by the iterator will be the order in which
642 	 * the pads were added to the element.
643 	 *
644 	 * Return: the #GstIterator of #GstPad.
645 	 *
646 	 *     MT safe.
647 	 */
648 	public Iterator iteratePads()
649 	{
650 		auto p = gst_element_iterate_pads(gstElement);
651 		
652 		if(p is null)
653 		{
654 			return null;
655 		}
656 		
657 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p);
658 	}
659 
660 	/**
661 	 * Retrieves an iterator of @element's sink pads.
662 	 *
663 	 * The order of pads returned by the iterator will be the order in which
664 	 * the pads were added to the element.
665 	 *
666 	 * Return: the #GstIterator of #GstPad.
667 	 *
668 	 *     MT safe.
669 	 */
670 	public Iterator iterateSinkPads()
671 	{
672 		auto p = gst_element_iterate_sink_pads(gstElement);
673 		
674 		if(p is null)
675 		{
676 			return null;
677 		}
678 		
679 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p);
680 	}
681 
682 	/**
683 	 * Retrieves an iterator of @element's source pads.
684 	 *
685 	 * The order of pads returned by the iterator will be the order in which
686 	 * the pads were added to the element.
687 	 *
688 	 * Return: the #GstIterator of #GstPad.
689 	 *
690 	 *     MT safe.
691 	 */
692 	public Iterator iterateSrcPads()
693 	{
694 		auto p = gst_element_iterate_src_pads(gstElement);
695 		
696 		if(p is null)
697 		{
698 			return null;
699 		}
700 		
701 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p);
702 	}
703 
704 	/**
705 	 * Links @src to @dest. The link must be from source to
706 	 * destination; the other direction will not be tried. The function looks for
707 	 * existing pads that aren't linked yet. It will request new pads if necessary.
708 	 * Such pads need to be released manually when unlinking.
709 	 * If multiple links are possible, only one is established.
710 	 *
711 	 * Make sure you have added your elements to a bin or pipeline with
712 	 * gst_bin_add() before trying to link them.
713 	 *
714 	 * Params:
715 	 *     dest = the #GstElement containing the destination pad.
716 	 *
717 	 * Return: %TRUE if the elements could be linked, %FALSE otherwise.
718 	 */
719 	public bool link(Element dest)
720 	{
721 		return gst_element_link(gstElement, (dest is null) ? null : dest.getElementStruct()) != 0;
722 	}
723 
724 	/**
725 	 * Links @src to @dest using the given caps as filtercaps.
726 	 * The link must be from source to
727 	 * destination; the other direction will not be tried. The function looks for
728 	 * existing pads that aren't linked yet. It will request new pads if necessary.
729 	 * If multiple links are possible, only one is established.
730 	 *
731 	 * Make sure you have added your elements to a bin or pipeline with
732 	 * gst_bin_add() before trying to link them.
733 	 *
734 	 * Params:
735 	 *     dest = the #GstElement containing the destination pad.
736 	 *     filter = the #GstCaps to filter the link,
737 	 *         or %NULL for no filter.
738 	 *
739 	 * Return: %TRUE if the pads could be linked, %FALSE otherwise.
740 	 */
741 	public bool linkFiltered(Element dest, Caps filter)
742 	{
743 		return gst_element_link_filtered(gstElement, (dest is null) ? null : dest.getElementStruct(), (filter is null) ? null : filter.getCapsStruct()) != 0;
744 	}
745 
746 	/**
747 	 * Links the two named pads of the source and destination elements.
748 	 * Side effect is that if one of the pads has no parent, it becomes a
749 	 * child of the parent of the other element.  If they have different
750 	 * parents, the link fails.
751 	 *
752 	 * Params:
753 	 *     srcpadname = the name of the #GstPad in source element
754 	 *         or %NULL for any pad.
755 	 *     dest = the #GstElement containing the destination pad.
756 	 *     destpadname = the name of the #GstPad in destination element,
757 	 *         or %NULL for any pad.
758 	 *
759 	 * Return: %TRUE if the pads could be linked, %FALSE otherwise.
760 	 */
761 	public bool linkPads(string srcpadname, Element dest, string destpadname)
762 	{
763 		return gst_element_link_pads(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname)) != 0;
764 	}
765 
766 	/**
767 	 * Links the two named pads of the source and destination elements. Side effect
768 	 * is that if one of the pads has no parent, it becomes a child of the parent of
769 	 * the other element. If they have different parents, the link fails. If @caps
770 	 * is not %NULL, makes sure that the caps of the link is a subset of @caps.
771 	 *
772 	 * Params:
773 	 *     srcpadname = the name of the #GstPad in source element
774 	 *         or %NULL for any pad.
775 	 *     dest = the #GstElement containing the destination pad.
776 	 *     destpadname = the name of the #GstPad in destination element
777 	 *         or %NULL for any pad.
778 	 *     filter = the #GstCaps to filter the link,
779 	 *         or %NULL for no filter.
780 	 *
781 	 * Return: %TRUE if the pads could be linked, %FALSE otherwise.
782 	 */
783 	public bool linkPadsFiltered(string srcpadname, Element dest, string destpadname, Caps filter)
784 	{
785 		return gst_element_link_pads_filtered(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname), (filter is null) ? null : filter.getCapsStruct()) != 0;
786 	}
787 
788 	/**
789 	 * Links the two named pads of the source and destination elements.
790 	 * Side effect is that if one of the pads has no parent, it becomes a
791 	 * child of the parent of the other element.  If they have different
792 	 * parents, the link fails.
793 	 *
794 	 * Calling gst_element_link_pads_full() with @flags == %GST_PAD_LINK_CHECK_DEFAULT
795 	 * is the same as calling gst_element_link_pads() and the recommended way of
796 	 * linking pads with safety checks applied.
797 	 *
798 	 * This is a convenience function for gst_pad_link_full().
799 	 *
800 	 * Params:
801 	 *     srcpadname = the name of the #GstPad in source element
802 	 *         or %NULL for any pad.
803 	 *     dest = the #GstElement containing the destination pad.
804 	 *     destpadname = the name of the #GstPad in destination element,
805 	 *         or %NULL for any pad.
806 	 *     flags = the #GstPadLinkCheck to be performed when linking pads.
807 	 *
808 	 * Return: %TRUE if the pads could be linked, %FALSE otherwise.
809 	 */
810 	public bool linkPadsFull(string srcpadname, Element dest, string destpadname, GstPadLinkCheck flags)
811 	{
812 		return gst_element_link_pads_full(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname), flags) != 0;
813 	}
814 
815 	/**
816 	 * Brings the element to the lost state. The current state of the
817 	 * element is copied to the pending state so that any call to
818 	 * gst_element_get_state() will return %GST_STATE_CHANGE_ASYNC.
819 	 *
820 	 * An ASYNC_START message is posted. If the element was PLAYING, it will
821 	 * go to PAUSED. The element will be restored to its PLAYING state by
822 	 * the parent pipeline when it prerolls again.
823 	 *
824 	 * This is mostly used for elements that lost their preroll buffer
825 	 * in the %GST_STATE_PAUSED or %GST_STATE_PLAYING state after a flush,
826 	 * they will go to their pending state again when a new preroll buffer is
827 	 * queued. This function can only be called when the element is currently
828 	 * not in error or an async state change.
829 	 *
830 	 * This function is used internally and should normally not be called from
831 	 * plugins or applications.
832 	 */
833 	public void lostState()
834 	{
835 		gst_element_lost_state(gstElement);
836 	}
837 
838 	/**
839 	 * Post an error, warning or info message on the bus from inside an element.
840 	 *
841 	 * @type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or
842 	 * #GST_MESSAGE_INFO.
843 	 *
844 	 * MT safe.
845 	 *
846 	 * Params:
847 	 *     type = the #GstMessageType
848 	 *     domain = the GStreamer GError domain this message belongs to
849 	 *     code = the GError code belonging to the domain
850 	 *     text = an allocated text string to be used
851 	 *         as a replacement for the default message connected to code,
852 	 *         or %NULL
853 	 *     dbg = an allocated debug message to be
854 	 *         used as a replacement for the default debugging information,
855 	 *         or %NULL
856 	 *     file = the source code file where the error was generated
857 	 *     funct = the source code function where the error was generated
858 	 *     line = the source code line where the error was generated
859 	 */
860 	public void messageFull(GstMessageType type, GQuark domain, int code, string text, string dbg, string file, string funct, int line)
861 	{
862 		gst_element_message_full(gstElement, type, domain, code, Str.toStringz(text), Str.toStringz(dbg), Str.toStringz(file), Str.toStringz(funct), line);
863 	}
864 
865 	/**
866 	 * Use this function to signal that the element does not expect any more pads
867 	 * to show up in the current pipeline. This function should be called whenever
868 	 * pads have been added by the element itself. Elements with #GST_PAD_SOMETIMES
869 	 * pad templates use this in combination with autopluggers to figure out that
870 	 * the element is done initializing its pads.
871 	 *
872 	 * This function emits the #GstElement::no-more-pads signal.
873 	 *
874 	 * MT safe.
875 	 */
876 	public void noMorePads()
877 	{
878 		gst_element_no_more_pads(gstElement);
879 	}
880 
881 	/**
882 	 * Post a message on the element's #GstBus. This function takes ownership of the
883 	 * message; if you want to access the message after this call, you should add an
884 	 * additional reference before calling.
885 	 *
886 	 * Params:
887 	 *     message = a #GstMessage to post
888 	 *
889 	 * Return: %TRUE if the message was successfully posted. The function returns
890 	 *     %FALSE if the element did not have a bus.
891 	 *
892 	 *     MT safe.
893 	 */
894 	public bool postMessage(Message message)
895 	{
896 		return gst_element_post_message(gstElement, (message is null) ? null : message.getMessageStruct()) != 0;
897 	}
898 
899 	/**
900 	 * Get the clock provided by the given element.
901 	 * <note>An element is only required to provide a clock in the PAUSED
902 	 * state. Some elements can provide a clock in other states.</note>
903 	 *
904 	 * Return: the GstClock provided by the
905 	 *     element or %NULL if no clock could be provided.  Unref after usage.
906 	 *
907 	 *     MT safe.
908 	 */
909 	public Clock provideClock()
910 	{
911 		auto p = gst_element_provide_clock(gstElement);
912 		
913 		if(p is null)
914 		{
915 			return null;
916 		}
917 		
918 		return ObjectG.getDObject!(Clock)(cast(GstClock*) p, true);
919 	}
920 
921 	/**
922 	 * Performs a query on the given element.
923 	 *
924 	 * For elements that don't implement a query handler, this function
925 	 * forwards the query to a random srcpad or to the peer of a
926 	 * random linked sinkpad of this element.
927 	 *
928 	 * Please note that some queries might need a running pipeline to work.
929 	 *
930 	 * Params:
931 	 *     query = the #GstQuery.
932 	 *
933 	 * Return: %TRUE if the query could be performed.
934 	 *
935 	 *     MT safe.
936 	 */
937 	public bool query(Query query)
938 	{
939 		return gst_element_query(gstElement, (query is null) ? null : query.getQueryStruct()) != 0;
940 	}
941 
942 	/**
943 	 * Queries an element to convert @src_val in @src_format to @dest_format.
944 	 *
945 	 * Params:
946 	 *     srcFormat = a #GstFormat to convert from.
947 	 *     srcVal = a value to convert.
948 	 *     destFormat = the #GstFormat to convert to.
949 	 *     destVal = a pointer to the result.
950 	 *
951 	 * Return: %TRUE if the query could be performed.
952 	 */
953 	public bool queryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, out long destVal)
954 	{
955 		return gst_element_query_convert(gstElement, srcFormat, srcVal, destFormat, &destVal) != 0;
956 	}
957 
958 	/**
959 	 * Queries an element (usually top-level pipeline or playbin element) for the
960 	 * total stream duration in nanoseconds. This query will only work once the
961 	 * pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application
962 	 * will receive an ASYNC_DONE message on the pipeline bus when that is the case.
963 	 *
964 	 * If the duration changes for some reason, you will get a DURATION_CHANGED
965 	 * message on the pipeline bus, in which case you should re-query the duration
966 	 * using this function.
967 	 *
968 	 * Params:
969 	 *     format = the #GstFormat requested
970 	 *     duration = A location in which to store the total duration, or %NULL.
971 	 *
972 	 * Return: %TRUE if the query could be performed.
973 	 */
974 	public bool queryDuration(GstFormat format, out long duration)
975 	{
976 		return gst_element_query_duration(gstElement, format, &duration) != 0;
977 	}
978 
979 	/**
980 	 * Queries an element (usually top-level pipeline or playbin element) for the
981 	 * stream position in nanoseconds. This will be a value between 0 and the
982 	 * stream duration (if the stream duration is known). This query will usually
983 	 * only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING
984 	 * state). The application will receive an ASYNC_DONE message on the pipeline
985 	 * bus when that is the case.
986 	 *
987 	 * If one repeatedly calls this function one can also create a query and reuse
988 	 * it in gst_element_query().
989 	 *
990 	 * Params:
991 	 *     format = the #GstFormat requested
992 	 *     cur = a location in which to store the current
993 	 *         position, or %NULL.
994 	 *
995 	 * Return: %TRUE if the query could be performed.
996 	 */
997 	public bool queryPosition(GstFormat format, out long cur)
998 	{
999 		return gst_element_query_position(gstElement, format, &cur) != 0;
1000 	}
1001 
1002 	/**
1003 	 * Makes the element free the previously requested pad as obtained
1004 	 * with gst_element_request_pad().
1005 	 *
1006 	 * This does not unref the pad. If the pad was created by using
1007 	 * gst_element_request_pad(), gst_element_release_request_pad() needs to be
1008 	 * followed by gst_object_unref() to free the @pad.
1009 	 *
1010 	 * MT safe.
1011 	 *
1012 	 * Params:
1013 	 *     pad = the #GstPad to release.
1014 	 */
1015 	public void releaseRequestPad(Pad pad)
1016 	{
1017 		gst_element_release_request_pad(gstElement, (pad is null) ? null : pad.getPadStruct());
1018 	}
1019 
1020 	/**
1021 	 * Removes @pad from @element. @pad will be destroyed if it has not been
1022 	 * referenced elsewhere using gst_object_unparent().
1023 	 *
1024 	 * This function is used by plugin developers and should not be used
1025 	 * by applications. Pads that were dynamically requested from elements
1026 	 * with gst_element_request_pad() should be released with the
1027 	 * gst_element_release_request_pad() function instead.
1028 	 *
1029 	 * Pads are not automatically deactivated so elements should perform the needed
1030 	 * steps to deactivate the pad in case this pad is removed in the PAUSED or
1031 	 * PLAYING state. See gst_pad_set_active() for more information about
1032 	 * deactivating pads.
1033 	 *
1034 	 * The pad and the element should be unlocked when calling this function.
1035 	 *
1036 	 * This function will emit the #GstElement::pad-removed signal on the element.
1037 	 *
1038 	 * Params:
1039 	 *     pad = the #GstPad to remove from the element.
1040 	 *
1041 	 * Return: %TRUE if the pad could be removed. Can return %FALSE if the
1042 	 *     pad does not belong to the provided element.
1043 	 *
1044 	 *     MT safe.
1045 	 */
1046 	public bool removePad(Pad pad)
1047 	{
1048 		return gst_element_remove_pad(gstElement, (pad is null) ? null : pad.getPadStruct()) != 0;
1049 	}
1050 
1051 	/**
1052 	 * Retrieves a request pad from the element according to the provided template.
1053 	 * Pad templates can be looked up using
1054 	 * gst_element_factory_get_static_pad_templates().
1055 	 *
1056 	 * The pad should be released with gst_element_release_request_pad().
1057 	 *
1058 	 * Params:
1059 	 *     templ = a #GstPadTemplate of which we want a pad of.
1060 	 *     name = the name of the request #GstPad
1061 	 *         to retrieve. Can be %NULL.
1062 	 *     caps = the caps of the pad we want to
1063 	 *         request. Can be %NULL.
1064 	 *
1065 	 * Return: requested #GstPad if found,
1066 	 *     otherwise %NULL.  Release after usage.
1067 	 */
1068 	public Pad requestPad(PadTemplate templ, string name, Caps caps)
1069 	{
1070 		auto p = gst_element_request_pad(gstElement, (templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name), (caps is null) ? null : caps.getCapsStruct());
1071 		
1072 		if(p is null)
1073 		{
1074 			return null;
1075 		}
1076 		
1077 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
1078 	}
1079 
1080 	/**
1081 	 * Sends a seek event to an element. See gst_event_new_seek() for the details of
1082 	 * the parameters. The seek event is sent to the element using
1083 	 * gst_element_send_event().
1084 	 *
1085 	 * MT safe.
1086 	 *
1087 	 * Params:
1088 	 *     rate = The new playback rate
1089 	 *     format = The format of the seek values
1090 	 *     flags = The optional seek flags.
1091 	 *     startType = The type and flags for the new start position
1092 	 *     start = The value of the new start position
1093 	 *     stopType = The type and flags for the new stop position
1094 	 *     stop = The value of the new stop position
1095 	 *
1096 	 * Return: %TRUE if the event was handled. Flushing seeks will trigger a
1097 	 *     preroll, which will emit %GST_MESSAGE_ASYNC_DONE.
1098 	 */
1099 	public bool seek(double rate, GstFormat format, GstSeekFlags flags, GstSeekType startType, long start, GstSeekType stopType, long stop)
1100 	{
1101 		return gst_element_seek(gstElement, rate, format, flags, startType, start, stopType, stop) != 0;
1102 	}
1103 
1104 	/**
1105 	 * Simple API to perform a seek on the given element, meaning it just seeks
1106 	 * to the given position relative to the start of the stream. For more complex
1107 	 * operations like segment seeks (e.g. for looping) or changing the playback
1108 	 * rate or seeking relative to the last configured playback segment you should
1109 	 * use gst_element_seek().
1110 	 *
1111 	 * In a completely prerolled PAUSED or PLAYING pipeline, seeking is always
1112 	 * guaranteed to return %TRUE on a seekable media type or %FALSE when the media
1113 	 * type is certainly not seekable (such as a live stream).
1114 	 *
1115 	 * Some elements allow for seeking in the READY state, in this
1116 	 * case they will store the seek event and execute it when they are put to
1117 	 * PAUSED. If the element supports seek in READY, it will always return %TRUE when
1118 	 * it receives the event in the READY state.
1119 	 *
1120 	 * Params:
1121 	 *     format = a #GstFormat to execute the seek in, such as #GST_FORMAT_TIME
1122 	 *     seekFlags = seek options; playback applications will usually want to use
1123 	 *         GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here
1124 	 *     seekPos = position to seek to (relative to the start); if you are doing
1125 	 *         a seek in #GST_FORMAT_TIME this value is in nanoseconds -
1126 	 *         multiply with #GST_SECOND to convert seconds to nanoseconds or
1127 	 *         with #GST_MSECOND to convert milliseconds to nanoseconds.
1128 	 *
1129 	 * Return: %TRUE if the seek operation succeeded. Flushing seeks will trigger a
1130 	 *     preroll, which will emit %GST_MESSAGE_ASYNC_DONE.
1131 	 */
1132 	public bool seekSimple(GstFormat format, GstSeekFlags seekFlags, long seekPos)
1133 	{
1134 		return gst_element_seek_simple(gstElement, format, seekFlags, seekPos) != 0;
1135 	}
1136 
1137 	/**
1138 	 * Sends an event to an element. If the element doesn't implement an
1139 	 * event handler, the event will be pushed on a random linked sink pad for
1140 	 * downstream events or a random linked source pad for upstream events.
1141 	 *
1142 	 * This function takes ownership of the provided event so you should
1143 	 * gst_event_ref() it if you want to reuse the event after this call.
1144 	 *
1145 	 * MT safe.
1146 	 *
1147 	 * Params:
1148 	 *     event = the #GstEvent to send to the element.
1149 	 *
1150 	 * Return: %TRUE if the event was handled. Events that trigger a preroll (such
1151 	 *     as flushing seeks and steps) will emit %GST_MESSAGE_ASYNC_DONE.
1152 	 */
1153 	public bool sendEvent(Event event)
1154 	{
1155 		return gst_element_send_event(gstElement, (event is null) ? null : event.getEventStruct()) != 0;
1156 	}
1157 
1158 	/**
1159 	 * Set the base time of an element. See gst_element_get_base_time().
1160 	 *
1161 	 * MT safe.
1162 	 *
1163 	 * Params:
1164 	 *     time = the base time to set.
1165 	 */
1166 	public void setBaseTime(GstClockTime time)
1167 	{
1168 		gst_element_set_base_time(gstElement, time);
1169 	}
1170 
1171 	/**
1172 	 * Sets the bus of the element. Increases the refcount on the bus.
1173 	 * For internal use only, unless you're testing elements.
1174 	 *
1175 	 * MT safe.
1176 	 *
1177 	 * Params:
1178 	 *     bus = the #GstBus to set.
1179 	 */
1180 	public void setBus(Bus bus)
1181 	{
1182 		gst_element_set_bus(gstElement, (bus is null) ? null : bus.getBusStruct());
1183 	}
1184 
1185 	/**
1186 	 * Sets the clock for the element. This function increases the
1187 	 * refcount on the clock. Any previously set clock on the object
1188 	 * is unreffed.
1189 	 *
1190 	 * Params:
1191 	 *     clock = the #GstClock to set for the element.
1192 	 *
1193 	 * Return: %TRUE if the element accepted the clock. An element can refuse a
1194 	 *     clock when it, for example, is not able to slave its internal clock to the
1195 	 *     @clock or when it requires a specific clock to operate.
1196 	 *
1197 	 *     MT safe.
1198 	 */
1199 	public bool setClock(Clock clock)
1200 	{
1201 		return gst_element_set_clock(gstElement, (clock is null) ? null : clock.getClockStruct()) != 0;
1202 	}
1203 
1204 	/**
1205 	 * Sets the context of the element. Increases the refcount of the context.
1206 	 *
1207 	 * MT safe.
1208 	 *
1209 	 * Params:
1210 	 *     context = the #GstContext to set.
1211 	 */
1212 	public void setContext(Context context)
1213 	{
1214 		gst_element_set_context(gstElement, (context is null) ? null : context.getContextStruct());
1215 	}
1216 
1217 	/**
1218 	 * Locks the state of an element, so state changes of the parent don't affect
1219 	 * this element anymore.
1220 	 *
1221 	 * MT safe.
1222 	 *
1223 	 * Params:
1224 	 *     lockedState = %TRUE to lock the element's state
1225 	 *
1226 	 * Return: %TRUE if the state was changed, %FALSE if bad parameters were given
1227 	 *     or the elements state-locking needed no change.
1228 	 */
1229 	public bool setLockedState(bool lockedState)
1230 	{
1231 		return gst_element_set_locked_state(gstElement, lockedState) != 0;
1232 	}
1233 
1234 	/**
1235 	 * Set the start time of an element. The start time of the element is the
1236 	 * running time of the element when it last went to the PAUSED state. In READY
1237 	 * or after a flushing seek, it is set to 0.
1238 	 *
1239 	 * Toplevel elements like #GstPipeline will manage the start_time and
1240 	 * base_time on its children. Setting the start_time to #GST_CLOCK_TIME_NONE
1241 	 * on such a toplevel element will disable the distribution of the base_time to
1242 	 * the children and can be useful if the application manages the base_time
1243 	 * itself, for example if you want to synchronize capture from multiple
1244 	 * pipelines, and you can also ensure that the pipelines have the same clock.
1245 	 *
1246 	 * MT safe.
1247 	 *
1248 	 * Params:
1249 	 *     time = the base time to set.
1250 	 */
1251 	public void setStartTime(GstClockTime time)
1252 	{
1253 		gst_element_set_start_time(gstElement, time);
1254 	}
1255 
1256 	/**
1257 	 * Sets the state of the element. This function will try to set the
1258 	 * requested state by going through all the intermediary states and calling
1259 	 * the class's state change function for each.
1260 	 *
1261 	 * This function can return #GST_STATE_CHANGE_ASYNC, in which case the
1262 	 * element will perform the remainder of the state change asynchronously in
1263 	 * another thread.
1264 	 * An application can use gst_element_get_state() to wait for the completion
1265 	 * of the state change or it can wait for a %GST_MESSAGE_ASYNC_DONE or
1266 	 * %GST_MESSAGE_STATE_CHANGED on the bus.
1267 	 *
1268 	 * State changes to %GST_STATE_READY or %GST_STATE_NULL never return
1269 	 * #GST_STATE_CHANGE_ASYNC.
1270 	 *
1271 	 * Params:
1272 	 *     state = the element's new #GstState.
1273 	 *
1274 	 * Return: Result of the state change using #GstStateChangeReturn.
1275 	 *
1276 	 *     MT safe.
1277 	 */
1278 	public GstStateChangeReturn setState(GstState state)
1279 	{
1280 		return gst_element_set_state(gstElement, state);
1281 	}
1282 
1283 	/**
1284 	 * Tries to change the state of the element to the same as its parent.
1285 	 * If this function returns %FALSE, the state of element is undefined.
1286 	 *
1287 	 * Return: %TRUE, if the element's state could be synced to the parent's state.
1288 	 *
1289 	 *     MT safe.
1290 	 */
1291 	public bool syncStateWithParent()
1292 	{
1293 		return gst_element_sync_state_with_parent(gstElement) != 0;
1294 	}
1295 
1296 	/**
1297 	 * Unlinks all source pads of the source element with all sink pads
1298 	 * of the sink element to which they are linked.
1299 	 *
1300 	 * If the link has been made using gst_element_link(), it could have created an
1301 	 * requestpad, which has to be released using gst_element_release_request_pad().
1302 	 *
1303 	 * Params:
1304 	 *     dest = the sink #GstElement to unlink.
1305 	 */
1306 	public void unlink(Element dest)
1307 	{
1308 		gst_element_unlink(gstElement, (dest is null) ? null : dest.getElementStruct());
1309 	}
1310 
1311 	/**
1312 	 * Unlinks the two named pads of the source and destination elements.
1313 	 *
1314 	 * This is a convenience function for gst_pad_unlink().
1315 	 *
1316 	 * Params:
1317 	 *     srcpadname = the name of the #GstPad in source element.
1318 	 *     dest = a #GstElement containing the destination pad.
1319 	 *     destpadname = the name of the #GstPad in destination element.
1320 	 */
1321 	public void unlinkPads(string srcpadname, Element dest, string destpadname)
1322 	{
1323 		gst_element_unlink_pads(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname));
1324 	}
1325 
1326 	int[string] connectedSignals;
1327 
1328 	void delegate(Element)[] onNoMorePadsListeners;
1329 	/**
1330 	 * This signals that the element will not generate more dynamic pads.
1331 	 * Note that this signal will usually be emitted from the context of
1332 	 * the streaming thread.
1333 	 */
1334 	void addOnNoMorePads(void delegate(Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1335 	{
1336 		if ( "no-more-pads" !in connectedSignals )
1337 		{
1338 			Signals.connectData(
1339 				this,
1340 				"no-more-pads",
1341 				cast(GCallback)&callBackNoMorePads,
1342 				cast(void*)this,
1343 				null,
1344 				connectFlags);
1345 			connectedSignals["no-more-pads"] = 1;
1346 		}
1347 		onNoMorePadsListeners ~= dlg;
1348 	}
1349 	extern(C) static void callBackNoMorePads(GstElement* elementStruct, Element _element)
1350 	{
1351 		foreach ( void delegate(Element) dlg; _element.onNoMorePadsListeners )
1352 		{
1353 			dlg(_element);
1354 		}
1355 	}
1356 
1357 	void delegate(Pad, Element)[] onPadAddedListeners;
1358 	/**
1359 	 * a new #GstPad has been added to the element. Note that this signal will
1360 	 * usually be emitted from the context of the streaming thread. Also keep in
1361 	 * mind that if you add new elements to the pipeline in the signal handler
1362 	 * you will need to set them to the desired target state with
1363 	 * gst_element_set_state() or gst_element_sync_state_with_parent().
1364 	 *
1365 	 * Params:
1366 	 *     newPad = the pad that has been added
1367 	 */
1368 	void addOnPadAdded(void delegate(Pad, Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1369 	{
1370 		if ( "pad-added" !in connectedSignals )
1371 		{
1372 			Signals.connectData(
1373 				this,
1374 				"pad-added",
1375 				cast(GCallback)&callBackPadAdded,
1376 				cast(void*)this,
1377 				null,
1378 				connectFlags);
1379 			connectedSignals["pad-added"] = 1;
1380 		}
1381 		onPadAddedListeners ~= dlg;
1382 	}
1383 	extern(C) static void callBackPadAdded(GstElement* elementStruct, GstPad* newPad, Element _element)
1384 	{
1385 		foreach ( void delegate(Pad, Element) dlg; _element.onPadAddedListeners )
1386 		{
1387 			dlg(ObjectG.getDObject!(Pad)(newPad), _element);
1388 		}
1389 	}
1390 
1391 	void delegate(Pad, Element)[] onPadRemovedListeners;
1392 	/**
1393 	 * a #GstPad has been removed from the element
1394 	 *
1395 	 * Params:
1396 	 *     oldPad = the pad that has been removed
1397 	 */
1398 	void addOnPadRemoved(void delegate(Pad, Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1399 	{
1400 		if ( "pad-removed" !in connectedSignals )
1401 		{
1402 			Signals.connectData(
1403 				this,
1404 				"pad-removed",
1405 				cast(GCallback)&callBackPadRemoved,
1406 				cast(void*)this,
1407 				null,
1408 				connectFlags);
1409 			connectedSignals["pad-removed"] = 1;
1410 		}
1411 		onPadRemovedListeners ~= dlg;
1412 	}
1413 	extern(C) static void callBackPadRemoved(GstElement* elementStruct, GstPad* oldPad, Element _element)
1414 	{
1415 		foreach ( void delegate(Pad, Element) dlg; _element.onPadRemovedListeners )
1416 		{
1417 			dlg(ObjectG.getDObject!(Pad)(oldPad), _element);
1418 		}
1419 	}
1420 }