GStreamer Library Reference Manual (Core) | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
"state-change" void user_function (GstElement *gstelement, |
GstElement is the base class needed to construct an element that can be used in a GST pipeline. As such, it is not a functional entity, and cannot do anything when placed in a pipeline.
All GstElements have a list containing the GstPad structure for all their inputs and outputs. These can be added with gst_element_add_pad() or gst_element_add_ghost_pad(), and retrieved by name with gst_element_get_pad(), or in a list form by gst_element_get_pad_list().
gst_element_connect() is a convenience function provided to make it simpler to connect pads of two elements together.
typedef enum { GST_STATE_VOID_PENDING = 0, GST_STATE_NULL = (1 << 0), GST_STATE_READY = (1 << 1), GST_STATE_PAUSED = (1 << 2), GST_STATE_PLAYING = (1 << 3), } GstElementState; |
This enum defines the standard states an element may be in. You will normally use gst_element_set_state() to change the state of an element.
GST_STATE_VOID_PENDING | |
GST_STATE_NULL | Reset the state of an element. |
GST_STATE_READY | will make the element ready to start processing data. some elements might have a non trivial way to initialize themselves. |
GST_STATE_PAUSED | means there really is data flowing temporary stops the data flow. |
GST_STATE_PLAYING | means there really is data flowing through the graph. |
typedef enum { GST_STATE_FAILURE = 0, GST_STATE_SUCCESS = 1, GST_STATE_ASYNC = 2, } GstElementStateReturn; |
This enum defines the standard return values that an element can return after a state change.
#define GST_STATE(obj) (GST_ELEMENT(obj)->current_state) |
This macro returns the current state of the element.
#define GST_STATE_PENDING(obj) (GST_ELEMENT(obj)->pending_state) |
This macro returns the currently pending state of the element.
#define GST_STATE_TRANSITION(obj) ((GST_STATE(obj)<<8) | GST_STATE_PENDING(obj)) |
Returns the state transition this object is going through.
#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.
#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.
#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.
#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.
#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.
#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.
typedef enum { /* element is complex (for some def.) and generally require a cothread */ GST_ELEMENT_COMPLEX = GST_OBJECT_FLAG_LAST, /* input and output pads aren't directly coupled to each other examples: queues, multi-output async readers, etc. */ GST_ELEMENT_DECOUPLED, /* this element should be placed in a thread if at all possible */ GST_ELEMENT_THREAD_SUGGESTED, /* this element is incable of seeking (FIXME: does this apply to filters?) */ GST_ELEMENT_NO_SEEK, /***** !!!!! need to have a flag that says that an element must *not* be an entry into a scheduling chain !!!!! *****/ /* this element for some reason doesn't obey COTHREAD_STOPPING, or has some other reason why it can't be the entry */ GST_ELEMENT_NO_ENTRY, /* there is a new loopfunction ready for placement */ GST_ELEMENT_NEW_LOOPFUNC, /* the cothread holding this element needs to be stopped */ GST_ELEMENT_COTHREAD_STOPPING, /* the element has to be scheduled as a cothread for any sanity */ GST_ELEMENT_USE_COTHREAD, /* if this element can handle events */ GST_ELEMENT_EVENT_AWARE, /* use some padding for future expansion */ GST_ELEMENT_FLAG_LAST = GST_OBJECT_FLAG_LAST + 12, } GstElementFlags; |
This enum defines the standard flags that an element may have.
#define GST_ELEMENT_IS_THREAD_SUGGESTED(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_THREAD_SUGGESTED)) |
Queries whether the Element should be placed in a thread.
#define GST_ELEMENT_IS_COTHREAD_STOPPING(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_COTHREAD_STOPPING)) |
Queries whether the cothread holding this element needs to be stopped.
#define GST_ELEMENT_IS_EOS(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_EOS)) |
Query wether this element is in the End Of Stream state.
#define GST_ELEMENT_IS_EVENT_AWARE(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_EVENT_AWARE)) |
Query wether this element can handle events.
#define GST_ELEMENT_PARENT(obj) (GST_OBJECT_PARENT(obj)) |
Get the parent object of this element.
#define GST_ELEMENT_SCHED(obj) (((GstElement*)(obj))->sched) |
Get the scheduler of this element.
#define GST_ELEMENT_MANAGER(obj) (((GstElement*)(obj))->manager) |
Get the manager of this element.
void (*GstElementLoopFunction) (GstElement *element); |
This function type is used to specify a loop function for the element. It is passed the element in question, and is expect to return only in error circumstances.
void gst_element_class_add_padtemplate ( |
Add a padtemplate to an element class. This is useful if you have derived a custom bin and wish to provide an on-request pad at runtime. Plugin writers should use gst_elementfactory_add_padtemplate instead.
#define gst_element_destroy(element) gst_object_destroy (GST_OBJECT (element)) |
Destroy the element. This is potentially dangerous, use gst_object_unref instead.
void gst_element_set_loop_function (GstElement *element, GstElementLoopFunction loop); |
This sets the loop function for the element. The function pointed to can deviate from the GstElementLoopFunction definition in type of pointer only.
NOTE: in order for this to take effect, the current loop function *must* exit. Assuming the loop function itself is the only one who will cause a new loopfunc to be assigned, this should be no problem.
void gst_element_set_name (GstElement *element, const |
Set the name of the element, getting rid of the old name if there was one.
const |
Get the name of the element.
|
Returns the scheduler of the element.
void gst_element_set_sched (GstElement *element, |
Sets the scheduler of the element. For internal use only, unless you're writing a new bin subclass.
void gst_element_set_parent (GstElement *element, GstObject *parent); |
Set the parent of the element.
GstObject* gst_element_get_parent (GstElement *element); |
Get the parent of the element.
void gst_element_add_pad (GstElement *element, GstPad *pad); |
Add a pad (connection point) to the element, setting the parent of the pad to the element (and thus adding a reference).
void gst_element_remove_pad (GstElement *element, GstPad *pad); |
Remove a pad (connection point) from the element,
GstPad* gst_element_get_pad (GstElement *element, const |
Retrieve a pad from the element by name.
|
Retrieve a list of the pads associated with the element.
|
Retrieve a list of the padtemplates associated with the element.
GstPadTemplate* gst_element_get_padtemplate_by_name (GstElement *element, const |
Retrieve a padtemplate from this element with the given name.
void gst_element_add_ghost_pad (GstElement *element, GstPad *pad, |
Create a ghost pad from the given pad, and add it to the list of pads for this element.
void gst_element_remove_ghost_pad (GstElement *element, GstPad *pad); |
removes a ghost pad from an element
GstPad* gst_element_request_compatible_pad (GstElement *element, GstPadTemplate *templ); |
Request a new pad from the element. The template will be used to decide what type of pad to create. This function is typically used for elements with a padtemplate with presence GST_PAD_REQUEST.
GstPad* gst_element_request_pad_by_name (GstElement *element, const |
Request a new pad from the element. The name argument will be used to decide what padtemplate to use. This function is typically used for elements with a padtemplate with presence GST_PAD_REQUEST.
void gst_element_connect (GstElement *src, const |
Connect 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 connection fails.
void gst_element_disconnect (GstElement *src, const |
Disconnect the two named pads of the source and destination elements.
|
Sets the state of the element. This function will only set the elements pending state.
GstElementState gst_element_get_state (GstElement *element); |
Gets the state of the element.
void gst_element_wait_state_change (GstElement *element); |
Wait and block until the element changed its state.
const |
Gets a string representing the given state.
void gst_element_error (GstElement *element, const |
This function is used internally by elements to signal an error condition. It results in the "error" signal.
GstElementFactory* gst_element_get_factory (GstElement *element); |
Retrieves the factory that was used to create this element
void gst_element_signal_eos (GstElement *element); |
Throws the eos signal to indicate that the end of the stream is reached.
GstElement* gst_element_restore_thyself ( |
Load the element from the XML description
void user_function (GstElement *gstelement, |
Is trigered whenever the state of an element changes
void user_function (GstElement *gstelement, GstPad *arg1, |
Is trigered whenever a new pad is added to an element
void user_function (GstElement *gstelement, GstPad *arg1, |
void user_function (GstElement *gstelement, |
Is trigered whenever an error occured