Element states One you have created a pipeline packed with elements, nothing will happen yet. This is where the different states come into play. The different element states All elements can be in one of the following four states: NULL: this is the default state all elements are in when they are created and are doing nothing. READY: An element is ready to start doing something. PLAYING: The element is doing something. PAUSED: The element is paused for a period of time. All elements start with the NULL state. The elements will go throught the following state changes:
The different states of a <classname>GstElement</classname> and the state transitions
The state of an element can be changed with the following code: GstElement *bin; // create a bin, put elements in it and connect them ... gst_element_set_state (bin, GST_STATE_PLAYING); ... You can set the following states to an element: GST_STATE_NONE_PENDING The element is in the desired state. GST_STATE_NULL Reset the state of an element. GST_STATE_READY will make the element ready to start processing data. GST_STATE_PLAYING means there really is data flowing through the graph. GST_STATE_PAUSED temporary stops the data flow.
The NULL state When you created the pipeline all of the elements will be in the NULL state. There is nothing spectacular about the NULL state. Don't forget to reset the pipeline to the NULL state when you are not going to use it anymore. This will allow the elements to free the resources they might use. The READY state You will start the pipeline by first setting it to the READY state. This will allow the pipeline and all the elements contained in it to prepare themselves for the actions they are about to perform. The typical actions that an element will perform in the READY state might be to open a file or an audio device. Some more complex elements might have a non trivial action to perform in the READY state such as connecting to a media server using a CORBA connection. You can also go from the NULL to PLAYING state directly without going through the READY state. this is a shortcut, the framework will internally go through the READY state for you. The PLAYING state A Pipeline that is in the READY state can be started by setting it to the PLAYING state. At that time data will start to flow all the way through the pipeline. The PAUSED state A pipeline that is playing can be set to the PAUSED state. This will temporarily stop all data flowing through the pipeline. You can resume the data flow by setting the pipeline back to the PLAYING state. The PAUSED state is build for temporarily freezing the pipeline. Elements will typically do not free their resources in the PAUSED state. Use the NULL state if you want to stop the data flow permanantly. The pipeline has to be in the PAUSED or NULL state if you want to insert or modify an element in the pipeline. We will cover dynamic pipeline behaviour in ...