[gst-devel] dynamically add video encode Bin to pipeline running video viewing Bin (python)

Luciana Fujii Pontello luciana at holoscopio.com
Tue Apr 13 19:50:36 CEST 2010

On Mon, 2010-04-12 at 09:03 -0400, Stuart Doherty wrote:
> I'm using python gst bindings to create a Speakers Corner/Video Diary
> application.  I started with the webcamera tutorial for python/gst
> here:
> http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html

I noticed this example doesn't use gdk.threads_enter() and
gdk.threads_leave() that should be right before and after
set_xwindow_id(). I noticed that in your code when trying to run it, and
then saw that it was just the same in the tutorial.

Unfortunately, I didn't find where to report it to be fixed in the
tutorial. Seems like BerliOS repository is not used. If anybody knows
where should I do that (maybe an e-mail address?) let me know.

> This is a simple gtk gui that allows you to push a button to start and
> stop the webcam.  I'm modifying it to:
> -Start with the camera playing.
> -Use the "Start/Stop" button to start and stop and encode operation.
> So, after the v4l2src I add a tee element, where one branch is exactly
> as before, and the other branch feeds and sequence of encoder elements
> (queue -> theora -> ogg -> file).
> To allow for easily adding and removing the encode path I have 2 Bins.
> One Bin contains the v4l2src -> tee -> autovideosink, with a ghost src
> pad for the other branch of the Tee element.  The other Bin is the
> encode path with a ghost sink pad for the input to the theora element.
> The code for this can be found here http://pastebin.com/XbjVsbqC

I don't know what is wrong with that, but since nobody answered yet,
I'll try to guess and see if it helps. I think you should try to flush
the data before removing the enc_bin (sending an EOS), then set the
state of this bin to NULL and just after that unlink and remove the bin.
Maybe the data is not being written to file because of that.

Also, you could try to block the src pad of your enc_queue instead of
the sink pad of your tee and leave it blocked while the enc_bin is not
being used. I don't know exactly when, but in some elements is not
really ok to leave pads unlinked and unblocked, so I prefer not to leave
any pad unlinked and unblocked. Also flush when doing that.

Hope it helps somehow.

Luciana Fujii
Holoscópio Tecnologia - http://holoscopio.com

More information about the gstreamer-devel mailing list