[gst-devel] Linking/Unlinking elements at runtime

Roman Ekjanov gst at june31.com
Wed May 30 17:14:18 CEST 2007

I have a similar problem, except that my pipeline also includes audio.
I ended up decoupling the auxiliary pipeline from the main pipeline.
Something like this:
source bin -> identity -> the rest of the main pipeline
Then you connect to the identity handoff signal and copy buffers to
the application. Auxillary pipeline looks like this:
You have to connect to the fakesrc handoff signal as well and replace
the handoff buffer with the one you copied from the main pipeline.
Of course there is a lot more in it. For example, you should break the
copy stream only on a key frame, otherwise you risk missing B-frames.
Many muxers (AVI)  require an eos event to close the file properly.
You cannot just drop pipelene to null - the output file will be
broken. I don't know how to emulate eos with fakesrc yet. Probably, I
will have to write my own fakesrc. But, at least, you can do with the
aux pipeline whatever you want and it will not affect the main
Just give you some idea.
On 5/27/07, Itay Kirshenbaum <ikirsh at gmail.com> wrote:
> Hi,
> I've got the following pipeline in my application:
> source bin -> tee -> sink bin
> Where the source bin is essentially: v4l2src -> mpeg4_encoder
> And the sink bin is: queue -> filesink (with or without a muxer in between)
> The purpose of this app is to have a recorder, that upon receiving a
> command, records a few seconds of video and stops.
> This alone should be pretty simple, however there are a few constraints:
> 1. The main pipeline should always be playing (otherwise i'd just pause and
> play the whole thing each time).
> This is because the source bin can be connected to other sinks through the
> tee.
> 2. The sink bin should always be linked to the tee.
> This is because I'd like to be able to do the recording action from the
> context of the recorder module (sink bin), and not from the context
> of the main application.
> My first idea was starting out with only a queue in the sink bin, and link
> it to the tee.
> When a 'record' command is given, create a filesink, link to the queue, and
> set the sink bin to playing.
> This partly works, but from time to time GStreamer can't complete the state
> change for the sink bin.
> Is there any proper way to do this, under the above constraints?
> Thanks,
> Itay.
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

More information about the gstreamer-devel mailing list