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