[gst-devel] Reusing a pipeline
t.i.m at zen.co.uk
Tue Feb 5 11:21:34 CET 2008
On Mon, 2008-02-04 at 19:38 -0700, Jeffrey Barish wrote:
> I created a class for ripping to a file. It works fine once, but if I try
> to use the same instance a second time, query_position or query_duration
> returns a bogus value (I compute a ratio, so I'm not sure which is wrong).
> I presume that something needs to be reinitialized before I use the
> instance again, but I don't see my mistake. Clues?
Do you set the pipeline state back to NULL when you're done and before
re-using it and setting state back to PLAYING?
If yes, maybe you could whip up a small self-contained program that
shows the problem and that people can run?
> It works to create a new instance each time. Is it good GStreamer
> practice to re-create the pipeline each time despite the inefficiency?
It is a prudent thing to do, at least for more complex pipelines. It
shouldn't be necessary, but unless someone actually goes to write tests
to make sure that all components are re-usable, chances are they may not
be. Also, it makes debugging a tad easier if you know you start from a
guaranteed sane zero state for each track. I very much doubt the
overhead of constructing your pipeline matters.
More information about the gstreamer-devel