State | Description |
NULL | the NULL state or initial state of an element. |
READY | the element is ready to go to PAUSED. |
PAUSED | the element is PAUSED, it is ready to accept and process data. Sink elements however only accept one buffer and then block. |
PLAYING | the element is PLAYING, the clock is running and the data is flowing. |
以pipeline为例:
- Ready时 ,element 的 link 已经完成。
- PAUSED时, 除了sink element不消耗buffer之外,所有element 已经启动工作,这个时候给decoder等喂数据也会被处理,也就是说如果持续给pipeline喂数据,那么这些数据会被缓冲在包含缓冲区的element中,比如queue、queue2、multiqueue 等。这点很重要,因为在PAUSED状态下并不是整个数据流都停滞,而是不会被sink element消费。
- PLAYING时,和PAUSED唯一的区别就是 sink element 会消费 queue、queue2、multiqueue等内部的数据。
GST_STATE_NULL
is the default state of an element. In this state, it has not allocated any runtime resources, it has not loaded any runtime libraries and it can obviously not handle data.
GST_STATE_READY
is the next state that an element can be in. In the READY state, an element has all default resources (runtime-libraries, runtime-memory) allocated. However, it has not yet allocated or defined anything that is stream-specific. When going from NULL to READY state (GST_STATE_CHANGE_NULL_TO_READY
), an element should allocate any non-stream-specific resources and should load runtime-loadable libraries (if any). When going the other way around (from READY to NULL,GST_STATE_CHANGE_READY_TO_NULL
), an element should unload these libraries and free all allocated resources. Examples of such resources are hardware devices. Note that files are generally streams, and these should thus be considered as stream-specific resources; therefore, they should not be allocated in this state.
GST_STATE_PAUSED
is the state in which an element is ready to accept and handle data. For most elements this state is the same as PLAYING. The only exception to this rule are sink elements. Sink elements only accept one single buffer of data and then block. At this point the pipeline is 'prerolled' and ready to render data immediately.
GST_STATE_PLAYING
is the highest state that an element can be in. For most elements this state is exactly the same as PAUSED, they accept and process events and buffers with data. Only sink elements need to differentiate between PAUSED and PLAYING state. In PLAYING state, sink elements actually render incoming data, e.g. output audio to a sound card or render video pictures to an image sink.