[gst-devel] concept of state of bins

Thomas Vander Stichele thomas at apestaart.org
Sat Oct 4 03:41:03 CEST 2003


Hi,

I've been running into some issues when trying to write applications
with slightly more complex layout.

One of the things I never quite understood about GStreamer is the way
the state of a bin is defined.  Up to now, the state of the bin has
always been equal to the highest state of the children.
Ie, if all elements in a bin are in state NULL, except for one that's
PLAYING, the bin is PLAYING.

As a definition, that's fine.

But in practice, this really is incredibly confusing.
Suppose you have a pipeline that contains two threads.  You set thread A
to PLAYING while thread B is still at NULL.  This makes the pipeline
itself go to PLAYING as well.

However, this leaves thread B's handling undefined.  Does B stay at NULL
? Or does B follow to PLAYING because thread A forced the pipeline to
PLAYING ?

Suppose B stays at NULL, what should happen if pipeline is set to
PLAYING when it already was because of A ? Should it ignore the state
change since it's already in the requested state ? Should it recursively
set state on all children ? (right now, HEAD ignores the state change).

If it doesn't recursively set state on children, it's pretty painful if
you have a bunch of unbinned elements floating around instead of thread
B - you're forced to dig them out and set them all to playing manually
instead of setting the whole pipeline to play.
In the case where it does recursively set state, it might be
painful/irritating that you cannot rely on the state of a bin for
information.  But you probably couldn't anyway.  So I'd lean over to
"recursively set state even though the state is already the same".  I'd
leave it up to the elements themselves and their state change function
to decide if they should return because state is already ok.

One other thing I see us doing would be similar to gtk_show_all () vs
gtk_show (); gst_set_state_all () would recursively set state on all bin
contents.

What do you think ?

Thomas


Dave/Dina : future TV today ! - http://davedina.apestaart.org/
<-*- thomas (dot) apestaart (dot) org -*->
Well baby let me shake it
If I can move it with you will you let me take it
<-*- thomas (at) apestaart (dot) org -*->
URGent, best radio on the net - 24/7 ! - http://urgent.rug.ac.be/






More information about the gstreamer-devel mailing list