turning parts of pipeline on/off

Stefan Kost ensonic at hora-obscura.de
Fri Jun 24 15:38:24 PDT 2011

On 06/21/11 20:37, Jan Spurný wrote:
> Hi,
> I have a simple pipeline (actually it's generated according to
> configuration and much more complicated, but it allways ends up after
> something that gives x-video/raw-yuv, like "decodebin" shown below):
>  souphttpsrc location="someurl" ! decodebin ! my_app_sink
> and I would like to be able to get jpeg snapshots from time to time. Since
> "my_app_sink" needs raw yuv input, I splitted the pipeline with tee:
>  souphttpsrc location="someurl" ! decodebin ! tee name=t  ! my_app_sink t. ! queue ! jpegenc ! my_jpeg_appsink
> or in crude ascii art:
>  souphttpsrc -> decodebin -> tee ----------> my_app_sink
>                               \-> jpegenc -> my_jpeg_appsink
> it works, but "jpegenc" is running all the time, consuming CPU power and
> in "my_jpeg_appsink" I'm just "throwing jpegs away" most of the time, since I
> need the jpeg only once in a while - less than one per minute (while
> my input stream has usualy more than 10fps).

You should also use queue elements after each tee branch to not starve
either branch.If you set the queue on the snap-shot branch to leaky
(either way) you can block the queue and it will drop buffers. For this
you need to grab the src-pad of queue and set it to blocked if you don't
want snapshots.

You can achieve a similar effect using the valve element.

> Now comes my question - is there any way to "turn off" the "my_jpeg_appsink"
> part of the pipeline when I don't need jpegs and only turn it on when
> I need one without disturbing the "my_app_sink" part?
> If my description is confusing, please tell me and I'll try again.
> Thanks for any help or suggestions
> Regards,
> Jan Spurny
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

More information about the gstreamer-devel mailing list