2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GstElement.html
51 * - gstreamer.Iterator
62 * - GstClock* -> Clock
63 * - GstElement* -> Element
64 * - GstEvent* -> Event
65 * - GstIndex* -> Index
66 * - GstIterator* -> Iterator
67 * - GstMessage* -> Message
69 * - GstQuery* -> Query
70 * - GstTagList* -> TagList
75 module gstreamer
.Element
;
77 private import gstreamerc
.gstreamertypes
;
79 private import gstreamerc
.gstreamer
;
81 private import glib
.Str
;
82 private import gtkc
.gobject
;
83 private import gstreamer
.Pad
;
84 private import gstreamer
.Clock
;
85 private import gstreamer
.Caps
;
86 private import gstreamer
.Iterator
;
87 private import gstreamer
.Index
;
88 private import gstreamer
.TagList
;
89 private import gstreamer
.Message
;
90 private import gstreamer
.Query
;
91 private import gstreamer
.Event
;
92 private import gstreamer
.Bus
;
98 * GstElement is the abstract base class needed to construct an element that
99 * can be used in a GStreamer pipeline. Please refer to the plugin writers
100 * guide for more information on creating GstElement subclasses.
101 * The name of a GstElement can be get with gst_element_get_name() and set with
102 * gst_element_set_name(). For speed, GST_ELEMENT_NAME() can be used in the
103 * core when using the appropriate locking. Do not use this in plug-ins or
104 * applications in order to retain ABI compatibility.
105 * All elements have pads (of the type GstPad). These pads link to pads on
106 * other elements. GstBuffer flow between these linked pads.
107 * A GstElement has a GList of GstPad structures for all their input (or sink)
108 * and output (or source) pads.
109 * Core and plug-in writers can add and remove pads with gst_element_add_pad()
110 * and gst_element_remove_pad().
111 * A pad of an element can be retrieved by name with gst_element_get_pad().
112 * An iterator of all pads can be retrieved with gst_element_iterate_pads().
113 * Elements can be linked through their pads.
114 * If the link is straightforward, use the gst_element_link()
115 * convenience function to link two elements, or gst_element_link_many()
116 * for more elements in a row.
117 * Use gst_element_link_filtered() to link two elements constrained by
118 * a specified set of GstCaps.
119 * For finer control, use gst_element_link_pads() and
120 * gst_element_link_pads_filtered() to specify the pads to link on
121 * each element by name.
122 * Each element has a state (see GstState). You can get and set the state
123 * of an element with gst_element_get_state() and gst_element_set_state().
124 * To get a string representation of a GstState, use
125 * gst_element_state_get_name().
126 * You can get and set a GstClock on an element using gst_element_get_clock()
127 * and gst_element_set_clock().
128 * Some elements can provide a clock for the pipeline if
129 * gst_element_provides_clock() returns TRUE. With the
130 * gst_element_provide_clock() method one can retrieve the clock provided by
132 * Not all elements require a clock to operate correctly. If
133 * gst_element_requires_clock() returns TRUE, a clock should be set on the
134 * element with gst_element_set_clock().
135 * Note that clock slection and distribution is normally handled by the
136 * toplevel GstPipeline so the clock functions are only to be used in very
137 * specific situations.
138 * Last reviewed on 2006-03-12 (0.10.5)
140 private import gstreamer
.ObjectGst
;
141 public class Element
: ObjectGst
144 /** the main Gtk struct */
145 protected GstElement
* gstElement
;
148 public GstElement
* getElementStruct()
154 /** the main Gtk struct as a void* */
155 protected void* getStruct()
157 return cast(void*)gstElement
;
161 * Sets our main struct and passes it to the parent class
163 public this (GstElement
* gstElement
)
165 super(cast(GstObject
*)gstElement
);
166 this.gstElement
= gstElement
;
170 * Queries an element for the stream position.
171 * This is a convenience function for gstreamerD.
173 * The current position in nanoseconds - GstFormat.TIME.
175 public long queryPosition()
177 GstFormat form
= GstFormat
.TIME
;
179 queryPosition( &form
, &cur_pos
);
184 * Queries an element for the stream duration.
185 * This is a convenience function for gstreamerD.
187 * The duration in nanoseconds - GstFormat.TIME.
189 public long queryDuration()
191 GstFormat form
= GstFormat
.TIME
;
193 queryDuration( &form
, &cur_dur
);
198 * This set's the filename for a filesrc element.
200 public void location( char[] set
)
202 //g_object_set( G_OBJECT(getElementStruct()), "location", set, NULL);
203 setProperty("location", set
);
207 * Set the caps property of an Element.
211 g_object_set( getElementStruct(), Str
.toStringz("caps"), cp
.getCapsStruct(), null );
215 * For your convenience in gstreamerD: you can seek to the
216 * position of the pipeline measured in time_nanoseconds.
218 public int seek( ulong time_nanoseconds
) //gint64
220 return seek( 1.0, GstFormat
.TIME
, GstSeekFlags
.FLUSH
,
221 GstSeekType
.SET
, time_nanoseconds
,
222 GstSeekType
.NONE
, GST_CLOCK_TIME_NONE
);
226 * Get's all the pads from an element in a Pad[]. FIXME: This a hackish mess.
230 Pad
[] result
= new Pad
[0];
232 Iterator iter
= iteratePads();
233 GstPad
* obu_c
= null;
234 iter
.next( cast(void**) &obu_c
);
235 while( obu_c
!is null )
237 Pad tmpobu
= new Pad( obu_c
);
238 //writefln( "iterating Padname: ", tmpobu.getName() );
239 result
.length
= result
.length
+ 1;
240 result
[result
.length
-1] = tmpobu
;
243 iter
.next( cast(void**) &obu_c
);
245 //writefln("no more pads.");
249 protected uint padAddedHandlerId
;
250 void delegate(Pad
, Element
)[] onPadAddedListeners
;
251 void addOnPadAdded(void delegate(Pad
, Element
) dlg
)
253 if ( !("pad-added" in connectedSignals
) )
255 padAddedHandlerId
= Signals
.connectData(
258 cast(GCallback
)&callBackPadAdded
,
261 cast(ConnectFlags
)0);
262 connectedSignals
["pad-added"] = 1;
264 onPadAddedListeners
~= dlg
;
266 extern(C
) static void callBackPadAdded(GstElement
* gstelementStruct
, GObject
* newPad
, Element element
)
268 bit consumed
= false;
270 foreach ( void delegate(Pad
, Element
) dlg
; element
.onPadAddedListeners
)
272 dlg(new Pad(newPad
), element
);
277 void disconnectOnPadAdded()
279 if( "pad-added" in connectedSignals
)
281 Signals
.handlerDisconnect( getStruct(), padAddedHandlerId
);
282 padAddedHandlerId
= 0;
283 connectedSignals
["pad-added"] = 0;
284 onPadAddedListeners
= null;
292 // imports for the signal processing
293 private import gobject
.Signals
;
294 private import gtkc
.gdktypes
;
295 int[char[]] connectedSignals
;
297 void delegate(Element
)[] onNoMorePadsListeners
;
298 void addOnNoMorePads(void delegate(Element
) dlg
)
300 if ( !("no-more-pads" in connectedSignals
) )
305 cast(GCallback
)&callBackNoMorePads
,
308 cast(ConnectFlags
)0);
309 connectedSignals
["no-more-pads"] = 1;
311 onNoMorePadsListeners
~= dlg
;
313 extern(C
) static void callBackNoMorePads(GstElement
* gstelementStruct
, Element element
)
315 bit consumed
= false;
317 foreach ( void delegate(Element
) dlg
; element
.onNoMorePadsListeners
)
324 /*SEE HANDEDIT ABOVE... there's a disconnectOnPadAdded added.
325 void delegate(Pad, Element)[] onPadAddedListeners;
326 void addOnPadAdded(void delegate(Pad, Element) dlg)
328 if ( !("pad-added" in connectedSignals) )
333 cast(GCallback)&callBackPadAdded,
336 cast(ConnectFlags)0);
337 connectedSignals["pad-added"] = 1;
339 onPadAddedListeners ~= dlg;
341 extern(C) static void callBackPadAdded(GstElement* gstelementStruct, GObject* newPad, Element element)
343 bit consumed = false;
345 foreach ( void delegate(Pad, Element) dlg ; element.onPadAddedListeners )
347 dlg(new Pad(newPad), element);
353 void delegate(Pad
, Element
)[] onPadRemovedListeners
;
354 void addOnPadRemoved(void delegate(Pad
, Element
) dlg
)
356 if ( !("pad-removed" in connectedSignals
) )
361 cast(GCallback
)&callBackPadRemoved
,
364 cast(ConnectFlags
)0);
365 connectedSignals
["pad-removed"] = 1;
367 onPadRemovedListeners
~= dlg
;
369 extern(C
) static void callBackPadRemoved(GstElement
* gstelementStruct
, GObject
* oldPad
, Element element
)
371 bit consumed
= false;
373 foreach ( void delegate(Pad
, Element
) dlg
; element
.onPadRemovedListeners
)
375 dlg(new Pad(oldPad
), element
);
408 * Adds a padtemplate to an element class. This is mainly used in the _base_init
409 * functions of classes.
411 * the GstElementClass to add the pad template to.
413 * a GstPadTemplate to add to the element class.
415 public static void classAddPadTemplate(GstElementClass
* klass
, GstPadTemplate
* templ
)
417 // void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
418 gst_element_class_add_pad_template(klass
, templ
);
422 * Retrieves a padtemplate from element_class with the given name.
424 * If you use this function in the GInstanceInitFunc of an object class
425 * that has subclasses, make sure to pass the g_class parameter of the
426 * GInstanceInitFunc here.
428 * a GstElementClass to get the pad template of.
430 * the name of the GstPadTemplate to get.
432 * the GstPadTemplate with the given name, or NULL if none was found.
433 * No unreferencing is necessary.
435 public static GstPadTemplate
* classGetPadTemplate(GstElementClass
* elementClass
, char[] name
)
437 // GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
438 return gst_element_class_get_pad_template(elementClass
, Str
.toStringz(name
));
442 * Retrieves a list of the pad templates associated with element_class. The
443 * list must not be modified by the calling code.
445 * If you use this function in the GInstanceInitFunc of an object class
446 * that has subclasses, make sure to pass the g_class parameter of the
447 * GInstanceInitFunc here.
449 * a GstElementClass to get pad templates of.
451 * the GList of padtemplates.
453 public static GList
* classGetPadTemplateList(GstElementClass
* elementClass
)
455 // GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
456 return gst_element_class_get_pad_template_list(elementClass
);
460 * Adds a list of standardized properties with types to the klass.
461 * the id is for the property switch in your get_prop method, and
462 * the flags determine readability / writeability.
464 * the GstElementClass to add the properties to.
466 * the name of the first property.
467 * in a NULL terminated
469 * the id and flags of the first property, followed by
470 * further 'name', 'id', 'flags' triplets and terminated by NULL.
472 public static void classInstallStdProps(GstElementClass
* klass
, char[] firstName
, ... )
474 // void gst_element_class_install_std_props (GstElementClass *klass, const gchar *first_name, ...);
475 gst_element_class_install_std_props(klass
, Str
.toStringz(firstName
));
479 * Sets the detailed information for a GstElementClass.
481 * This function is for use in _base_init functions only.
482 * The details are copied.
484 * class to set details for
488 public static void classSetDetails(GstElementClass
* klass
, GstElementDetails
* details
)
490 // void gst_element_class_set_details (GstElementClass *klass, const GstElementDetails *details);
491 gst_element_class_set_details(klass
, details
);
495 * Adds a pad (link point) to element. pad's parent will be set to element;
496 * see gst_object_set_parent() for refcounting information.
497 * Pads are not automatically activated so elements should perform the needed
498 * steps to activate the pad in case this pad is added in the PAUSED or PLAYING
499 * state. See gst_pad_set_active() for more information about activating pads.
500 * The pad and the element should be unlocked when calling this function.
501 * This function will emit the GstElement::pad-added signal on the element.
503 * a GstElement to add the pad to.
505 * the GstPad to add to the element.
507 * TRUE if the pad could be added. This function can fail when
508 * a pad with the same name already existed or the pad already had another
512 public int addPad(Pad pad
)
514 // gboolean gst_element_add_pad (GstElement *element, GstPad *pad);
515 return gst_element_add_pad(gstElement
, (pad
is null) ?
null : pad
.getPadStruct());
519 * Retrieves a pad from element by name. Tries gst_element_get_static_pad()
520 * first, then gst_element_get_request_pad().
522 * Usage of this function is not recommended as it is unclear if the reference
523 * to the result pad should be released with gst_object_unref() in case of a static pad
524 * or gst_element_release_request_pad() in case of a request pad.
528 * the name of the pad to retrieve.
530 * the GstPad if found, otherwise NULL. Unref or Release after usage,
531 * depending on the type of the pad.
533 public Pad
getPad(char[] name
)
535 // GstPad* gst_element_get_pad (GstElement *element, const gchar *name);
536 return new Pad( gst_element_get_pad(gstElement
, Str
.toStringz(name
)) );
540 * Creates a pad for each pad template that is always available.
541 * This function is only useful during object intialization of
542 * subclasses of GstElement.
544 * a GstElement to create pads for
546 public void createAllPads()
548 // void gst_element_create_all_pads (GstElement *element);
549 gst_element_create_all_pads(gstElement
);
553 * Looks for an unlinked pad to which the given pad can link. It is not
554 * guaranteed that linking the pads will work, though it should work in most
557 * a GstElement in which the pad should be found.
559 * the GstPad to find a compatible one for.
561 * the GstCaps to use as a filter.
563 * the GstPad to which a link can be made, or NULL if one cannot be
566 public Pad
getCompatiblePad(Pad pad
, Caps caps
)
568 // GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad, const GstCaps *caps);
569 return new Pad( gst_element_get_compatible_pad(gstElement
, (pad
is null) ?
null : pad
.getPadStruct(), (caps
is null) ?
null : caps
.getCapsStruct()) );
573 * Retrieves a pad template from element that is compatible with compattempl.
574 * Pads from compatible templates can be linked together.
576 * a GstElement to get a compatible pad template for.
578 * the GstPadTemplate to find a compatible template for.
580 * a compatible GstPadTemplate, or NULL if none was found. No
581 * unreferencing is necessary.
583 public GstPadTemplate
* getCompatiblePadTemplate(GstPadTemplate
* compattempl
)
585 // GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);
586 return gst_element_get_compatible_pad_template(gstElement
, compattempl
);
590 * Retrieves a pad from the element by name. This version only retrieves
591 * request pads. The pad should be released with
592 * gst_element_release_request_pad().
594 * a GstElement to find a request pad of.
596 * the name of the request GstPad to retrieve.
598 * requested GstPad if found, otherwise NULL. Release after usage.
600 public Pad
getRequestPad(char[] name
)
602 // GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
603 return new Pad( gst_element_get_request_pad(gstElement
, Str
.toStringz(name
)) );
607 * Retrieves a pad from element by name. This version only retrieves
608 * already-existing (i.e. 'static') pads.
610 * a GstElement to find a static pad of.
612 * the name of the static GstPad to retrieve.
614 * the requested GstPad if found, otherwise NULL. unref after
618 public Pad
getStaticPad(char[] name
)
620 // GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name);
621 return new Pad( gst_element_get_static_pad(gstElement
, Str
.toStringz(name
)) );
625 * Use this function to signal that the element does not expect any more pads
626 * to show up in the current pipeline. This function should be called whenever
627 * pads have been added by the element itself. Elements with GST_PAD_SOMETIMES
628 * pad templates use this in combination with autopluggers to figure out that
629 * the element is done initializing its pads.
630 * This function emits the GstElement::no-more-pads signal.
635 public void noMorePads()
637 // void gst_element_no_more_pads (GstElement *element);
638 gst_element_no_more_pads(gstElement
);
642 * Makes the element free the previously requested pad as obtained
643 * with gst_element_get_request_pad().
646 * a GstElement to release the request pad of.
648 * the GstPad to release.
650 public void releaseRequestPad(Pad pad
)
652 // void gst_element_release_request_pad (GstElement *element, GstPad *pad);
653 gst_element_release_request_pad(gstElement
, (pad
is null) ?
null : pad
.getPadStruct());
657 * Removes pad from element. pad will be destroyed if it has not been
658 * referenced elsewhere using gst_object_unparent().
659 * This function is used by plugin developers and should not be used
660 * by applications. Pads that were dynamically requested from elements
661 * with gst_element_get_request_pad() should be released with the
662 * gst_element_release_request_pad() function instead.
663 * Pads are not automatically deactivated so elements should perform the needed
664 * steps to deactivate the pad in case this pad is removed in the PAUSED or
665 * PLAYING state. See gst_pad_set_active() for more information about
667 * The pad and the element should be unlocked when calling this function.
668 * This function will emit the GstElement::pad-removed signal on the element.
670 * a GstElement to remove pad from.
672 * the GstPad to remove from the element.
674 * TRUE if the pad could be removed. Can return FALSE if the
675 * pad does not belong to the provided element.
678 public int removePad(Pad pad
)
680 // gboolean gst_element_remove_pad (GstElement *element, GstPad *pad);
681 return gst_element_remove_pad(gstElement
, (pad
is null) ?
null : pad
.getPadStruct());
685 * Retrieves an iterattor of element's pads. The iterator should
686 * be freed after usage.
688 * a GstElement to iterate pads of.
690 * the GstIterator of GstPad. Unref each pad after use.
693 public Iterator
iteratePads()
695 // GstIterator* gst_element_iterate_pads (GstElement *element);
696 return new Iterator( gst_element_iterate_pads(gstElement
) );
700 * Retrieves an iterator of element's sink pads.
704 * the GstIterator of GstPad. Unref each pad after use.
707 public Iterator
iterateSinkPads()
709 // GstIterator* gst_element_iterate_sink_pads (GstElement *element);
710 return new Iterator( gst_element_iterate_sink_pads(gstElement
) );
714 * Retrieves an iterator of element's source pads.
718 * the GstIterator of GstPad. Unref each pad after use.
721 public Iterator
iterateSrcPads()
723 // GstIterator* gst_element_iterate_src_pads (GstElement *element);
724 return new Iterator( gst_element_iterate_src_pads(gstElement
) );
728 * Links src to dest. The link must be from source to
729 * destination; the other direction will not be tried. The function looks for
730 * existing pads that aren't linked yet. It will request new pads if necessary.
731 * If multiple links are possible, only one is established.
732 * Make sure you have added your elements to a bin or pipeline with
733 * gst_bin_add() before trying to link them.
735 * a GstElement containing the source pad.
737 * the GstElement containing the destination pad.
739 * TRUE if the elements could be linked, FALSE otherwise.
741 public int link(Element dest
)
743 // gboolean gst_element_link (GstElement *src, GstElement *dest);
744 return gst_element_link(gstElement
, (dest
is null) ?
null : dest
.getElementStruct());
748 * Unlinks all source pads of the source element with all sink pads
749 * of the sink element to which they are linked.
751 * the source GstElement to unlink.
753 * the sink GstElement to unlink.
755 public void unlink(Element dest
)
757 // void gst_element_unlink (GstElement *src, GstElement *dest);
758 gst_element_unlink(gstElement
, (dest
is null) ?
null : dest
.getElementStruct());
762 * Chain together a series of elements. Uses gst_element_link().
763 * Make sure you have added your elements to a bin or pipeline with
764 * gst_bin_add() before trying to link them.
766 * the first GstElement in the link chain.
768 * the second GstElement in the link chain.
770 * the NULL-terminated list of elements to link in order.
772 * TRUE on success, FALSE otherwise.
774 public int linkMany(Element element2
, ... )
776 // gboolean gst_element_link_many (GstElement *element_1, GstElement *element_2, ...);
777 return gst_element_link_many(gstElement
, (element2
is null) ?
null : element2
.getElementStruct());
781 * Unlinks a series of elements. Uses gst_element_unlink().
783 * the first GstElement in the link chain.
785 * the second GstElement in the link chain.
787 * the NULL-terminated list of elements to unlink in order.
789 public void unlinkMany(Element element2
, ... )
791 // void gst_element_unlink_many (GstElement *element_1, GstElement *element_2, ...);
792 gst_element_unlink_many(gstElement
, (element2
is null) ?
null : element2
.getElementStruct());
796 * Links the two named pads of the source and destination elements.
797 * Side effect is that if one of the pads has no parent, it becomes a
798 * child of the parent of the other element. If they have different
799 * parents, the link fails.
801 * a GstElement containing the source pad.
803 * the name of the GstPad in source element or NULL for any pad.
805 * the GstElement containing the destination pad.
807 * the name of the GstPad in destination element,
808 * or NULL for any pad.
810 * TRUE if the pads could be linked, FALSE otherwise.
812 public int linkPads(char[] srcpadname
, Element dest
, char[] destpadname
)
814 // gboolean gst_element_link_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname);
815 return gst_element_link_pads(gstElement
, Str
.toStringz(srcpadname
), (dest
is null) ?
null : dest
.getElementStruct(), Str
.toStringz(destpadname
));
819 * Unlinks the two named pads of the source and destination elements.
821 * a GstElement containing the source pad.
823 * the name of the GstPad in source element.
825 * a GstElement containing the destination pad.
827 * the name of the GstPad in destination element.
829 public void unlinkPads(char[] srcpadname
, Element dest
, char[] destpadname
)
831 // void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname);
832 gst_element_unlink_pads(gstElement
, Str
.toStringz(srcpadname
), (dest
is null) ?
null : dest
.getElementStruct(), Str
.toStringz(destpadname
));
836 * Links the two named pads of the source and destination elements. Side effect
837 * is that if one of the pads has no parent, it becomes a child of the parent of
838 * the other element. If they have different parents, the link fails. If caps
839 * is not NULL, makes sure that the caps of the link is a subset of caps.
841 * a GstElement containing the source pad.
843 * the name of the GstPad in source element or NULL for any pad.
845 * the GstElement containing the destination pad.
847 * the name of the GstPad in destination element or NULL for any pad.
849 * the GstCaps to filter the link, or NULL for no filter.
851 * TRUE if the pads could be linked, FALSE otherwise.
853 public int linkPadsFiltered(char[] srcpadname
, Element dest
, char[] destpadname
, Caps filter
)
855 // gboolean gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname, GstCaps *filter);
856 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());
860 * Links src to dest using the given caps as filtercaps.
861 * The link must be from source to
862 * destination; the other direction will not be tried. The function looks for
863 * existing pads that aren't linked yet. It will request new pads if necessary.
864 * If multiple links are possible, only one is established.
865 * Make sure you have added your elements to a bin or pipeline with
866 * gst_bin_add() before trying to link them.
868 * a GstElement containing the source pad.
870 * the GstElement containing the destination pad.
872 * the GstCaps to filter the link, or NULL for no filter.
874 * TRUE if the pads could be linked, FALSE otherwise.
876 public int linkFiltered(Element dest
, Caps filter
)
878 // gboolean gst_element_link_filtered (GstElement *src, GstElement *dest, GstCaps *filter);
879 return gst_element_link_filtered(gstElement
, (dest
is null) ?
null : dest
.getElementStruct(), (filter
is null) ?
null : filter
.getCapsStruct());
883 * Set the base time of an element. See gst_element_get_base_time().
888 * the base time to set.
890 public void setBaseTime(GstClockTime time
)
892 // void gst_element_set_base_time (GstElement *element, GstClockTime time);
893 gst_element_set_base_time(gstElement
, time
);
897 * Returns the base time of the element. The base time is the
898 * absolute time of the clock when this element was last put to
899 * PLAYING. Subtracting the base time from the clock time gives
900 * the stream time of the element.
904 * the base time of the element.
907 public GstClockTime
getBaseTime()
909 // GstClockTime gst_element_get_base_time (GstElement *element);
910 return gst_element_get_base_time(gstElement
);
914 * Sets the bus of the element. Increases the refcount on the bus.
915 * For internal use only, unless you're testing elements.
918 * a GstElement to set the bus of.
922 public void setBus(Bus bus
)
924 // void gst_element_set_bus (GstElement *element, GstBus *bus);
925 gst_element_set_bus(gstElement
, (bus
is null) ?
null : bus
.getBusStruct());
929 * Returns the bus of the element.
931 * a GstElement to get the bus of.
933 * the element's GstBus. unref after usage.
938 // GstBus* gst_element_get_bus (GstElement *element);
939 return new Bus( gst_element_get_bus(gstElement
) );
943 * Retrieves the factory that was used to create this element.
945 * a GstElement to request the element factory of.
947 * the GstElementFactory used for creating this element.
948 * no refcounting is needed.
950 public GstElementFactory
* getFactory()
952 // GstElementFactory* gst_element_get_factory (GstElement *element);
953 return gst_element_get_factory(gstElement
);
957 * Set index on the element. The refcount of the index
958 * will be increased, any previously set index is unreffed.
965 public void setIndex(Index index
)
967 // void gst_element_set_index (GstElement *element, GstIndex *index);
968 gst_element_set_index(gstElement
, (index
is null) ?
null : index
.getIndexStruct());
972 * Gets the index from the element.
976 * a GstIndex or NULL when no index was set on the
977 * element. unref after usage.
980 public Index
getIndex()
982 // GstIndex* gst_element_get_index (GstElement *element);
983 return new Index( gst_element_get_index(gstElement
) );
987 * Queries if the element can be indexed.
991 * TRUE if the element can be indexed.
994 public int isIndexable()
996 // gboolean gst_element_is_indexable (GstElement *element);
997 return gst_element_is_indexable(gstElement
);
1005 * Query if the element requires a clock.
1007 * a GstElement to query
1009 * TRUE if the element requires a clock
1012 public int requiresClock()
1014 // gboolean gst_element_requires_clock (GstElement *element);
1015 return gst_element_requires_clock(gstElement
);
1019 * Sets the clock for the element. This function increases the
1020 * refcount on the clock. Any previously set clock on the object
1023 * a GstElement to set the clock for.
1025 * the GstClock to set for the element.
1027 * TRUE if the element accepted the clock. An element can refuse a
1028 * clock when it, for example, is not able to slave its internal clock to the
1029 * clock or when it requires a specific clock to operate.
1032 public int setClock(Clock clock
)
1034 // gboolean gst_element_set_clock (GstElement *element, GstClock *clock);
1035 return gst_element_set_clock(gstElement
, (clock
is null) ?
null : clock
.getClockStruct());
1039 * Gets the currently configured clock of the element. This is the clock as was
1040 * last set with gst_element_set_clock().
1042 * a GstElement to get the clock of.
1044 * the GstClock of the element. unref after usage.
1047 public Clock
getClock()
1049 // GstClock* gst_element_get_clock (GstElement *element);
1050 return new Clock( gst_element_get_clock(gstElement
) );
1054 * Query if the element provides a clock. A GstClock provided by an
1055 * element can be used as the global GstClock for the pipeline.
1056 * An element that can provide a clock is only required to do so in the PAUSED
1057 * state, this means when it is fully negotiated and has allocated the resources
1058 * to operate the clock.
1060 * a GstElement to query
1062 * TRUE if the element provides a clock
1065 public int providesClock()
1067 // gboolean gst_element_provides_clock (GstElement *element);
1068 return gst_element_provides_clock(gstElement
);
1072 * Get the clock provided by the given element.
1074 * An element is only required to provide a clock in the PAUSED
1075 * state. Some elements can provide a clock in other states.
1077 * a GstElement to query
1079 * the GstClock provided by the element or NULL
1080 * if no clock could be provided. Unref after usage.
1083 public Clock
provideClock()
1085 // GstClock* gst_element_provide_clock (GstElement *element);
1086 return new Clock( gst_element_provide_clock(gstElement
) );
1090 * Sets the state of the element. This function will try to set the
1091 * requested state by going through all the intermediary states and calling
1092 * the class's state change function for each.
1093 * This function can return GST_STATE_CHANGE_ASYNC, in which case the
1094 * element will perform the remainder of the state change asynchronously in
1096 * An application can use gst_element_get_state() to wait for the completion
1097 * of the state change or it can wait for a state change message on the bus.
1099 * a GstElement to change state of.
1101 * the element's new GstState.
1103 * Result of the state change using GstStateChangeReturn.
1106 public GstStateChangeReturn
setState(GstState state
)
1108 // GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state);
1109 return gst_element_set_state(gstElement
, state
);
1113 * Gets the state of the element.
1114 * For elements that performed an ASYNC state change, as reported by
1115 * gst_element_set_state(), this function will block up to the
1116 * specified timeout value for the state change to complete.
1117 * If the element completes the state change or goes into
1118 * an error, this function returns immediately with a return value of
1119 * GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively.
1120 * For elements that did not return GST_STATE_CHANGE_ASYNC, this function
1121 * returns the current and pending state immediately.
1122 * This function returns GST_STATE_CHANGE_NO_PREROLL if the element
1123 * successfully changed its state but is not able to provide data yet.
1124 * This mostly happens for live sources that only produce data in the PLAYING
1125 * state. While the state change return is equivalent to
1126 * GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that
1127 * some sink elements might not be able to complete their state change because
1128 * an element is not producing data to complete the preroll. When setting the
1129 * element to playing, the preroll will complete and playback will start.
1131 * a GstElement to get the state of.
1133 * a pointer to GstState to hold the state. Can be NULL.
1135 * a pointer to GstState to hold the pending state.
1138 * a GstClockTime to specify the timeout for an async
1139 * state change or GST_CLOCK_TIME_NONE for infinite timeout.
1141 * GST_STATE_CHANGE_SUCCESS if the element has no more pending state
1142 * and the last state change succeeded, GST_STATE_CHANGE_ASYNC if the
1143 * element is still performing a state change or
1144 * GST_STATE_CHANGE_FAILURE if the last state change failed.
1147 public GstStateChangeReturn
getState(GstState
* state
, GstState
* pending
, GstClockTime timeout
)
1149 // GstStateChangeReturn gst_element_get_state (GstElement *element, GstState *state, GstState *pending, GstClockTime timeout);
1150 return gst_element_get_state(gstElement
, state
, pending
, timeout
);
1154 * Locks the state of an element, so state changes of the parent don't affect
1155 * this element anymore.
1160 * TRUE to lock the element's state
1162 * TRUE if the state was changed, FALSE if bad parameters were given
1163 * or the elements state-locking needed no change.
1165 public int setLockedState(int lockedState
)
1167 // gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state);
1168 return gst_element_set_locked_state(gstElement
, lockedState
);
1172 * Checks if the state of an element is locked.
1173 * If the state of an element is locked, state changes of the parent don't
1174 * affect the element.
1175 * This way you can leave currently unused elements inside bins. Just lock their
1176 * state before changing the state from GST_STATE_NULL.
1181 * TRUE, if the element's state is locked.
1183 public int isLockedState()
1185 // gboolean gst_element_is_locked_state (GstElement *element);
1186 return gst_element_is_locked_state(gstElement
);
1190 * Abort the state change of the element. This function is used
1191 * by elements that do asynchronous state changes and find out
1192 * something is wrong.
1193 * This function should be called with the STATE_LOCK held.
1196 * a GstElement to abort the state of.
1198 public void abortState()
1200 // void gst_element_abort_state (GstElement *element);
1201 gst_element_abort_state(gstElement
);
1205 * Commit the state change of the element and proceed to the next
1206 * pending state if any. This function is used
1207 * by elements that do asynchronous state changes.
1208 * The core will normally call this method automatically when an
1209 * element returned GST_STATE_CHANGE_SUCCESS from the state change function.
1210 * If after calling this method the element still has not reached
1211 * the pending state, the next state change is performed.
1212 * This method is used internally and should normally not be called by plugins
1215 * a GstElement to continue the state change of.
1217 * The previous state return value
1219 * The result of the commit state change.
1222 public GstStateChangeReturn
continueState(GstStateChangeReturn
ret)
1224 // GstStateChangeReturn gst_element_continue_state (GstElement *element, GstStateChangeReturn ret);
1225 return gst_element_continue_state(gstElement
, ret);
1229 * Brings the element to the lost state. The current state of the
1230 * element is copied to the pending state so that any call to
1231 * gst_element_get_state() will return GST_STATE_CHANGE_ASYNC.
1232 * This is mostly used for elements that lost their preroll buffer
1233 * in the GST_STATE_PAUSED state after a flush, they become GST_STATE_PAUSED
1234 * again if a new preroll buffer is queued.
1235 * This function can only be called when the element is currently
1236 * not in error or an async state change.
1237 * This function is used internally and should normally not be called from
1238 * plugins or applications.
1241 * a GstElement the state is lost of
1243 public void lostState()
1245 // void gst_element_lost_state (GstElement *element);
1246 gst_element_lost_state(gstElement
);
1250 * Gets a string representing the given state.
1252 * a GstState to get the name of.
1254 * a string with the name of the state.
1256 public static char[] stateGetName(GstState state
)
1258 // const gchar* gst_element_state_get_name (GstState state);
1259 return Str
.toString(gst_element_state_get_name(state
) );
1263 * Gets a string representing the given state change result.
1265 * a GstStateChangeReturn to get the name of.
1267 * a string with the name of the state change result.
1269 public static char[] stateChangeReturnGetName(GstStateChangeReturn stateRet
)
1271 // const gchar* gst_element_state_change_return_get_name (GstStateChangeReturn state_ret);
1272 return Str
.toString(gst_element_state_change_return_get_name(stateRet
) );
1276 * Tries to change the state of the element to the same as its parent.
1277 * If this function returns FALSE, the state of element is undefined.
1281 * TRUE, if the element's state could be synced to the parent's state.
1284 public int syncStateWithParent()
1286 // gboolean gst_element_sync_state_with_parent (GstElement *element);
1287 return gst_element_sync_state_with_parent(gstElement
);
1291 * Posts a message to the bus that new tags were found, and pushes an event
1292 * to all sourcepads. Takes ownership of the list.
1293 * This is a utility method for elements. Applications should use the
1294 * GstTagSetter interface.
1296 * element for which we found the tags.
1300 public void foundTags(TagList list
)
1302 // void gst_element_found_tags (GstElement *element, GstTagList *list);
1303 gst_element_found_tags(gstElement
, (list
is null) ?
null : list
.getTagListStruct());
1307 * Posts a message to the bus that new tags were found and pushes the
1308 * tags as event. Takes ownership of the list.
1309 * This is a utility method for elements. Applications should use the
1310 * GstTagSetter interface.
1312 * element for which to post taglist to bus.
1314 * pad on which to push tag-event.
1316 * the taglist to post on the bus and create event from.
1318 public void foundTagsForPad(Pad pad
, TagList list
)
1320 // void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstTagList *list);
1321 gst_element_found_tags_for_pad(gstElement
, (pad
is null) ?
null : pad
.getPadStruct(), (list
is null) ?
null : list
.getTagListStruct());
1325 * Post an error, warning or info message on the bus from inside an element.
1326 * type must be of GST_MESSAGE_ERROR, GST_MESSAGE_WARNING or
1330 * a GstElement to send message from
1332 * the GstMessageType
1334 * the GStreamer GError domain this message belongs to
1336 * the GError code belonging to the domain
1338 * an allocated text string to be used as a replacement for the
1339 * default message connected to code, or NULL
1341 * an allocated debug message to be used as a replacement for the
1342 * default debugging information, or NULL
1344 * the source code file where the error was generated
1346 * the source code function where the error was generated
1348 * the source code line where the error was generated
1350 public void messageFull(GstMessageType type
, GQuark domain
, int code
, char[] text
, char[] dbug
, char[] file
, char[] funct
, int line
)
1352 // 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);
1353 gst_element_message_full(gstElement
, type
, domain
, code
, Str
.toStringz(text
), Str
.toStringz(dbug
), Str
.toStringz(file
), Str
.toStringz(funct
), line
);
1357 * Post a message on the element's GstBus. This function takes ownership of the
1358 * message; if you want to access the message after this call, you should add an
1359 * additional reference before calling.
1361 * a GstElement posting the message
1363 * a GstMessage to post
1365 * TRUE if the message was successfully posted. The function returns
1366 * FALSE if the element did not have a bus.
1369 public int postMessage(Message message
)
1371 // gboolean gst_element_post_message (GstElement *element, GstMessage *message);
1372 return gst_element_post_message(gstElement
, (message
is null) ?
null : message
.getMessageStruct());
1376 * Get an array of query types from the element.
1377 * If the element doesn't implement a query types function,
1378 * the query will be forwarded to the peer of a random linked sink pad.
1380 * a GstElement to query
1382 * An array of GstQueryType elements that should not
1383 * be freed or modified.
1386 public GstQueryType
* getQueryTypes()
1388 // const GstQueryType* gst_element_get_query_types (GstElement *element);
1389 return gst_element_get_query_types(gstElement
);
1393 * Performs a query on the given element.
1394 * For elements that don't implement a query handler, this function
1395 * forwards the query to a random srcpad or to the peer of a
1396 * random linked sinkpad of this element.
1398 * a GstElement to perform the query on.
1402 * TRUE if the query could be performed.
1405 public int query(Query query
)
1407 // gboolean gst_element_query (GstElement *element, GstQuery *query);
1408 return gst_element_query(gstElement
, (query
is null) ?
null : query
.getQueryStruct());
1412 * Queries an element to convert src_val in src_format to dest_format.
1414 * a GstElement to invoke the convert query on.
1416 * a GstFormat to convert from.
1418 * a value to convert.
1420 * a pointer to the GstFormat to convert to.
1422 * a pointer to the result.
1424 * TRUE if the query could be performed.
1426 public int queryConvert(GstFormat srcFormat
, long srcVal
, GstFormat
* destFormat
, long* destVal
)
1428 // gboolean gst_element_query_convert (GstElement *element, GstFormat src_format, gint64 src_val, GstFormat *dest_format, gint64 *dest_val);
1429 return gst_element_query_convert(gstElement
, srcFormat
, srcVal
, destFormat
, destVal
);
1433 * Queries an element for the stream position.
1435 * a GstElement to invoke the position query on.
1437 * a pointer to the GstFormat asked for.
1438 * On return contains the GstFormat used.
1440 * A location in which to store the current position, or NULL.
1442 * TRUE if the query could be performed.
1444 public int queryPosition(GstFormat
* format
, long* cur
)
1446 // gboolean gst_element_query_position (GstElement *element, GstFormat *format, gint64 *cur);
1447 return gst_element_query_position(gstElement
, format
, cur
);
1451 * Queries an element for the total stream duration.
1453 * a GstElement to invoke the duration query on.
1455 * a pointer to the GstFormat asked for.
1456 * On return contains the GstFormat used.
1458 * A location in which to store the total duration, or NULL.
1460 * TRUE if the query could be performed.
1462 public int queryDuration(GstFormat
* format
, long* duration
)
1464 // gboolean gst_element_query_duration (GstElement *element, GstFormat *format, gint64 *duration);
1465 return gst_element_query_duration(gstElement
, format
, duration
);
1469 * Sends an event to an element. If the element doesn't implement an
1470 * event handler, the event will be pushed on a random linked sink pad for
1471 * upstream events or a random linked source pad for downstream events.
1472 * This function takes owership of the provided event so you should
1473 * gst_event_ref() it if you want to reuse the event after this call.
1475 * a GstElement to send the event to.
1477 * the GstEvent to send to the element.
1479 * TRUE if the event was handled.
1482 public int sendEvent(Event event
)
1484 // gboolean gst_element_send_event (GstElement *element, GstEvent *event);
1485 return gst_element_send_event(gstElement
, (event
is null) ?
null : event
.getEventStruct());
1489 * Simple API to perform a seek on the given element, meaning it just seeks
1490 * to the given position relative to the start of the stream. For more complex
1491 * operations like segment seeks (e.g. for looping) or changing the playback
1492 * rate or seeking relative to the last configured playback segment you should
1493 * use gst_element_seek().
1494 * In a completely prerolled PAUSED or PLAYING pipeline, seeking is always
1495 * guaranteed to return TRUE on a seekable media type or FALSE when the media
1496 * type is certainly not seekable (such as a live stream).
1497 * Some elements allow for seeking in the READY state, in this
1498 * case they will store the seek event and execute it when they are put to
1499 * PAUSED. If the element supports seek in READY, it will always return TRUE when
1500 * it receives the event in the READY state.
1502 * a GstElement to seek on
1504 * a GstFormat to execute the seek in, such as GST_FORMAT_TIME
1508 * position to seek to (relative to the start); if you are doing
1509 * a seek in GST_FORMAT_TIME this value is in nanoseconds -
1510 * multiply with GST_SECOND to convert seconds to nanoseconds or
1511 * with GST_MSECOND to convert milliseconds to nanoseconds.
1513 * TRUE if the seek operation succeeded (the seek might not always be
1514 * executed instantly though)
1517 public int seekSimple(GstFormat format
, GstSeekFlags seekFlags
, long seekPos
)
1519 // gboolean gst_element_seek_simple (GstElement *element, GstFormat format, GstSeekFlags seek_flags, gint64 seek_pos);
1520 return gst_element_seek_simple(gstElement
, format
, seekFlags
, seekPos
);
1524 * Sends a seek event to an element. See gst_event_new_seek() for the details of
1525 * the parameters. The seek event is sent to the element using
1526 * gst_element_send_event().
1528 * a GstElement to send the event to.
1530 * The new playback rate
1532 * The format of the seek values
1534 * The optional seek flags.
1536 * The type and flags for the new current position
1538 * The value of the new current position
1540 * The type and flags for the new stop position
1542 * The value of the new stop position
1544 * TRUE if the event was handled.
1547 * The "no-more-pads" signal
1548 * void user_function (GstElement *gstelement,
1549 * gpointer user_data) : Run last
1550 * This signals that the element will not generate more dynamic pads.
1552 * the object which received the signal
1554 * user data set when the signal handler was connected.
1556 public int seek(double rate
, GstFormat format
, GstSeekFlags flags
, GstSeekType curType
, long cur
, GstSeekType stopType
, long stop
)
1558 // gboolean gst_element_seek (GstElement *element, gdouble rate, GstFormat format, GstSeekFlags flags, GstSeekType cur_type, gint64 cur, GstSeekType stop_type, gint64 stop);
1559 return gst_element_seek(gstElement
, rate
, format
, flags
, curType
, cur
, stopType
, stop
);