GStreamer Application Development Manual (0.8.12) | ||
---|---|---|
<<< Previous | Elements | Next >>> |
After being created, an element will not actually perform any actions yet. You need to change elements state to make it do something. GStreamer knows four element states, each with a very specific meaning. Those four states are:
GST_STATE_NULL
: this is the default state.
This state will deallocate all resources held by the element.
GST_STATE_READY
: in the ready state, an
element has allocated all of its global resources, that is,
resources that can be kept within streams. You can think about
opening devices, allocating buffers and so on. However, the
stream is not opened in this state, so the stream positions is
automatically zero. If a stream was previously opened, it should
be closed in this state, and position, properties and such should
be reset.
GST_STATE_PAUSED
: in this state, an
element has opened the stream, but is not actively processing
it. An element should not modify the stream's position, data or
anything else in this state. When set back to PLAYING, it should
continue processing at the point where it left off as soon as
possible.
GST_STATE_PLAYING
: in the PLAYING state,
an element does exactly the same as in the PAUSED state, except
that it actually processes data.
You can change the state of an element using the function gst_element_set_state (). If you set an element to another state, GStreamer will internally traverse all intermediate states. So if you set an element from NULL to PLAYING, GStreamer will internally set the element to READY and PAUSED in between.
Even though an element in GST_STATE_PLAYING
is ready for data processing, it will not necessarily do that. If
the element is placed in a thread (see the Chapter called Threads), it will process data automatically.
In other cases, however, you will need to iterate
the element's container.
<<< Previous | Home | Next >>> |
Linking elements | Up | Bins |