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

Stuart Doherty stu.doherty at gmail.com
Mon Apr 12 15:03:32 CEST 2010


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

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

So I want to push "Start" and have the Encode path run, and stop will remove
the encode path.  Initially I fully stopped the Pipeline, and restarted it
with the encodeBin added, and this worked fine.  This was not ideal.  I
wanted to keep the pipeline running.  So I found this thread about pad
blocking:

http://n4.nabble.com/Any-ways-to-add-remove-branches-to-from-a-running-pipeline-td973959.html#a973959

I believe I understand what they're getting at, but I don't seem to be able
to make it work.

-If I start the pipeline with the encoder running it works fine.  And if I
push "stop" to remove the encode operation, the ogv file ceases to be
written.
-If I start the pipeline with the encoder stopped, and then push "start" to
add the encoder, the viewfinder continues to show my webcam video, but the
ogv file does not get written to.

Am I using the pad blocking incorrectly?

Thanks in advance.


P.S. I see mention made of a camerabin element.  I can't for the life of me
figure out why that element is not installed on my machine (Ubuntu 9.04), or
even how to get it there.  It would probably do what I needed as well,
although I'd still be curious about what I'm doing wrong.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100412/22c1d035/attachment.htm>


More information about the gstreamer-devel mailing list