[gst-devel] Pad block/element switch does not work properly

René Stadler mail at renestadler.de
Sun Nov 12 17:02:49 CET 2006


Am Sonntag, den 12.11.2006, 12:54 +0100 schrieb Fredrik Persson:
> > > I'm expecting, here, to see that one videotestsrc element shall be
> > > replaced with another videotestsrc element when the user clicks the
> > > "change" button in the GUI. This does not happen. Instead, the first
> > > videotestsrc gives me an error message:
> > 
> > I haven't tested this, but from looking at the code, I'm expecting this
> > to give a warning about "trying to dispose an element that is not in the
> > NULL state" (see below).  You also don't set the replacement source to
> > the PLAYING state, so I don't expect this to show anything after the
> > replace happens anyways.
> 
> What is the proper procedure? To block the pad, unlink the
> element-to-be-removed, put the e-t-b-r in NULL state, remove it from the
> pipeline, create the new element, add it to the pipeline, link it, and
> unblock the pad that I blocked in the beginning?
> 
> You see, part-block.txt doesn't speak about changing any states
> whatsoever, so I try to figure out what procedure is the correct one in
> order to accomplish switching source element in a pipeline.
> 

It's not mentioned there because it is not something specific to pad
blocking.  If you add an element to a bin, you always need to make sure
the states match (or let the bin synchronize them for you the next time
you change the bin state).  Likewise, if you remove an element from a
bin and you want to dispose it, you always have to make sure it is in
the NULL state before you drop your last reference.

I'm actually not sure whether you need to set the state before or after
adding/removing or if it makes no difference.  However, experimenting
with this is as trivial as changing the order of two lines of code.

Regards,
  René Stadler





More information about the gstreamer-devel mailing list