gstreamer/docs/random/state-transitions

46 lines
2.1 KiB
Text
Raw Permalink Normal View History

So, the method of having a _start() and _stop() function for each element
just doesn't scale. In the case of pipeline/thread model with a PLAYING
state bit, I have no way of passing a state change all the way down the
graph, i.e. a thread sitting inside a supplied bin.
Proposal is to have a single state-change class function, which gets
passed a single argument (no more 'state' going along with RUNNING). This
function can be overridden by each element as necessary, but must chain to
the parent_class version of it. It does its work, just like [st]et_arg,
in a case. It checks for STATE and ~STATE, and does the appropriate
steps. All the _start() and _stop() functions get moved into this one, in
the GST_STATE_RUNNING and ~GST_STATE_RUNNING cases.
This allows bins to and derivations thereof to simply pass through any
state they don't understand. Meta-elements will also pass through.
There may need to be some mechanism that provides for setting state on
only a certain type. This can be provided as an alternate path supplied
by bins. The bin is the one that would do the work in any case. Simply
provide class function for bins that does the selective stuff, and a main
_bin_ function that calls this class function. The supplied class
function for each bin would simply check against the given GtkType before
setting its state. Derivations of GstBin would always get it.
Success chaining (gbooleans) starts to get a little hairier...
Functions:
gst_element_set_state(element,state) is called by the application to set
the state for an element (or bin).
elementclass->change_state() is the class function that actually does the
setting of the state for this element. Any subclass implementation will
chain to the parent_class's version.
gst_element_change_state(element,state) is the Element class's
implementation of the change_state() function. It simply sets the state.
gst_bin_set_state_type(element,state,type) is a specialized function for
bins only that sets the type only on elements of that type.
binclass->change_state_type() is the class function that does the
selective