turning parts of pipeline on/off

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

turning parts of pipeline on/off

Jan Spurný
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).

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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: turning parts of pipeline on/off

Tony Houghton
On Tue, 21 Jun 2011 20:37:28 +0200 (CEST)
Jan Spurný <[hidden email]> wrote:

> 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).
>
> 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.

Can't you just dynamically add jpegenc and your jpeg_appsink when needed
and remove them immediately after each snapshot? Is that possible
without disturbing my_app_sink ie while the pipeline is in state
PLAYING?

I really hope that is possible because I want to do something sort of
similar with a DVB application, with a dvbbasebin or dvbsrc source.
While one programme is being recorded, a user might want to start
watching the same programme "live", or record or watch another programme
from the same transport stream, and these extra sinks need to be stopped
and started without interrupting any other recording or live
streaming/playback using the same source.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: turning parts of pipeline on/off

Alexey Fisher
In reply to this post by Jan Spurný

> > 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).
> >
> > 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.
>
> Can't you just dynamically add jpegenc and your jpeg_appsink when
> needed
> and remove them immediately after each snapshot? Is that possible
> without disturbing my_app_sink ie while the pipeline is in state
> PLAYING?
>
> I really hope that is possible because I want to do something sort of
> similar with a DVB application, with a dvbbasebin or dvbsrc source.
> While one programme is being recorded, a user might want to start
> watching the same programme "live", or record or watch another
> programme
> from the same transport stream, and these extra sinks need to be
> stopped
> and started without interrupting any other recording or live
> streaming/playback using the same source.

You can use:
 vlave - to drop packets.
 tee - allocate new pad, not sure about destroing pad.
 output-selector - but i think it will switch between sinks
--
Regards,
        Alexey

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: turning parts of pipeline on/off

Tony Houghton
On Wed, 22 Jun 2011 21:18:39 +0200
Alexey Fisher <[hidden email]> wrote:

> You can use:
>  vlave - to drop packets.
>  tee - allocate new pad, not sure about destroing pad.
>  output-selector - but i think it will switch between sinks

If you can't remove pads from a tee I suppose what one could do is use a
tee for adding pads but, instead of linking the sinks directly to the
tee, put an output-selector in between and switch its sink to a fakesink
when the real sink is no longer needed.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: turning parts of pipeline on/off

Stefan Sauer
In reply to this post by Jan Spurný
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.

Stefan

> 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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel