Dynamic addition and removal of filesink to pipeline

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

Dynamic addition and removal of filesink to pipeline

Stephan Boltzmann
Hello everybody out there using GStreamer,

My program (written in C) is streaming/displaying video to the screen
and writes it to a file at the same time.
I would like to write to a file based on a condition.
This can be achieved with 'dynamic pipelines' in GStreamer as far as I
see.
There is an example of a dynamic pipeline in the official GStreamer
documentation and I also found some code on GitHub
(https://gist.github.com/crearo/1dc01b93b2b513e0000f183144c61b20), but I
don't get the gist of it:
The functions `gst_bin_remove` and `gst_object_unref` are called with
the tee element as an character there.
Is this the most elegant way to achive what I want to implement?
Wouldn't it be more elegant to switch the filesink on and off
dynamically?

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

Re: Dynamic addition and removal of filesink to pipeline

gotsring
I guess you could just unlink the filesink whenever you didn't want to record
stuff, it would just be a matter of finalizing the file, and then resetting
it so that you could reuse it later.

The only problem I had is when I wanted to stop a file and start a new one
immediately. If I used the same sink, I'd have to wait for it to finish
writing the file (the EOS had to travel through the encoder, muxer, and
filesink), and then trigger it to record again. It was just easier to add a
second filesink, then unlink the first and destroy it when it was done.

If you haven't seen this, you might want to check out this example also:
https://coaxion.net/blog/2014/01/gstreamer-dynamic-pipelines/




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel