GstElement

GstElement — Abstract base class for all pipeline elements

Synopsis


#include <gst/gst.h>


struct      GstElement;
#define     GST_NUM_STATES
#define     GST_STATE                       (obj)
#define     GST_STATE_PENDING               (obj)
#define     GST_STATE_TRANSITION            (obj)
#define     GST_STATE_NULL_TO_READY
#define     GST_STATE_READY_TO_PAUSED
#define     GST_STATE_PAUSED_TO_PLAYING
#define     GST_STATE_PLAYING_TO_PAUSED
#define     GST_STATE_PAUSED_TO_READY
#define     GST_STATE_READY_TO_NULL
#define     GST_ELEMENT_QUERY_TYPE_FUNCTION (functionname, ...)
#define     GST_ELEMENT_FORMATS_FUNCTION    (functionname, ...)
#define     GST_ELEMENT_EVENT_MASK_FUNCTION (functionname, ...)
enum        GstElementFlags;
#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)
void        gst_element_class_add_pad_template
                                            (GstElementClass *klass,
                                             GstPadTemplate *templ);
void        gst_element_class_install_std_props
                                            (GstElementClass *klass,
                                             const gchar *first_name,
                                             ...);
void        gst_element_class_set_details   (GstElementClass *klass,
                                             const GstElementDetails *details);
#define     gst_element_get_name            (elem)
#define     gst_element_set_name            (elem,name)
#define     gst_element_get_parent          (elem)
#define     gst_element_set_parent          (elem,parent)
gboolean    gst_element_requires_clock      (GstElement *element);
gboolean    gst_element_provides_clock      (GstElement *element);
GstClock*   gst_element_get_clock           (GstElement *element);
void        gst_element_set_clock           (GstElement *element,
                                             GstClock *clock);
gboolean    gst_element_is_indexable        (GstElement *element);
void        gst_element_set_index           (GstElement *element,
                                             GstIndex *index);
GstIndex*   gst_element_get_index           (GstElement *element);
void        gst_element_set_scheduler       (GstElement *element,
                                             GstScheduler *sched);
GstScheduler* gst_element_get_scheduler     (GstElement *element);
gboolean    gst_element_add_pad             (GstElement *element,
                                             GstPad *pad);
gboolean    gst_element_remove_pad          (GstElement *element,
                                             GstPad *pad);
GstPad*     gst_element_get_pad             (GstElement *element,
                                             const gchar *name);
GstPad*     gst_element_get_static_pad      (GstElement *element,
                                             const gchar *name);
GstPad*     gst_element_get_request_pad     (GstElement *element,
                                             const gchar *name);
void        gst_element_release_request_pad (GstElement *element,
                                             GstPad *pad);
GstPad*     gst_element_get_compatible_pad  (GstElement *element,
                                             GstPad *pad,
                                             const GstCaps *caps);
GstPadTemplate* gst_element_class_get_pad_template
                                            (GstElementClass *element_class,
                                             const gchar *name);
GList*      gst_element_class_get_pad_template_list
                                            (GstElementClass *element_class);
GstPadTemplate* gst_element_get_compatible_pad_template
                                            (GstElement *element,
                                             GstPadTemplate *compattempl);
gboolean    gst_element_link                (GstElement *src,
                                             GstElement *dest);
gboolean    gst_element_link_many           (GstElement *element_1,
                                             GstElement *element_2,
                                             ...);
void        gst_element_unlink              (GstElement *src,
                                             GstElement *dest);
void        gst_element_unlink_many         (GstElement *element_1,
                                             GstElement *element_2,
                                             ...);
gboolean    gst_element_link_pads           (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname);
void        gst_element_unlink_pads         (GstElement *src,
                                             const gchar *srcpadname,
                                             GstElement *dest,
                                             const gchar *destpadname);
gboolean    gst_element_send_event          (GstElement *element,
                                             GstEvent *event);
gboolean    gst_element_seek                (GstElement *element,
                                             GstSeekType seek_type,
                                             guint64 offset);
G_CONST_RETURN GstQueryType* gst_element_get_query_types
                                            (GstElement *element);
gboolean    gst_element_query               (GstElement *element,
                                             GstQuery *query);
gboolean    gst_element_is_locked_state     (GstElement *element);
gboolean    gst_element_set_locked_state    (GstElement *element,
                                             gboolean locked_state);
gboolean    gst_element_sync_state_with_parent
                                            (GstElement *element);
GstElementStateReturn gst_element_get_state (GstElement *element,
                                             GstElementState *state,
                                             GstElementState *pending,
                                             GTimeVal *timeout);
GstElementStateReturn gst_element_set_state (GstElement *element,
                                             GstElementState state);
G_CONST_RETURN gchar* gst_element_state_get_name
                                            (GstElementState state);
GstElementFactory* gst_element_get_factory  (GstElement *element);
void        gst_element_no_more_pads        (GstElement *element);


Object Hierarchy


  GObject
   +----GstObject
         +----GstElement
               +----GstBin
               +----GstQueue
               +----GstVorbisTag
               +----GstBaseSrc
               +----GstBaseTransform
               +----GstAudiorate
               +----GstFFMpegColorspace
               +----GstCapsFilter
               +----GstBaseSink
               +----GstTee
               +----GstTypeFindElement

Known Derived Interfaces

GstElement is required by GstMixer, GstImplementsInterface and GstTagSetter.

Signal Prototypes


"new-pad"   void        user_function      (GstElement *gstelement,
                                            GObject *object,
                                            gpointer user_data);
"no-more-pads"
            void        user_function      (GstElement *gstelement,
                                            gpointer user_data);
"pad-removed"
            void        user_function      (GstElement *gstelement,
                                            GObject *object,
                                            gpointer user_data);
"state-change"
            void        user_function      (GstElement *gstelement,
                                            gint int,
                                            gint int,
                                            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 GstElementState). 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 GstElementState, 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

struct GstElement

struct GstElement {
  /* element state */
  GMutex               *state_lock;
  GCond                *state_cond;
  guint8                current_state;
  guint8                pending_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. */
  /* element manager */
  GstPipeline  	       *manager;
  GstBus       	       *bus;
  GstScheduler 	       *scheduler;

  /* 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;

};


GST_NUM_STATES

#define GST_NUM_STATES 4

The maximun number of states.


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_TRANSITION()

#define GST_STATE_TRANSITION(obj)	((GST_STATE(obj)<<8) | GST_STATE_PENDING(obj))

Returns the state transition this object is going through.

obj :the Element to return the state transition for

GST_STATE_NULL_TO_READY

#define GST_STATE_NULL_TO_READY		((GST_STATE_NULL<<8) | GST_STATE_READY)

The Element is going from the NULL state to the READY state.


GST_STATE_READY_TO_PAUSED

#define GST_STATE_READY_TO_PAUSED	((GST_STATE_READY<<8) | GST_STATE_PAUSED)

The Element is going from the READY state to the PAUSED state.


GST_STATE_PAUSED_TO_PLAYING

#define GST_STATE_PAUSED_TO_PLAYING	((GST_STATE_PAUSED<<8) | GST_STATE_PLAYING)

The Element is going from the PAUSED state to the PLAYING state.


GST_STATE_PLAYING_TO_PAUSED

#define GST_STATE_PLAYING_TO_PAUSED	((GST_STATE_PLAYING<<8) | GST_STATE_PAUSED)

The Element is going from the PLAYING state to the PAUSED state.


GST_STATE_PAUSED_TO_READY

#define GST_STATE_PAUSED_TO_READY	((GST_STATE_PAUSED<<8) | GST_STATE_READY)

The Element is going from the PAUSED state to the READY state.


GST_STATE_READY_TO_NULL

#define GST_STATE_READY_TO_NULL		((GST_STATE_READY<<8) | GST_STATE_NULL)

The Element is going from the READY state to the NULL state.


GST_ELEMENT_QUERY_TYPE_FUNCTION()

#define     GST_ELEMENT_QUERY_TYPE_FUNCTION(functionname, ...)

Helper macro to create query type functions

functionname :The function name
... :list of query types.

GST_ELEMENT_FORMATS_FUNCTION()

#define     GST_ELEMENT_FORMATS_FUNCTION(functionname, ...)

Halper macro to create element format functions

functionname :The function name
... :formats

GST_ELEMENT_EVENT_MASK_FUNCTION()

#define     GST_ELEMENT_EVENT_MASK_FUNCTION(functionname, ...)

A helper macro to create a mask function

functionname :the name of the mask function
... :Masks

enum GstElementFlags

typedef enum
{
  /* private flags that can be used by the scheduler */
  GST_ELEMENT_SCHEDULER_PRIVATE1,
  GST_ELEMENT_SCHEDULER_PRIVATE2,

  /* ignore state changes from parent */
  GST_ELEMENT_LOCKED_STATE,

  /* the element is a sink */
  GST_ELEMENT_IS_SINK,

  /* 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_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 :
debug : debugging information for the message (format string and args enclosed in round brackets)

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_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_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_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_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_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_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_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_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_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_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_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_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_set_scheduler ()

void        gst_element_set_scheduler       (GstElement *element,
                                             GstScheduler *sched);

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

MT safe.

element : a GstElement to set the scheduler of.
sched :

gst_element_get_scheduler ()

GstScheduler* gst_element_get_scheduler     (GstElement *element);

Returns the scheduler of the element.

element : a GstElement to get the scheduler of.
Returns : the element's GstScheduler. MT safe.

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_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_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_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_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_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_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 :
Returns : the GstPad to which a link can be made, or NULL if one cannot be found.

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_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_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_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_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_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.

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_seek ()

gboolean    gst_element_seek                (GstElement *element,
                                             GstSeekType seek_type,
                                             guint64 offset);

Sends a seek event to an element.

element : a GstElement to send the event to.
seek_type : the method to use for seeking.
offset : the offset to seek to.
Returns : TRUE if the event was handled. MT safe.

gst_element_get_query_types ()

G_CONST_RETURN 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_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 :
Returns : TRUE if the query could be performed. 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_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_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_get_state ()

GstElementStateReturn gst_element_get_state (GstElement *element,
                                             GstElementState *state,
                                             GstElementState *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_SUCCESS or GST_STATE_FAILURE respectively.

element : a GstElement to get the state of.
state : a pointer to GstElementState to hold the state. Can be NULL.
pending : a pointer to GstElementState 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_SUCCESS if the element has no more pending state and the last state change succeeded, GST_STATE_ASYNC if the element is still performing a state change or GST_STATE_FAILURE if the last state change failed. MT safe.

gst_element_set_state ()

GstElementStateReturn gst_element_set_state (GstElement *element,
                                             GstElementState 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 GstElementState.
Returns : Result of the state change using GstElementStateReturn. MT safe.

gst_element_state_get_name ()

G_CONST_RETURN gchar* gst_element_state_get_name
                                            (GstElementState state);

Gets a string representing the given state.

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

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_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

Signals

The "new-pad" signal

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

a new GstPad has been added to the element

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

The "no-more-pads" signal

void        user_function                  (GstElement *gstelement,
                                            gpointer user_data);

?

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

The "pad-removed" signal

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

a GstPad has been removed from the element

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

The "state-change" signal

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

the GstElementState of the element has been changed

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

See Also

GstElementFactory, GstPad