GstElement

GstElement — Abstract base class for all pipeline elements

Synopsis


#include <gst/gst.h>


            GstElement;
            GstElementClass;
enum        GstElementFlags;
#define     GST_STATE                       (obj)
#define     GST_STATE_PENDING               (obj)
#define     GST_STATE_BROADCAST             (elem)
#define     GST_STATE_ERROR                 (obj)
#define     GST_STATE_FINAL                 (obj)
#define     GST_STATE_GET_COND              (elem)
#define     GST_STATE_GET_LOCK              (elem)
#define     GST_STATE_LOCK                  (elem)
#define     GST_STATE_SIGNAL                (elem)
#define     GST_STATE_TIMED_WAIT            (elem, timeval)
#define     GST_STATE_TRYLOCK               (elem)
#define     GST_STATE_UNLOCK                (elem)
#define     GST_STATE_WAIT                  (elem)
#define     GST_ELEMENT_NAME                (obj)
#define     GST_ELEMENT_PARENT              (obj)
#define     GST_ELEMENT_CLOCK               (obj)
#define     GST_ELEMENT_PADS                (obj)
#define     GST_ELEMENT_ERROR               (el, domain, code, text, debug)
#define     GST_ELEMENT_BUS                 (obj)
#define     GST_ELEMENT_WARNING             (el, domain, code, text, debug)
#define     GST_ELEMENT_IS_LOCKED_STATE     (obj)
GstFlowReturn gst_element_abort_preroll     (GstElement *element);
void        gst_element_abort_state         (GstElement *element);
gboolean    gst_element_add_pad             (GstElement *element,
                                             GstPad *pad);
void        gst_element_class_add_pad_template
                                            (GstElementClass *klass,
                                             GstPadTemplate *templ);
GstPadTemplate* gst_element_class_get_pad_template
                                            (GstElementClass *element_class,
                                             const gchar *name);
GList*      gst_element_class_get_pad_template_list
                                            (GstElementClass *element_class);
void        gst_element_class_install_std_props
                                            (GstElementClass *klass,
                                             const gchar *first_name,
                                             ...);
void        gst_element_class_set_details   (GstElementClass *klass,
                                             const GstElementDetails *details);
void        gst_element_commit_state        (GstElement *element);
void        gst_element_create_all_pads     (GstElement *element);
gboolean    gst_element_factory_can_sink_caps
                                            (GstElementFactory *factory,
                                             const GstCaps *caps);
gboolean    gst_element_factory_can_src_caps
                                            (GstElementFactory *factory,
                                             const GstCaps *caps);
const GList* gst_element_factory_get_static_pad_templates
                                            (GstElementFactory *factory);
GstFlowReturn gst_element_finish_preroll    (GstElement *element,
                                             GstPad *pad);
void        gst_element_found_tags          (GstElement *element,
                                             GstTagList *list);
void        gst_element_found_tags_for_pad  (GstElement *element,
                                             GstPad *pad,
                                             GstTagList *list);
GstClockTime gst_element_get_base_time      (GstElement *element);
GstBus*     gst_element_get_bus             (GstElement *element);
GstClock*   gst_element_get_clock           (GstElement *element);
GstPad*     gst_element_get_compatible_pad  (GstElement *element,
                                             GstPad *pad,
                                             const GstCaps *caps);
GstPadTemplate* gst_element_get_compatible_pad_template
                                            (GstElement *element,
                                             GstPadTemplate *compattempl);
GstElementFactory* gst_element_get_factory  (GstElement *element);
GstIndex*   gst_element_get_index           (GstElement *element);
#define     gst_element_get_name            (elem)
GstPad*     gst_element_get_pad             (GstElement *element,
                                             const gchar *name);
#define     gst_element_get_parent          (elem)
const GstQueryType* gst_element_get_query_types
                                            (GstElement *element);
GstPad*     gst_element_get_request_pad     (GstElement *element,
                                             const gchar *name);
GstStateChangeReturn gst_element_get_state  (GstElement *element,
                                             GstState *state,
                                             GstState *pending,
                                             GTimeVal *timeout);
GstPad*     gst_element_get_static_pad      (GstElement *element,
                                             const gchar *name);
gboolean    gst_element_is_indexable        (GstElement *element);
gboolean    gst_element_is_locked_state     (GstElement *element);
GstIterator* gst_element_iterate_pads       (GstElement *element);
GstIterator* gst_element_iterate_sink_pads  (GstElement *element);
GstIterator* gst_element_iterate_src_pads   (GstElement *element);
gboolean    gst_element_link                (GstElement *src,
                                             GstElement *dest);
gboolean    gst_element_link_many           (GstElement *element_1,
                                             GstElement *element_2,
                                             ...);
gboolean    gst_element_link_pads           (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname);
gboolean    gst_element_link_pads_filtered  (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname,
                                             GstCaps *filter);
void        gst_element_lost_state          (GstElement *element);
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);
void        gst_element_no_more_pads        (GstElement *element);
gboolean    gst_element_post_message        (GstElement *element,
                                             GstMessage *message);
gboolean    gst_element_provides_clock      (GstElement *element);
gboolean    gst_element_query               (GstElement *element,
                                             GstQuery *query);
gboolean    gst_element_query_convert       (GstElement *element,
                                             GstFormat src_format,
                                             gint64 src_val,
                                             GstFormat *dest_fmt,
                                             gint64 *dest_val);
gboolean    gst_element_query_position      (GstElement *element,
                                             GstFormat *format,
                                             gint64 *cur,
                                             gint64 *end);
void        gst_element_release_request_pad (GstElement *element,
                                             GstPad *pad);
gboolean    gst_element_remove_pad          (GstElement *element,
                                             GstPad *pad);
gboolean    gst_element_requires_clock      (GstElement *element);
gboolean    gst_element_seek                (GstElement *element,
                                             gdouble rate,
                                             GstFormat format,
                                             GstSeekFlags flags,
                                             GstSeekType cur_type,
                                             gint64 cur,
                                             GstSeekType stop_type,
                                             gint64 stop);
gboolean    gst_element_send_event          (GstElement *element,
                                             GstEvent *event);
void        gst_element_set_base_time       (GstElement *element,
                                             GstClockTime time);
void        gst_element_set_bus             (GstElement *element,
                                             GstBus *bus);
void        gst_element_set_clock           (GstElement *element,
                                             GstClock *clock);
void        gst_element_set_index           (GstElement *element,
                                             GstIndex *index);
gboolean    gst_element_set_locked_state    (GstElement *element,
                                             gboolean locked_state);
#define     gst_element_set_name            (elem,name)
#define     gst_element_set_parent          (elem,parent)
GstStateChangeReturn gst_element_set_state  (GstElement *element,
                                             GstState state);
const gchar* gst_element_state_get_name     (GstState state);
gboolean    gst_element_sync_state_with_parent
                                            (GstElement *element);
void        gst_element_unlink              (GstElement *src,
                                             GstElement *dest);
void        gst_element_unlink_many         (GstElement *element_1,
                                             GstElement *element_2,
                                             ...);
void        gst_element_unlink_pads         (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname);


Object Hierarchy


  GObject
   +----GstObject
         +----GstElement
               +----GstBin
               +----GstQueue
               +----GstBaseTransform
               +----GstBaseSrc
               +----GstBaseSink

Known Derived Interfaces

GstElement is required by GstImplementsInterface and GstTagSetter.

Signal Prototypes


"no-more-pads"
            void        user_function      (GstElement *gstelement,
                                            gpointer user_data);
"pad-added" void        user_function      (GstElement *gstelement,
                                            GObject *new_pad,
                                            gpointer user_data);
"pad-removed"
            void        user_function      (GstElement *gstelement,
                                            GObject *old_pad,
                                            gpointer user_data);
"state-changed"
            void        user_function      (GstElement *gstelement,
                                            gint old_state,
                                            gint new_state,
                                            gpointer user_data);

Description

GstElement is the base class needed to construct an element that can be used in a GStreamer pipeline. As such, it is not a functional entity, and cannot do anything when placed in a pipeline.

The name of a GstElement can be get with gst_element_get_name() and set with gst_element_set_name(). For speed, GST_ELEMENT_NAME() can be used in the core. Do not use this in plug-ins or applications in order to retain ABI compatibility.

All elements have pads (of the type GstPad). These pads link to pads on other elements. Buffers flow between these linked pads. A GstElement has a GList of GstPad structures for all their input (or sink) and output (or source) pads. Core and plug-in writers can add and remove pads with gst_element_add_pad() and gst_element_remove_pad(). Application writers can manipulate ghost pads (copies of real pads inside a bin) with gst_element_add_ghost_pad() and gst_element_remove_ghost_pad(). A pad of an element can be retrieved by name with gst_element_get_pad(). A GList of all pads can be retrieved with gst_element_get_pad_list().

Elements can be linked through their pads. If the link is straightforward, use the gst_element_link() convenience function to link two elements, or gst_element_link_many() for more elements in a row. Use gst_element_link_filtered() to link two elements constrained by a specified set of GstCaps. For finer control, use gst_element_link_pads() and gst_element_link_pads_filtered() to specify the pads to link on each element by name.

Each element has a state (see GstState). You can get and set the state of an element with gst_element_get_state() and gst_element_set_state(). You can wait for an element to change it's state with gst_element_wait_state_change(). To get a string representation of a GstState, use gst_element_state_get_name().

You can get and set a GstClock on an element using gst_element_get_clock() and gst_element_set_clock(). You can wait for the clock to reach a given GstClockTime using gst_element_clock_wait().

Details

GstElement

typedef struct {
  /* element state */
  GMutex               *state_lock;
  GCond                *state_cond;
  guint8                current_state;
  guint8                pending_state;
  guint8                final_state;
  gboolean              state_error; /* flag is set when the element has an error in the last state
                                        change. it is cleared when doing another state change. */
  gboolean		no_preroll;  /* flag is set when the element cannot preroll */
  GstBus	       *bus;

  /* allocated clock */
  GstClock	       *clock;
  GstClockTimeDiff	base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */

  /* element pads, these lists can only be iterated while holding
   * the LOCK or checking the cookie after each LOCK. */
  guint16               numpads;
  GList                *pads;
  guint16               numsrcpads;
  GList                *srcpads;
  guint16               numsinkpads;
  GList                *sinkpads;
  guint32               pads_cookie;
} GstElement;


GstElementClass

typedef struct {
  GstObjectClass         parent_class;

  /* the element details */
  GstElementDetails	 details;

  /* factory that the element was created from */
  GstElementFactory	*elementfactory;

  /* templates for our pads */
  GList                 *padtemplates;
  gint                   numpadtemplates;
  guint32                pad_templ_cookie;

  /* virtual methods for subclasses */

  /* request/release pads */
  GstPad*		(*request_new_pad)	(GstElement *element, GstPadTemplate *templ, const gchar* name);
  void			(*release_pad)		(GstElement *element, GstPad *pad);

  /* state changes */
  GstStateChangeReturn (*get_state)		(GstElement * element, GstState * state,
						 GstState * pending, GTimeVal * timeout);
  GstStateChangeReturn (*change_state)		(GstElement *element, GstStateChange transition);

  /* bus */
  void			(*set_bus)		(GstElement * element, GstBus * bus);

  /* set/get clocks */
  GstClock*		(*get_clock)		(GstElement *element);
  void			(*set_clock)		(GstElement *element, GstClock *clock);

  /* index */
  GstIndex*		(*get_index)		(GstElement *element);
  void			(*set_index)		(GstElement *element, GstIndex *index);

  /* query functions */
  gboolean		(*send_event)		(GstElement *element, GstEvent *event);

  const GstQueryType*	(*get_query_types)	(GstElement *element);
  gboolean		(*query)		(GstElement *element, GstQuery *query);
} GstElementClass;


enum GstElementFlags

typedef enum
{
  /* ignore state changes from parent */
  GST_ELEMENT_LOCKED_STATE,
  
  /* the element is a sink */
  GST_ELEMENT_IS_SINK,

  /* Child is being removed from the parent bin. gst_bin_remove on a
   * child already being removed immediately returns FALSE */
  GST_ELEMENT_UNPARENTING,

  /* use some padding for future expansion */
  GST_ELEMENT_FLAG_LAST		= GST_OBJECT_FLAG_LAST + 16
} GstElementFlags;

This enum defines the standard flags that an element may have.


GST_STATE()

#define GST_STATE(obj)			(GST_ELEMENT(obj)->current_state)

This macro returns the current state of the element.

obj : Element to return state for.

GST_STATE_PENDING()

#define GST_STATE_PENDING(obj)		(GST_ELEMENT(obj)->pending_state)

This macro returns the currently pending state of the element.

obj : Element to return the pending state for.

GST_STATE_BROADCAST()

#define GST_STATE_BROADCAST(elem)              g_cond_broadcast (GST_STATE_GET_COND (elem));

elem :

GST_STATE_ERROR()

#define GST_STATE_ERROR(obj)		(GST_ELEMENT(obj)->state_error)

obj :

GST_STATE_FINAL()

#define GST_STATE_FINAL(obj)		(GST_ELEMENT(obj)->final_state)

obj :

GST_STATE_GET_COND()

#define GST_STATE_GET_COND(elem)               (GST_ELEMENT_CAST(elem)->state_cond)

elem :

GST_STATE_GET_LOCK()

#define GST_STATE_GET_LOCK(elem)               (GST_ELEMENT_CAST(elem)->state_lock)

elem :

GST_STATE_LOCK()

#define GST_STATE_LOCK(elem)                   g_mutex_lock(GST_STATE_GET_LOCK(elem))

elem :

GST_STATE_SIGNAL()

#define GST_STATE_SIGNAL(elem)                 g_cond_signal (GST_STATE_GET_COND (elem));

elem :

GST_STATE_TIMED_WAIT()

#define     GST_STATE_TIMED_WAIT(elem, timeval)

elem :
timeval :

GST_STATE_TRYLOCK()

#define GST_STATE_TRYLOCK(elem)                g_mutex_trylock(GST_STATE_GET_LOCK(elem))

elem :

GST_STATE_UNLOCK()

#define GST_STATE_UNLOCK(elem)                 g_mutex_unlock(GST_STATE_GET_LOCK(elem))

elem :

GST_STATE_WAIT()

#define GST_STATE_WAIT(elem)                   g_cond_wait (GST_STATE_GET_COND (elem), GST_STATE_GET_LOCK (elem))

elem :

GST_ELEMENT_NAME()

#define GST_ELEMENT_NAME(obj)			(GST_OBJECT_NAME(obj))

Gets the name of this element. Used in the core. Not ABI-compatible.

obj : A GstElement to query

GST_ELEMENT_PARENT()

#define GST_ELEMENT_PARENT(obj)			(GST_ELEMENT_CAST(GST_OBJECT_PARENT(obj)))

Get the parent object of this element.

obj : a GstElement to query

GST_ELEMENT_CLOCK()

#define GST_ELEMENT_CLOCK(obj)			(GST_ELEMENT_CAST(obj)->clock)

Get the clock of this element

obj : a GstElement to query

GST_ELEMENT_PADS()

#define GST_ELEMENT_PADS(obj)			(GST_ELEMENT_CAST(obj)->pads)

Get the pads of this elements.

obj : a GstElement to query

GST_ELEMENT_ERROR()

#define     GST_ELEMENT_ERROR(el, domain, code, text, debug)

Utility function that elements can use in case they encountered a fatal data processing error. The pipeline will throw an error signal and the application will be requested to stop further media processing.

el : the element that throws the error
domain : like CORE, LIBRARY, RESOURCE or STREAM (see GstError)
code : error code defined for that domain (see GstError)
text : the message to display (format string and args enclosed in parentheses)
debug : debugging information for the message (format string and args enclosed in parentheses)

GST_ELEMENT_BUS()

#define GST_ELEMENT_BUS(obj)			(GST_ELEMENT_CAST(obj)->bus)

obj :

GST_ELEMENT_WARNING()

#define     GST_ELEMENT_WARNING(el, domain, code, text, debug)

el :
domain :
code :
text :
debug :

GST_ELEMENT_IS_LOCKED_STATE()

#define GST_ELEMENT_IS_LOCKED_STATE(obj)        (GST_FLAG_IS_SET(obj,GST_ELEMENT_LOCKED_STATE))

obj :

gst_element_abort_preroll ()

GstFlowReturn gst_element_abort_preroll     (GstElement *element);

element :
Returns :

gst_element_abort_state ()

void        gst_element_abort_state         (GstElement *element);

Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.

This function should be called with the STATE_LOCK held.

MT safe.

element : a GstElement to abort the state of.

gst_element_add_pad ()

gboolean    gst_element_add_pad             (GstElement *element,
                                             GstPad *pad);

Adds a pad (link point) to element. pad's parent will be set to element; see gst_object_set_parent() for refcounting information.

Pads are not automatically activated so elements should perform the needed steps to activate the pad.

The pad and the element should be unlocked when calling this function.

element : a GstElement to add the pad to.
pad : the GstPad to add to the element.
Returns : TRUE if the pad could be added. This function can fail when passing bad arguments or when a pad with the same name already existed. MT safe.

gst_element_class_add_pad_template ()

void        gst_element_class_add_pad_template
                                            (GstElementClass *klass,
                                             GstPadTemplate *templ);

Adds a padtemplate to an element class. This is mainly used in the _base_init functions of classes.

klass : the GstElementClass to add the pad template to.
templ : a GstPadTemplate to add to the element class.

gst_element_class_get_pad_template ()

GstPadTemplate* gst_element_class_get_pad_template
                                            (GstElementClass *element_class,
                                             const gchar *name);

Retrieves a padtemplate from element_class with the given name.

Note

If you use this function in the GInstanceInitFunc of an object class that has subclasses, make sure to pass the g_class parameter of the GInstanceInitFunc here.

element_class : a GstElementClass to get the pad template of.
name : the name of the GstPadTemplate to get.
Returns : the GstPadTemplate with the given name, or NULL if none was found. No unreferencing is necessary.

gst_element_class_get_pad_template_list ()

GList*      gst_element_class_get_pad_template_list
                                            (GstElementClass *element_class);

Retrieves a list of the pad templates associated with element_class. The list must not be modified by the calling code.

Note

If you use this function in the GInstanceInitFunc of an object class that has subclasses, make sure to pass the g_class parameter of the GInstanceInitFunc here.

element_class : a GstElementClass to get pad templates of.
Returns : the GList of padtemplates.

gst_element_class_install_std_props ()

void        gst_element_class_install_std_props
                                            (GstElementClass *klass,
                                             const gchar *first_name,
                                             ...);

Adds a list of standardized properties with types to the klass. the id is for the property switch in your get_prop method, and the flags determine readability / writeability.

klass : the GstElementClass to add the properties to.
first_name : the name of the first property. in a NULL terminated
... : the id and flags of the first property, followed by further 'name', 'id', 'flags' triplets and terminated by NULL.

gst_element_class_set_details ()

void        gst_element_class_set_details   (GstElementClass *klass,
                                             const GstElementDetails *details);

Sets the detailed information for a GstElementClass.

Note

This function is for use in _base_init functions only.

klass : class to set details for
details : details to set

gst_element_commit_state ()

void        gst_element_commit_state        (GstElement *element);

Commit the state change of the element. This function is used by elements that do asynchronous state changes.

This function can only be called with the STATE_LOCK held.

MT safe.

element : a GstElement to commit the state of.

gst_element_create_all_pads ()

void        gst_element_create_all_pads     (GstElement *element);

Creates a pad for each pad template that is always available. This function is only useful during object intialization of subclasses of GstElement.

element : a GstElement to create pads for

gst_element_factory_can_sink_caps ()

gboolean    gst_element_factory_can_sink_caps
                                            (GstElementFactory *factory,
                                             const GstCaps *caps);

Checks if the factory can sink the given capability.

factory : factory to query
caps : the caps to check
Returns : true if it can sink the capabilities

gst_element_factory_can_src_caps ()

gboolean    gst_element_factory_can_src_caps
                                            (GstElementFactory *factory,
                                             const GstCaps *caps);

Checks if the factory can source the given capability.

factory : factory to query
caps : the caps to check
Returns : true if it can src the capabilities

gst_element_factory_get_static_pad_templates ()

const GList* gst_element_factory_get_static_pad_templates
                                            (GstElementFactory *factory);

Gets the GList of padtemplates for this factory.

factory : a GstElementFactory
Returns : the padtemplates

gst_element_finish_preroll ()

GstFlowReturn gst_element_finish_preroll    (GstElement *element,
                                             GstPad *pad);

element :
pad :
Returns :

gst_element_found_tags ()

void        gst_element_found_tags          (GstElement *element,
                                             GstTagList *list);

Posts a message to the bus that new tags were found, and pushes an event to all sourcepads. Takes ownership of the taglist.

element : element for which we found the tags.
list : list of tags.

gst_element_found_tags_for_pad ()

void        gst_element_found_tags_for_pad  (GstElement *element,
                                             GstPad *pad,
                                             GstTagList *list);

Posts a message to the bus that new tags were found and pushes the tags as event. Takes ownership of the taglist.

element : element for which to post taglist to bus.
pad : pad on which to push tag-event.
list : the taglist to post on the bus and create event from.

gst_element_get_base_time ()

GstClockTime gst_element_get_base_time      (GstElement *element);

Returns the base time of the element. The base time is the absolute time of the clock when this element was last put to PLAYING. Substracting the base time from the clock time gives the stream time of the element.

element : a GstElement.
Returns : the base time of the element. MT safe.

gst_element_get_bus ()

GstBus*     gst_element_get_bus             (GstElement *element);

Returns the bus of the element.

element : a GstElement to get the bus of.
Returns : the element's GstBus. unref after usage. MT safe.

gst_element_get_clock ()

GstClock*   gst_element_get_clock           (GstElement *element);

Gets the clock of the element. If the element provides a clock, this function will return this clock. For elements that do not provide a clock, this function returns NULL.

element : a GstElement to get the clock of.
Returns : the GstClock of the element. unref after usage. MT safe.

gst_element_get_compatible_pad ()

GstPad*     gst_element_get_compatible_pad  (GstElement *element,
                                             GstPad *pad,
                                             const GstCaps *caps);

Looks for an unlinked pad to which the given pad can link. It is not guaranteed that linking the pads will work, though it should work in most cases.

element : a GstElement in which the pad should be found.
pad : the GstPad to find a compatible one for.
caps : the GstCaps to use as a filter.
Returns : the GstPad to which a link can be made, or NULL if one cannot be found.

gst_element_get_compatible_pad_template ()

GstPadTemplate* gst_element_get_compatible_pad_template
                                            (GstElement *element,
                                             GstPadTemplate *compattempl);

Retrieves a pad template from element that is compatible with compattempl. Pads from compatible templates can be linked together.

element : a GstElement to get a compatible pad template for.
compattempl : the GstPadTemplate to find a compatible template for.
Returns : a compatible GstPadTemplate, or NULL if none was found. No unreferencing is necessary.

gst_element_get_factory ()

GstElementFactory* gst_element_get_factory  (GstElement *element);

Retrieves the factory that was used to create this element.

element : a GstElement to request the element factory of.
Returns : the GstElementFactory used for creating this element.

gst_element_get_index ()

GstIndex*   gst_element_get_index           (GstElement *element);

Gets the index from the element.

element : a GstElement.
Returns : a GstIndex or NULL when no index was set on the element. unref after usage. MT safe.

gst_element_get_name()

#define			gst_element_get_name(elem)	gst_object_get_name(GST_OBJECT(elem))

Gets the name of the element.

elem :
Returns : the name of the element.

gst_element_get_pad ()

GstPad*     gst_element_get_pad             (GstElement *element,
                                             const gchar *name);

Retrieves a pad from element by name. Tries gst_element_get_static_pad() first, then gst_element_get_request_pad().

element : a GstElement.
name : the name of the pad to retrieve.
Returns : the GstPad if found, otherwise NULL. Unref after usage.

gst_element_get_parent()

#define			gst_element_get_parent(elem)	gst_object_get_parent(GST_OBJECT(elem))

Gets the parent of an element.

elem : a GstElement to get the parent of.
Returns : the GstObject parent of the element.

gst_element_get_query_types ()

const GstQueryType* gst_element_get_query_types
                                            (GstElement *element);

Get an array of query types from the element. If the element doesn't implement a query types function, the query will be forwarded to a random sink pad.

element : a GstElement to query
Returns : An array of GstQueryType elements that should not be freed or modified. MT safe.

gst_element_get_request_pad ()

GstPad*     gst_element_get_request_pad     (GstElement *element,
                                             const gchar *name);

Retrieves a pad from the element by name. This version only retrieves request pads.

element : a GstElement to find a request pad of.
name : the name of the request GstPad to retrieve.
Returns : requested GstPad if found, otherwise NULL. Unref after usage.

gst_element_get_state ()

GstStateChangeReturn gst_element_get_state  (GstElement *element,
                                             GstState *state,
                                             GstState *pending,
                                             GTimeVal *timeout);

Gets the state of the element.

For elements that performed an ASYNC state change, as reported by #gst_element_set_state(), this function will block up to the specified timeout value for the state change to complete. If the element completes the state change or goes into an error, this function returns immediatly with a return value of GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively.

element : a GstElement to get the state of.
state : a pointer to GstState to hold the state. Can be NULL.
pending : a pointer to GstState to hold the pending state. Can be NULL.
timeout : a GTimeVal to specify the timeout for an async state change or NULL for infinite timeout.
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.

gst_element_get_static_pad ()

GstPad*     gst_element_get_static_pad      (GstElement *element,
                                             const gchar *name);

Retrieves a pad from element by name. This version only retrieves already-existing (i.e. 'static') pads.

element : a GstElement to find a static pad of.
name : the name of the static GstPad to retrieve.
Returns : the requested GstPad if found, otherwise NULL. unref after usage. MT safe.

gst_element_is_indexable ()

gboolean    gst_element_is_indexable        (GstElement *element);

Queries if the element can be indexed.

element : a GstElement.
Returns : TRUE if the element can be indexed. MT safe.

gst_element_is_locked_state ()

gboolean    gst_element_is_locked_state     (GstElement *element);

Checks if the state of an element is locked. If the state of an element is locked, state changes of the parent don't affect the element. This way you can leave currently unused elements inside bins. Just lock their state before changing the state from GST_STATE_NULL.

element : a GstElement.
Returns : TRUE, if the element's state is locked. MT safe.

gst_element_iterate_pads ()

GstIterator* gst_element_iterate_pads       (GstElement *element);

Retrieves an iterattor of element's pads.

element : a GstElement to iterate pads of.
Returns : the GstIterator of GstPad. Unref each pad after use. MT safe.

gst_element_iterate_sink_pads ()

GstIterator* gst_element_iterate_sink_pads  (GstElement *element);

Retrieves an iterator of element's sink pads.

element : a GstElement.
Returns : the GstIterator of GstPad. Unref each pad after use. MT safe.

gst_element_iterate_src_pads ()

GstIterator* gst_element_iterate_src_pads   (GstElement *element);

Retrieves an iterator of element's source pads.

element : a GstElement.
Returns : the GstIterator of GstPad. Unref each pad after use. MT safe.

gst_element_link ()

gboolean    gst_element_link                (GstElement *src,
                                             GstElement *dest);

Links src to dest. The link must be from source to destination; the other direction will not be tried. The function looks for existing pads that aren't linked yet. It will request new pads if necessary. If multiple links are possible, only one is established.

src : a GstElement containing the source pad.
dest : the GstElement containing the destination pad.
Returns : TRUE if the elements could be linked, FALSE otherwise.

gst_element_link_many ()

gboolean    gst_element_link_many           (GstElement *element_1,
                                             GstElement *element_2,
                                             ...);

Chain together a series of elements. Uses gst_element_link().

element_1 : the first GstElement in the link chain.
element_2 : the second GstElement in the link chain.
... : the NULL-terminated list of elements to link in order.
Returns : TRUE on success, FALSE otherwise.

gst_element_link_pads ()

gboolean    gst_element_link_pads           (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname);

Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails.

src : a GstElement containing the source pad.
srcpadname : the name of the GstPad in source element or NULL for any pad.
dest : the GstElement containing the destination pad.
destpadname : the name of the GstPad in destination element or NULL for any pad.
Returns : TRUE if the pads could be linked, FALSE otherwise.

gst_element_link_pads_filtered ()

gboolean    gst_element_link_pads_filtered  (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname,
                                             GstCaps *filter);

Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails. If caps is not NULL, makes sure that the caps of the link is a subset of caps.

src : a GstElement containing the source pad.
srcpadname : the name of the GstPad in source element or NULL for any pad.
dest : the GstElement containing the destination pad.
destpadname : the name of the GstPad in destination element or NULL for any pad.
filter : the GstCaps to filter the link, or NULL for no filter.
Returns : TRUE if the pads could be linked, FALSE otherwise.

gst_element_lost_state ()

void        gst_element_lost_state          (GstElement *element);

Brings the element to the lost state. The current state of the element is copied to the pending state so that any call to #gst_element_get_state() will return ASYNC. This is mostly used for elements that lost their preroll buffer in the PAUSED state after a flush, they become PAUSED again if a new preroll buffer is queued. This function can only be called when the element is currently not in error or an async state change.

This function can only be called with the STATE_LOCK held.

MT safe.

element : a GstElement the state is lost of

gst_element_message_full ()

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);

Post an error or warning message on the bus from inside an element.

MT safe.

element : a GstElement to send message from
type : the GstMessageType
domain : the GStreamer GError domain this message belongs to
code : the GError code belonging to the domain
text : an allocated text string to be used as a replacement for the default message connected to code, or NULL
debug : an allocated debug message to be used as a replacement for the default debugging information, or NULL
file : the source code file where the error was generated
function : the source code function where the error was generated
line : the source code line where the error was generated

gst_element_no_more_pads ()

void        gst_element_no_more_pads        (GstElement *element);

Use this function to signal that the element does not expect any more pads to show up in the current pipeline. This function should be called whenever pads have been added by the element itself. Elements with GST_PAD_SOMETIMES pad templates use this in combination with autopluggers to figure out that the element is done initializing its pads.

MT safe.

element : a GstElement

gst_element_post_message ()

gboolean    gst_element_post_message        (GstElement *element,
                                             GstMessage *message);

Post a message on the element's GstBus.

element : a GstElement posting the message
message : a GstMessage to post
Returns : TRUE if the message was successfully posted. MT safe.

gst_element_provides_clock ()

gboolean    gst_element_provides_clock      (GstElement *element);

Query if the element provides a clock.

element : a GstElement to query
Returns : TRUE if the element provides a clock MT safe.

gst_element_query ()

gboolean    gst_element_query               (GstElement *element,
                                             GstQuery *query);

Performs a query on the given element. If the format is set to GST_FORMAT_DEFAULT and this function returns TRUE, the format pointer will hold the default format. For element that don't implement a query handler, this function forwards the query to a random usable sinkpad of this element.

element : a GstElement to perform the query on.
query : the GstQuery.
Returns : TRUE if the query could be performed. MT safe.

gst_element_query_convert ()

gboolean    gst_element_query_convert       (GstElement *element,
                                             GstFormat src_format,
                                             gint64 src_val,
                                             GstFormat *dest_fmt,
                                             gint64 *dest_val);

element :
src_format :
src_val :
dest_fmt :
dest_val :
Returns :

gst_element_query_position ()

gboolean    gst_element_query_position      (GstElement *element,
                                             GstFormat *format,
                                             gint64 *cur,
                                             gint64 *end);

element :
format :
cur :
end :
Returns :

gst_element_release_request_pad ()

void        gst_element_release_request_pad (GstElement *element,
                                             GstPad *pad);

Makes the element free the previously requested pad as obtained with gst_element_get_request_pad().

MT safe.

element : a GstElement to release the request pad of.
pad : the GstPad to release.

gst_element_remove_pad ()

gboolean    gst_element_remove_pad          (GstElement *element,
                                             GstPad *pad);

Removes pad from element. pad will be destroyed if it has not been referenced elsewhere.

element : a GstElement to remove pad from.
pad : the GstPad to remove from the element.
Returns : TRUE if the pad could be removed. Can return FALSE if the pad is not belonging to the provided element or when wrong parameters are passed to this function. MT safe.

gst_element_requires_clock ()

gboolean    gst_element_requires_clock      (GstElement *element);

Query if the element requires a clock.

element : a GstElement to query
Returns : TRUE if the element requires a clock MT safe.

gst_element_seek ()

gboolean    gst_element_seek                (GstElement *element,
                                             gdouble rate,
                                             GstFormat format,
                                             GstSeekFlags flags,
                                             GstSeekType cur_type,
                                             gint64 cur,
                                             GstSeekType stop_type,
                                             gint64 stop);

Sends a seek event to an element.

element : a GstElement to send the event to.
rate : The new playback rate
format : The format of the seek values
flags : The optional seek flags.
cur_type : The type and flags for the new current position
cur : The value of the new current position
stop_type : The type and flags for the new stop position
stop : The value of the new stop position
Returns : TRUE if the event was handled. MT safe.

gst_element_send_event ()

gboolean    gst_element_send_event          (GstElement *element,
                                             GstEvent *event);

Sends an event to an element. If the element doesn't implement an event handler, the event will be forwarded to a random sink pad. This function takes owership of the provided event so you should _ref it if you want to reuse the event after this call.

element : a GstElement to send the event to.
event : the GstEvent to send to the element.
Returns : TRUE if the event was handled. MT safe.

gst_element_set_base_time ()

void        gst_element_set_base_time       (GstElement *element,
                                             GstClockTime time);

Set the base time of an element. See @gst_element_get_base_time().

MT safe.

element : a GstElement.
time : the base time to set.

gst_element_set_bus ()

void        gst_element_set_bus             (GstElement *element,
                                             GstBus *bus);

Sets the bus of the element. For internal use only, unless you're testing elements.

MT safe.

element : a GstElement to set the bus of.
bus : the GstBus to set.

gst_element_set_clock ()

void        gst_element_set_clock           (GstElement *element,
                                             GstClock *clock);

Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.

MT safe.

element : a GstElement to set the clock for.
clock : the GstClock to set for the element.

gst_element_set_index ()

void        gst_element_set_index           (GstElement *element,
                                             GstIndex *index);

Set the specified GstIndex on the element.

MT safe.

element : a GstElement.
index : a GstIndex.

gst_element_set_locked_state ()

gboolean    gst_element_set_locked_state    (GstElement *element,
                                             gboolean locked_state);

Locks the state of an element, so state changes of the parent don't affect this element anymore.

element : a GstElement
locked_state : TRUE to lock the element's state
Returns : TRUE if the state was changed, FALSE if bad params were given or the element was already in the correct state. MT safe.

gst_element_set_name()

#define			gst_element_set_name(elem,name)	gst_object_set_name(GST_OBJECT(elem),name)

Sets the name of the element, getting rid of the old name if there was one.

elem : a GstElement to set the name of.
name : the new name of the element.

gst_element_set_parent()

#define			gst_element_set_parent(elem,parent)	gst_object_set_parent(GST_OBJECT(elem),parent)

Sets the parent of an element.

elem : a GstElement to set the parent of.
parent : the new GstObject parent of the object.

gst_element_set_state ()

GstStateChangeReturn gst_element_set_state  (GstElement *element,
                                             GstState state);

Sets the state of the element. This function will try to set the requested state by going through all the intermediary states and calling the class's state change function for each.

element : a GstElement to change state of.
state : the element's new GstState.
Returns : Result of the state change using GstStateChangeReturn. MT safe.

gst_element_state_get_name ()

const gchar* gst_element_state_get_name     (GstState state);

Gets a string representing the given state.

state : a GstState to get the name of.
Returns : a string with the name of the state.

gst_element_sync_state_with_parent ()

gboolean    gst_element_sync_state_with_parent
                                            (GstElement *element);

Tries to change the state of the element to the same as its parent. If this function returns FALSE, the state of element is undefined.

element : a GstElement.
Returns : TRUE, if the element's state could be synced to the parent's state.

gst_element_unlink ()

void        gst_element_unlink              (GstElement *src,
                                             GstElement *dest);

Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.

src : the source GstElement to unlink.
dest : the sink GstElement to unlink.

gst_element_unlink_many ()

void        gst_element_unlink_many         (GstElement *element_1,
                                             GstElement *element_2,
                                             ...);

Unlinks a series of elements. Uses gst_element_unlink().

element_1 : the first GstElement in the link chain.
element_2 : the second GstElement in the link chain.
... : the NULL-terminated list of elements to unlink in order.

gst_element_unlink_pads ()

void        gst_element_unlink_pads         (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname);

Unlinks the two named pads of the source and destination elements.

src : a GstElement containing the source pad.
srcpadname : the name of the GstPad in source element.
dest : a GstElement containing the destination pad.
destpadname : the name of the GstPad in destination element.

Signals

The "no-more-pads" signal

void        user_function                  (GstElement *gstelement,
                                            gpointer user_data);

This signals that the element will not generate more dynamic pads.

gstelement : the object which received the signal
user_data : user data set when the signal handler was connected.

The "pad-added" signal

void        user_function                  (GstElement *gstelement,
                                            GObject *new_pad,
                                            gpointer user_data);

a new GstPad has been added to the element

gstelement : the object which received the signal
new_pad : the pad that has been added
user_data : user data set when the signal handler was connected.

The "pad-removed" signal

void        user_function                  (GstElement *gstelement,
                                            GObject *old_pad,
                                            gpointer user_data);

a GstPad has been removed from the element

gstelement : the object which received the signal
old_pad : the pad that has been removed
user_data : user data set when the signal handler was connected.

The "state-changed" signal

void        user_function                  (GstElement *gstelement,
                                            gint old_state,
                                            gint new_state,
                                            gpointer user_data);

the GstState of the element has been changed

gstelement : the object which received the signal
old_state : the GST_STATE_XXX before the change
new_state : the GST_STATE_XXX after the change
user_data : user data set when the signal handler was connected.

See Also

GstElementFactory, GstPad