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