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 gobject.ObjectG;
32 private import gobject.Signals;
33 private import gobject.Type;
34 private import gobject.c.functions;
35 private import gstreamer.Bus;
36 private import gstreamer.Caps;
37 private import gstreamer.Clock;
38 private import gstreamer.Context;
39 private import gstreamer.ElementFactory;
40 private import gstreamer.Event;
41 private import gstreamer.Iterator;
42 private import gstreamer.Message;
43 private import gstreamer.ObjectGst;
44 private import gstreamer.Pad;
45 private import gstreamer.PadTemplate;
46 private import gstreamer.Plugin;
47 private import gstreamer.Query;
48 private import gstreamer.Structure;
49 private import gstreamer.c.functions;
50 public  import gstreamer.c.types;
51 public  import gstreamerc.gstreamertypes;
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 	 * Retrieves the factory that was used to create this element.
690 	 *
691 	 * Returns: the #GstElementFactory used for creating this
692 	 *     element or %NULL if element has not been registered (static element). no refcounting is needed.
693 	 */
694 	public ElementFactory getFactory()
695 	{
696 		auto p = gst_element_get_factory(gstElement);
697 
698 		if(p is null)
699 		{
700 			return null;
701 		}
702 
703 		return ObjectG.getDObject!(ElementFactory)(cast(GstElementFactory*) p);
704 	}
705 
706 	/**
707 	 * Get metadata with @key in @klass.
708 	 *
709 	 * Params:
710 	 *     key = the key to get
711 	 *
712 	 * Returns: the metadata for @key.
713 	 *
714 	 * Since: 1.14
715 	 */
716 	public string getMetadata(string key)
717 	{
718 		return Str.toString(gst_element_get_metadata(gstElement, Str.toStringz(key)));
719 	}
720 
721 	/**
722 	 * Retrieves a padtemplate from @element with the given name.
723 	 *
724 	 * Params:
725 	 *     name = the name of the #GstPadTemplate to get.
726 	 *
727 	 * Returns: the #GstPadTemplate with the
728 	 *     given name, or %NULL if none was found. No unreferencing is
729 	 *     necessary.
730 	 *
731 	 * Since: 1.14
732 	 */
733 	public PadTemplate getPadTemplate(string name)
734 	{
735 		auto p = gst_element_get_pad_template(gstElement, Str.toStringz(name));
736 
737 		if(p is null)
738 		{
739 			return null;
740 		}
741 
742 		return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p);
743 	}
744 
745 	/**
746 	 * Retrieves a list of the pad templates associated with @element. The
747 	 * list must not be modified by the calling code.
748 	 *
749 	 * Returns: the #GList of
750 	 *     pad templates.
751 	 *
752 	 * Since: 1.14
753 	 */
754 	public ListG getPadTemplateList()
755 	{
756 		auto p = gst_element_get_pad_template_list(gstElement);
757 
758 		if(p is null)
759 		{
760 			return null;
761 		}
762 
763 		return new ListG(cast(GList*) p);
764 	}
765 
766 	/**
767 	 * Retrieves a pad from the element by name (e.g. "src_\%d"). This version only
768 	 * retrieves request pads. The pad should be released with
769 	 * gst_element_release_request_pad().
770 	 *
771 	 * This method is slower than manually getting the pad template and calling
772 	 * gst_element_request_pad() if the pads should have a specific name (e.g.
773 	 * @name is "src_1" instead of "src_\%u").
774 	 *
775 	 * Params:
776 	 *     name = the name of the request #GstPad to retrieve.
777 	 *
778 	 * Returns: requested #GstPad if found,
779 	 *     otherwise %NULL.  Release after usage.
780 	 */
781 	public Pad getRequestPad(string name)
782 	{
783 		auto p = gst_element_get_request_pad(gstElement, Str.toStringz(name));
784 
785 		if(p is null)
786 		{
787 			return null;
788 		}
789 
790 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
791 	}
792 
793 	/**
794 	 * Returns the start time of the element. The start time is the
795 	 * running time of the clock when this element was last put to PAUSED.
796 	 *
797 	 * Usually the start_time is managed by a toplevel element such as
798 	 * #GstPipeline.
799 	 *
800 	 * MT safe.
801 	 *
802 	 * Returns: the start time of the element.
803 	 */
804 	public GstClockTime getStartTime()
805 	{
806 		return gst_element_get_start_time(gstElement);
807 	}
808 
809 	/**
810 	 * Gets the state of the element.
811 	 *
812 	 * For elements that performed an ASYNC state change, as reported by
813 	 * gst_element_set_state(), this function will block up to the
814 	 * specified timeout value for the state change to complete.
815 	 * If the element completes the state change or goes into
816 	 * an error, this function returns immediately with a return value of
817 	 * %GST_STATE_CHANGE_SUCCESS or %GST_STATE_CHANGE_FAILURE respectively.
818 	 *
819 	 * For elements that did not return %GST_STATE_CHANGE_ASYNC, this function
820 	 * returns the current and pending state immediately.
821 	 *
822 	 * This function returns %GST_STATE_CHANGE_NO_PREROLL if the element
823 	 * successfully changed its state but is not able to provide data yet.
824 	 * This mostly happens for live sources that only produce data in
825 	 * %GST_STATE_PLAYING. While the state change return is equivalent to
826 	 * %GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that
827 	 * some sink elements might not be able to complete their state change because
828 	 * an element is not producing data to complete the preroll. When setting the
829 	 * element to playing, the preroll will complete and playback will start.
830 	 *
831 	 * Params:
832 	 *     state = a pointer to #GstState to hold the state.
833 	 *         Can be %NULL.
834 	 *     pending = a pointer to #GstState to hold the pending
835 	 *         state. Can be %NULL.
836 	 *     timeout = a #GstClockTime to specify the timeout for an async
837 	 *         state change or %GST_CLOCK_TIME_NONE for infinite timeout.
838 	 *
839 	 * Returns: %GST_STATE_CHANGE_SUCCESS if the element has no more pending state
840 	 *     and the last state change succeeded, %GST_STATE_CHANGE_ASYNC if the
841 	 *     element is still performing a state change or
842 	 *     %GST_STATE_CHANGE_FAILURE if the last state change failed.
843 	 *
844 	 *     MT safe.
845 	 */
846 	public GstStateChangeReturn getState(out GstState state, out GstState pending, GstClockTime timeout)
847 	{
848 		return gst_element_get_state(gstElement, &state, &pending, timeout);
849 	}
850 
851 	/**
852 	 * Retrieves a pad from @element by name. This version only retrieves
853 	 * already-existing (i.e. 'static') pads.
854 	 *
855 	 * Params:
856 	 *     name = the name of the static #GstPad to retrieve.
857 	 *
858 	 * Returns: the requested #GstPad if
859 	 *     found, otherwise %NULL.  unref after usage.
860 	 *
861 	 *     MT safe.
862 	 */
863 	public Pad getStaticPad(string name)
864 	{
865 		auto p = gst_element_get_static_pad(gstElement, Str.toStringz(name));
866 
867 		if(p is null)
868 		{
869 			return null;
870 		}
871 
872 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
873 	}
874 
875 	/**
876 	 * Checks if the state of an element is locked.
877 	 * If the state of an element is locked, state changes of the parent don't
878 	 * affect the element.
879 	 * This way you can leave currently unused elements inside bins. Just lock their
880 	 * state before changing the state from #GST_STATE_NULL.
881 	 *
882 	 * MT safe.
883 	 *
884 	 * Returns: %TRUE, if the element's state is locked.
885 	 */
886 	public bool isLockedState()
887 	{
888 		return gst_element_is_locked_state(gstElement) != 0;
889 	}
890 
891 	/**
892 	 * Retrieves an iterator of @element's pads. The iterator should
893 	 * be freed after usage. Also more specialized iterators exists such as
894 	 * gst_element_iterate_src_pads() or gst_element_iterate_sink_pads().
895 	 *
896 	 * The order of pads returned by the iterator will be the order in which
897 	 * the pads were added to the element.
898 	 *
899 	 * Returns: the #GstIterator of #GstPad.
900 	 *
901 	 *     MT safe.
902 	 */
903 	public Iterator iteratePads()
904 	{
905 		auto p = gst_element_iterate_pads(gstElement);
906 
907 		if(p is null)
908 		{
909 			return null;
910 		}
911 
912 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p, true);
913 	}
914 
915 	/**
916 	 * Retrieves an iterator of @element's sink pads.
917 	 *
918 	 * The order of pads returned by the iterator will be the order in which
919 	 * the pads were added to the element.
920 	 *
921 	 * Returns: the #GstIterator of #GstPad.
922 	 *
923 	 *     MT safe.
924 	 */
925 	public Iterator iterateSinkPads()
926 	{
927 		auto p = gst_element_iterate_sink_pads(gstElement);
928 
929 		if(p is null)
930 		{
931 			return null;
932 		}
933 
934 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p, true);
935 	}
936 
937 	/**
938 	 * Retrieves an iterator of @element's source pads.
939 	 *
940 	 * The order of pads returned by the iterator will be the order in which
941 	 * the pads were added to the element.
942 	 *
943 	 * Returns: the #GstIterator of #GstPad.
944 	 *
945 	 *     MT safe.
946 	 */
947 	public Iterator iterateSrcPads()
948 	{
949 		auto p = gst_element_iterate_src_pads(gstElement);
950 
951 		if(p is null)
952 		{
953 			return null;
954 		}
955 
956 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p, true);
957 	}
958 
959 	/**
960 	 * Links @src to @dest. The link must be from source to
961 	 * destination; the other direction will not be tried. The function looks for
962 	 * existing pads that aren't linked yet. It will request new pads if necessary.
963 	 * Such pads need to be released manually when unlinking.
964 	 * If multiple links are possible, only one is established.
965 	 *
966 	 * Make sure you have added your elements to a bin or pipeline with
967 	 * gst_bin_add() before trying to link them.
968 	 *
969 	 * Params:
970 	 *     dest = the #GstElement containing the destination pad.
971 	 *
972 	 * Returns: %TRUE if the elements could be linked, %FALSE otherwise.
973 	 */
974 	public bool link(Element dest)
975 	{
976 		return gst_element_link(gstElement, (dest is null) ? null : dest.getElementStruct()) != 0;
977 	}
978 
979 	/**
980 	 * Links @src to @dest using the given caps as filtercaps.
981 	 * The link must be from source to
982 	 * destination; the other direction will not be tried. The function looks for
983 	 * existing pads that aren't linked yet. It will request new pads if necessary.
984 	 * If multiple links are possible, only one is established.
985 	 *
986 	 * Make sure you have added your elements to a bin or pipeline with
987 	 * gst_bin_add() before trying to link them.
988 	 *
989 	 * Params:
990 	 *     dest = the #GstElement containing the destination pad.
991 	 *     filter = the #GstCaps to filter the link,
992 	 *         or %NULL for no filter.
993 	 *
994 	 * Returns: %TRUE if the pads could be linked, %FALSE otherwise.
995 	 */
996 	public bool linkFiltered(Element dest, Caps filter)
997 	{
998 		return gst_element_link_filtered(gstElement, (dest is null) ? null : dest.getElementStruct(), (filter is null) ? null : filter.getCapsStruct()) != 0;
999 	}
1000 
1001 	/**
1002 	 * Links the two named pads of the source and destination elements.
1003 	 * Side effect is that if one of the pads has no parent, it becomes a
1004 	 * child of the parent of the other element.  If they have different
1005 	 * parents, the link fails.
1006 	 *
1007 	 * Params:
1008 	 *     srcpadname = the name of the #GstPad in source element
1009 	 *         or %NULL for any pad.
1010 	 *     dest = the #GstElement containing the destination pad.
1011 	 *     destpadname = the name of the #GstPad in destination element,
1012 	 *         or %NULL for any pad.
1013 	 *
1014 	 * Returns: %TRUE if the pads could be linked, %FALSE otherwise.
1015 	 */
1016 	public bool linkPads(string srcpadname, Element dest, string destpadname)
1017 	{
1018 		return gst_element_link_pads(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname)) != 0;
1019 	}
1020 
1021 	/**
1022 	 * Links the two named pads of the source and destination elements. Side effect
1023 	 * is that if one of the pads has no parent, it becomes a child of the parent of
1024 	 * the other element. If they have different parents, the link fails. If @caps
1025 	 * is not %NULL, makes sure that the caps of the link is a subset of @caps.
1026 	 *
1027 	 * Params:
1028 	 *     srcpadname = the name of the #GstPad in source element
1029 	 *         or %NULL for any pad.
1030 	 *     dest = the #GstElement containing the destination pad.
1031 	 *     destpadname = the name of the #GstPad in destination element
1032 	 *         or %NULL for any pad.
1033 	 *     filter = the #GstCaps to filter the link,
1034 	 *         or %NULL for no filter.
1035 	 *
1036 	 * Returns: %TRUE if the pads could be linked, %FALSE otherwise.
1037 	 */
1038 	public bool linkPadsFiltered(string srcpadname, Element dest, string destpadname, Caps filter)
1039 	{
1040 		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;
1041 	}
1042 
1043 	/**
1044 	 * Links the two named pads of the source and destination elements.
1045 	 * Side effect is that if one of the pads has no parent, it becomes a
1046 	 * child of the parent of the other element.  If they have different
1047 	 * parents, the link fails.
1048 	 *
1049 	 * Calling gst_element_link_pads_full() with @flags == %GST_PAD_LINK_CHECK_DEFAULT
1050 	 * is the same as calling gst_element_link_pads() and the recommended way of
1051 	 * linking pads with safety checks applied.
1052 	 *
1053 	 * This is a convenience function for gst_pad_link_full().
1054 	 *
1055 	 * Params:
1056 	 *     srcpadname = the name of the #GstPad in source element
1057 	 *         or %NULL for any pad.
1058 	 *     dest = the #GstElement containing the destination pad.
1059 	 *     destpadname = the name of the #GstPad in destination element,
1060 	 *         or %NULL for any pad.
1061 	 *     flags = the #GstPadLinkCheck to be performed when linking pads.
1062 	 *
1063 	 * Returns: %TRUE if the pads could be linked, %FALSE otherwise.
1064 	 */
1065 	public bool linkPadsFull(string srcpadname, Element dest, string destpadname, GstPadLinkCheck flags)
1066 	{
1067 		return gst_element_link_pads_full(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname), flags) != 0;
1068 	}
1069 
1070 	/**
1071 	 * Brings the element to the lost state. The current state of the
1072 	 * element is copied to the pending state so that any call to
1073 	 * gst_element_get_state() will return %GST_STATE_CHANGE_ASYNC.
1074 	 *
1075 	 * An ASYNC_START message is posted. If the element was PLAYING, it will
1076 	 * go to PAUSED. The element will be restored to its PLAYING state by
1077 	 * the parent pipeline when it prerolls again.
1078 	 *
1079 	 * This is mostly used for elements that lost their preroll buffer
1080 	 * in the %GST_STATE_PAUSED or %GST_STATE_PLAYING state after a flush,
1081 	 * they will go to their pending state again when a new preroll buffer is
1082 	 * queued. This function can only be called when the element is currently
1083 	 * not in error or an async state change.
1084 	 *
1085 	 * This function is used internally and should normally not be called from
1086 	 * plugins or applications.
1087 	 */
1088 	public void lostState()
1089 	{
1090 		gst_element_lost_state(gstElement);
1091 	}
1092 
1093 	/**
1094 	 * Post an error, warning or info message on the bus from inside an element.
1095 	 *
1096 	 * @type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or
1097 	 * #GST_MESSAGE_INFO.
1098 	 *
1099 	 * MT safe.
1100 	 *
1101 	 * Params:
1102 	 *     type = the #GstMessageType
1103 	 *     domain = the GStreamer GError domain this message belongs to
1104 	 *     code = the GError code belonging to the domain
1105 	 *     text = an allocated text string to be used
1106 	 *         as a replacement for the default message connected to code,
1107 	 *         or %NULL
1108 	 *     debug_ = an allocated debug message to be
1109 	 *         used as a replacement for the default debugging information,
1110 	 *         or %NULL
1111 	 *     file = the source code file where the error was generated
1112 	 *     function_ = the source code function where the error was generated
1113 	 *     line = the source code line where the error was generated
1114 	 */
1115 	public void messageFull(GstMessageType type, GQuark domain, int code, string text, string debug_, string file, string function_, int line)
1116 	{
1117 		gst_element_message_full(gstElement, type, domain, code, Str.toStringz(text), Str.toStringz(debug_), Str.toStringz(file), Str.toStringz(function_), line);
1118 	}
1119 
1120 	/**
1121 	 * Post an error, warning or info message on the bus from inside an element.
1122 	 *
1123 	 * @type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or
1124 	 * #GST_MESSAGE_INFO.
1125 	 *
1126 	 * Params:
1127 	 *     type = the #GstMessageType
1128 	 *     domain = the GStreamer GError domain this message belongs to
1129 	 *     code = the GError code belonging to the domain
1130 	 *     text = an allocated text string to be used
1131 	 *         as a replacement for the default message connected to code,
1132 	 *         or %NULL
1133 	 *     debug_ = an allocated debug message to be
1134 	 *         used as a replacement for the default debugging information,
1135 	 *         or %NULL
1136 	 *     file = the source code file where the error was generated
1137 	 *     function_ = the source code function where the error was generated
1138 	 *     line = the source code line where the error was generated
1139 	 *     structure = optional details structure
1140 	 *
1141 	 * Since: 1.10
1142 	 */
1143 	public void messageFullWithDetails(GstMessageType type, GQuark domain, int code, string text, string debug_, string file, string function_, int line, Structure structure)
1144 	{
1145 		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));
1146 	}
1147 
1148 	/**
1149 	 * Use this function to signal that the element does not expect any more pads
1150 	 * to show up in the current pipeline. This function should be called whenever
1151 	 * pads have been added by the element itself. Elements with #GST_PAD_SOMETIMES
1152 	 * pad templates use this in combination with autopluggers to figure out that
1153 	 * the element is done initializing its pads.
1154 	 *
1155 	 * This function emits the #GstElement::no-more-pads signal.
1156 	 *
1157 	 * MT safe.
1158 	 */
1159 	public void noMorePads()
1160 	{
1161 		gst_element_no_more_pads(gstElement);
1162 	}
1163 
1164 	/**
1165 	 * Post a message on the element's #GstBus. This function takes ownership of the
1166 	 * message; if you want to access the message after this call, you should add an
1167 	 * additional reference before calling.
1168 	 *
1169 	 * Params:
1170 	 *     message = a #GstMessage to post
1171 	 *
1172 	 * Returns: %TRUE if the message was successfully posted. The function returns
1173 	 *     %FALSE if the element did not have a bus.
1174 	 *
1175 	 *     MT safe.
1176 	 */
1177 	public bool postMessage(Message message)
1178 	{
1179 		return gst_element_post_message(gstElement, (message is null) ? null : message.getMessageStruct()) != 0;
1180 	}
1181 
1182 	/**
1183 	 * Get the clock provided by the given element.
1184 	 * > An element is only required to provide a clock in the PAUSED
1185 	 * > state. Some elements can provide a clock in other states.
1186 	 *
1187 	 * Returns: the GstClock provided by the
1188 	 *     element or %NULL if no clock could be provided.  Unref after usage.
1189 	 *
1190 	 *     MT safe.
1191 	 */
1192 	public Clock provideClock()
1193 	{
1194 		auto p = gst_element_provide_clock(gstElement);
1195 
1196 		if(p is null)
1197 		{
1198 			return null;
1199 		}
1200 
1201 		return ObjectG.getDObject!(Clock)(cast(GstClock*) p, true);
1202 	}
1203 
1204 	/**
1205 	 * Performs a query on the given element.
1206 	 *
1207 	 * For elements that don't implement a query handler, this function
1208 	 * forwards the query to a random srcpad or to the peer of a
1209 	 * random linked sinkpad of this element.
1210 	 *
1211 	 * Please note that some queries might need a running pipeline to work.
1212 	 *
1213 	 * Params:
1214 	 *     query = the #GstQuery.
1215 	 *
1216 	 * Returns: %TRUE if the query could be performed.
1217 	 *
1218 	 *     MT safe.
1219 	 */
1220 	public bool query(Query query)
1221 	{
1222 		return gst_element_query(gstElement, (query is null) ? null : query.getQueryStruct()) != 0;
1223 	}
1224 
1225 	/**
1226 	 * Queries an element to convert @src_val in @src_format to @dest_format.
1227 	 *
1228 	 * Params:
1229 	 *     srcFormat = a #GstFormat to convert from.
1230 	 *     srcVal = a value to convert.
1231 	 *     destFormat = the #GstFormat to convert to.
1232 	 *     destVal = a pointer to the result.
1233 	 *
1234 	 * Returns: %TRUE if the query could be performed.
1235 	 */
1236 	public bool queryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, out long destVal)
1237 	{
1238 		return gst_element_query_convert(gstElement, srcFormat, srcVal, destFormat, &destVal) != 0;
1239 	}
1240 
1241 	/**
1242 	 * Queries an element (usually top-level pipeline or playbin element) for the
1243 	 * total stream duration in nanoseconds. This query will only work once the
1244 	 * pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application
1245 	 * will receive an ASYNC_DONE message on the pipeline bus when that is the case.
1246 	 *
1247 	 * If the duration changes for some reason, you will get a DURATION_CHANGED
1248 	 * message on the pipeline bus, in which case you should re-query the duration
1249 	 * using this function.
1250 	 *
1251 	 * Params:
1252 	 *     format = the #GstFormat requested
1253 	 *     duration = A location in which to store the total duration, or %NULL.
1254 	 *
1255 	 * Returns: %TRUE if the query could be performed.
1256 	 */
1257 	public bool queryDuration(GstFormat format, out long duration)
1258 	{
1259 		return gst_element_query_duration(gstElement, format, &duration) != 0;
1260 	}
1261 
1262 	/**
1263 	 * Queries an element (usually top-level pipeline or playbin element) for the
1264 	 * stream position in nanoseconds. This will be a value between 0 and the
1265 	 * stream duration (if the stream duration is known). This query will usually
1266 	 * only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING
1267 	 * state). The application will receive an ASYNC_DONE message on the pipeline
1268 	 * bus when that is the case.
1269 	 *
1270 	 * If one repeatedly calls this function one can also create a query and reuse
1271 	 * it in gst_element_query().
1272 	 *
1273 	 * Params:
1274 	 *     format = the #GstFormat requested
1275 	 *     cur = a location in which to store the current
1276 	 *         position, or %NULL.
1277 	 *
1278 	 * Returns: %TRUE if the query could be performed.
1279 	 */
1280 	public bool queryPosition(GstFormat format, out long cur)
1281 	{
1282 		return gst_element_query_position(gstElement, format, &cur) != 0;
1283 	}
1284 
1285 	/**
1286 	 * Makes the element free the previously requested pad as obtained
1287 	 * with gst_element_request_pad().
1288 	 *
1289 	 * This does not unref the pad. If the pad was created by using
1290 	 * gst_element_request_pad(), gst_element_release_request_pad() needs to be
1291 	 * followed by gst_object_unref() to free the @pad.
1292 	 *
1293 	 * MT safe.
1294 	 *
1295 	 * Params:
1296 	 *     pad = the #GstPad to release.
1297 	 */
1298 	public void releaseRequestPad(Pad pad)
1299 	{
1300 		gst_element_release_request_pad(gstElement, (pad is null) ? null : pad.getPadStruct());
1301 	}
1302 
1303 	/**
1304 	 * Removes @pad from @element. @pad will be destroyed if it has not been
1305 	 * referenced elsewhere using gst_object_unparent().
1306 	 *
1307 	 * This function is used by plugin developers and should not be used
1308 	 * by applications. Pads that were dynamically requested from elements
1309 	 * with gst_element_request_pad() should be released with the
1310 	 * gst_element_release_request_pad() function instead.
1311 	 *
1312 	 * Pads are not automatically deactivated so elements should perform the needed
1313 	 * steps to deactivate the pad in case this pad is removed in the PAUSED or
1314 	 * PLAYING state. See gst_pad_set_active() for more information about
1315 	 * deactivating pads.
1316 	 *
1317 	 * The pad and the element should be unlocked when calling this function.
1318 	 *
1319 	 * This function will emit the #GstElement::pad-removed signal on the element.
1320 	 *
1321 	 * Params:
1322 	 *     pad = the #GstPad to remove from the element.
1323 	 *
1324 	 * Returns: %TRUE if the pad could be removed. Can return %FALSE if the
1325 	 *     pad does not belong to the provided element.
1326 	 *
1327 	 *     MT safe.
1328 	 */
1329 	public bool removePad(Pad pad)
1330 	{
1331 		return gst_element_remove_pad(gstElement, (pad is null) ? null : pad.getPadStruct()) != 0;
1332 	}
1333 
1334 	/** */
1335 	public void removePropertyNotifyWatch(gulong watchId)
1336 	{
1337 		gst_element_remove_property_notify_watch(gstElement, watchId);
1338 	}
1339 
1340 	/**
1341 	 * Retrieves a request pad from the element according to the provided template.
1342 	 * Pad templates can be looked up using
1343 	 * gst_element_factory_get_static_pad_templates().
1344 	 *
1345 	 * The pad should be released with gst_element_release_request_pad().
1346 	 *
1347 	 * Params:
1348 	 *     templ = a #GstPadTemplate of which we want a pad of.
1349 	 *     name = the name of the request #GstPad
1350 	 *         to retrieve. Can be %NULL.
1351 	 *     caps = the caps of the pad we want to
1352 	 *         request. Can be %NULL.
1353 	 *
1354 	 * Returns: requested #GstPad if found,
1355 	 *     otherwise %NULL.  Release after usage.
1356 	 */
1357 	public Pad requestPad(PadTemplate templ, string name, Caps caps)
1358 	{
1359 		auto p = gst_element_request_pad(gstElement, (templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name), (caps is null) ? null : caps.getCapsStruct());
1360 
1361 		if(p is null)
1362 		{
1363 			return null;
1364 		}
1365 
1366 		return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
1367 	}
1368 
1369 	/**
1370 	 * Sends a seek event to an element. See gst_event_new_seek() for the details of
1371 	 * the parameters. The seek event is sent to the element using
1372 	 * gst_element_send_event().
1373 	 *
1374 	 * MT safe.
1375 	 *
1376 	 * Params:
1377 	 *     rate = The new playback rate
1378 	 *     format = The format of the seek values
1379 	 *     flags = The optional seek flags.
1380 	 *     startType = The type and flags for the new start position
1381 	 *     start = The value of the new start position
1382 	 *     stopType = The type and flags for the new stop position
1383 	 *     stop = The value of the new stop position
1384 	 *
1385 	 * Returns: %TRUE if the event was handled. Flushing seeks will trigger a
1386 	 *     preroll, which will emit %GST_MESSAGE_ASYNC_DONE.
1387 	 */
1388 	public bool seek(double rate, GstFormat format, GstSeekFlags flags, GstSeekType startType, long start, GstSeekType stopType, long stop)
1389 	{
1390 		return gst_element_seek(gstElement, rate, format, flags, startType, start, stopType, stop) != 0;
1391 	}
1392 
1393 	/**
1394 	 * Simple API to perform a seek on the given element, meaning it just seeks
1395 	 * to the given position relative to the start of the stream. For more complex
1396 	 * operations like segment seeks (e.g. for looping) or changing the playback
1397 	 * rate or seeking relative to the last configured playback segment you should
1398 	 * use gst_element_seek().
1399 	 *
1400 	 * In a completely prerolled PAUSED or PLAYING pipeline, seeking is always
1401 	 * guaranteed to return %TRUE on a seekable media type or %FALSE when the media
1402 	 * type is certainly not seekable (such as a live stream).
1403 	 *
1404 	 * Some elements allow for seeking in the READY state, in this
1405 	 * case they will store the seek event and execute it when they are put to
1406 	 * PAUSED. If the element supports seek in READY, it will always return %TRUE when
1407 	 * it receives the event in the READY state.
1408 	 *
1409 	 * Params:
1410 	 *     format = a #GstFormat to execute the seek in, such as #GST_FORMAT_TIME
1411 	 *     seekFlags = seek options; playback applications will usually want to use
1412 	 *         GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here
1413 	 *     seekPos = position to seek to (relative to the start); if you are doing
1414 	 *         a seek in #GST_FORMAT_TIME this value is in nanoseconds -
1415 	 *         multiply with #GST_SECOND to convert seconds to nanoseconds or
1416 	 *         with #GST_MSECOND to convert milliseconds to nanoseconds.
1417 	 *
1418 	 * Returns: %TRUE if the seek operation succeeded. Flushing seeks will trigger a
1419 	 *     preroll, which will emit %GST_MESSAGE_ASYNC_DONE.
1420 	 */
1421 	public bool seekSimple(GstFormat format, GstSeekFlags seekFlags, long seekPos)
1422 	{
1423 		return gst_element_seek_simple(gstElement, format, seekFlags, seekPos) != 0;
1424 	}
1425 
1426 	/**
1427 	 * Sends an event to an element. If the element doesn't implement an
1428 	 * event handler, the event will be pushed on a random linked sink pad for
1429 	 * downstream events or a random linked source pad for upstream events.
1430 	 *
1431 	 * This function takes ownership of the provided event so you should
1432 	 * gst_event_ref() it if you want to reuse the event after this call.
1433 	 *
1434 	 * MT safe.
1435 	 *
1436 	 * Params:
1437 	 *     event = the #GstEvent to send to the element.
1438 	 *
1439 	 * Returns: %TRUE if the event was handled. Events that trigger a preroll (such
1440 	 *     as flushing seeks and steps) will emit %GST_MESSAGE_ASYNC_DONE.
1441 	 */
1442 	public bool sendEvent(Event event)
1443 	{
1444 		return gst_element_send_event(gstElement, (event is null) ? null : event.getEventStruct()) != 0;
1445 	}
1446 
1447 	/**
1448 	 * Set the base time of an element. See gst_element_get_base_time().
1449 	 *
1450 	 * MT safe.
1451 	 *
1452 	 * Params:
1453 	 *     time = the base time to set.
1454 	 */
1455 	public void setBaseTime(GstClockTime time)
1456 	{
1457 		gst_element_set_base_time(gstElement, time);
1458 	}
1459 
1460 	/**
1461 	 * Sets the bus of the element. Increases the refcount on the bus.
1462 	 * For internal use only, unless you're testing elements.
1463 	 *
1464 	 * MT safe.
1465 	 *
1466 	 * Params:
1467 	 *     bus = the #GstBus to set.
1468 	 */
1469 	public void setBus(Bus bus)
1470 	{
1471 		gst_element_set_bus(gstElement, (bus is null) ? null : bus.getBusStruct());
1472 	}
1473 
1474 	/**
1475 	 * Sets the clock for the element. This function increases the
1476 	 * refcount on the clock. Any previously set clock on the object
1477 	 * is unreffed.
1478 	 *
1479 	 * Params:
1480 	 *     clock = the #GstClock to set for the element.
1481 	 *
1482 	 * Returns: %TRUE if the element accepted the clock. An element can refuse a
1483 	 *     clock when it, for example, is not able to slave its internal clock to the
1484 	 *     @clock or when it requires a specific clock to operate.
1485 	 *
1486 	 *     MT safe.
1487 	 */
1488 	public bool setClock(Clock clock)
1489 	{
1490 		return gst_element_set_clock(gstElement, (clock is null) ? null : clock.getClockStruct()) != 0;
1491 	}
1492 
1493 	/**
1494 	 * Sets the context of the element. Increases the refcount of the context.
1495 	 *
1496 	 * MT safe.
1497 	 *
1498 	 * Params:
1499 	 *     context = the #GstContext to set.
1500 	 */
1501 	public void setContext(Context context)
1502 	{
1503 		gst_element_set_context(gstElement, (context is null) ? null : context.getContextStruct());
1504 	}
1505 
1506 	/**
1507 	 * Locks the state of an element, so state changes of the parent don't affect
1508 	 * this element anymore.
1509 	 *
1510 	 * Note that this is racy if the state lock of the parent bin is not taken.
1511 	 * The parent bin might've just checked the flag in another thread and as the
1512 	 * next step proceed to change the child element's state.
1513 	 *
1514 	 * MT safe.
1515 	 *
1516 	 * Params:
1517 	 *     lockedState = %TRUE to lock the element's state
1518 	 *
1519 	 * Returns: %TRUE if the state was changed, %FALSE if bad parameters were given
1520 	 *     or the elements state-locking needed no change.
1521 	 */
1522 	public bool setLockedState(bool lockedState)
1523 	{
1524 		return gst_element_set_locked_state(gstElement, lockedState) != 0;
1525 	}
1526 
1527 	/**
1528 	 * Set the start time of an element. The start time of the element is the
1529 	 * running time of the element when it last went to the PAUSED state. In READY
1530 	 * or after a flushing seek, it is set to 0.
1531 	 *
1532 	 * Toplevel elements like #GstPipeline will manage the start_time and
1533 	 * base_time on its children. Setting the start_time to #GST_CLOCK_TIME_NONE
1534 	 * on such a toplevel element will disable the distribution of the base_time to
1535 	 * the children and can be useful if the application manages the base_time
1536 	 * itself, for example if you want to synchronize capture from multiple
1537 	 * pipelines, and you can also ensure that the pipelines have the same clock.
1538 	 *
1539 	 * MT safe.
1540 	 *
1541 	 * Params:
1542 	 *     time = the base time to set.
1543 	 */
1544 	public void setStartTime(GstClockTime time)
1545 	{
1546 		gst_element_set_start_time(gstElement, time);
1547 	}
1548 
1549 	/**
1550 	 * Sets the state of the element. This function will try to set the
1551 	 * requested state by going through all the intermediary states and calling
1552 	 * the class's state change function for each.
1553 	 *
1554 	 * This function can return #GST_STATE_CHANGE_ASYNC, in which case the
1555 	 * element will perform the remainder of the state change asynchronously in
1556 	 * another thread.
1557 	 * An application can use gst_element_get_state() to wait for the completion
1558 	 * of the state change or it can wait for a %GST_MESSAGE_ASYNC_DONE or
1559 	 * %GST_MESSAGE_STATE_CHANGED on the bus.
1560 	 *
1561 	 * State changes to %GST_STATE_READY or %GST_STATE_NULL never return
1562 	 * #GST_STATE_CHANGE_ASYNC.
1563 	 *
1564 	 * Params:
1565 	 *     state = the element's new #GstState.
1566 	 *
1567 	 * Returns: Result of the state change using #GstStateChangeReturn.
1568 	 *
1569 	 *     MT safe.
1570 	 */
1571 	public GstStateChangeReturn setState(GstState state)
1572 	{
1573 		return gst_element_set_state(gstElement, state);
1574 	}
1575 
1576 	/**
1577 	 * Tries to change the state of the element to the same as its parent.
1578 	 * If this function returns %FALSE, the state of element is undefined.
1579 	 *
1580 	 * Returns: %TRUE, if the element's state could be synced to the parent's state.
1581 	 *
1582 	 *     MT safe.
1583 	 */
1584 	public bool syncStateWithParent()
1585 	{
1586 		return gst_element_sync_state_with_parent(gstElement) != 0;
1587 	}
1588 
1589 	/**
1590 	 * Unlinks all source pads of the source element with all sink pads
1591 	 * of the sink element to which they are linked.
1592 	 *
1593 	 * If the link has been made using gst_element_link(), it could have created an
1594 	 * requestpad, which has to be released using gst_element_release_request_pad().
1595 	 *
1596 	 * Params:
1597 	 *     dest = the sink #GstElement to unlink.
1598 	 */
1599 	public void unlink(Element dest)
1600 	{
1601 		gst_element_unlink(gstElement, (dest is null) ? null : dest.getElementStruct());
1602 	}
1603 
1604 	/**
1605 	 * Unlinks the two named pads of the source and destination elements.
1606 	 *
1607 	 * This is a convenience function for gst_pad_unlink().
1608 	 *
1609 	 * Params:
1610 	 *     srcpadname = the name of the #GstPad in source element.
1611 	 *     dest = a #GstElement containing the destination pad.
1612 	 *     destpadname = the name of the #GstPad in destination element.
1613 	 */
1614 	public void unlinkPads(string srcpadname, Element dest, string destpadname)
1615 	{
1616 		gst_element_unlink_pads(gstElement, Str.toStringz(srcpadname), (dest is null) ? null : dest.getElementStruct(), Str.toStringz(destpadname));
1617 	}
1618 
1619 	/**
1620 	 * This signals that the element will not generate more dynamic pads.
1621 	 * Note that this signal will usually be emitted from the context of
1622 	 * the streaming thread.
1623 	 */
1624 	gulong addOnNoMorePads(void delegate(Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1625 	{
1626 		return Signals.connect(this, "no-more-pads", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1627 	}
1628 
1629 	/**
1630 	 * a new #GstPad has been added to the element. Note that this signal will
1631 	 * usually be emitted from the context of the streaming thread. Also keep in
1632 	 * mind that if you add new elements to the pipeline in the signal handler
1633 	 * you will need to set them to the desired target state with
1634 	 * gst_element_set_state() or gst_element_sync_state_with_parent().
1635 	 *
1636 	 * Params:
1637 	 *     newPad = the pad that has been added
1638 	 */
1639 	gulong addOnPadAdded(void delegate(Pad, Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1640 	{
1641 		return Signals.connect(this, "pad-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1642 	}
1643 
1644 	/**
1645 	 * a #GstPad has been removed from the element
1646 	 *
1647 	 * Params:
1648 	 *     oldPad = the pad that has been removed
1649 	 */
1650 	gulong addOnPadRemoved(void delegate(Pad, Element) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1651 	{
1652 		return Signals.connect(this, "pad-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1653 	}
1654 }