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