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