How to save file from filesink in dynamic pipeline

Edgar Thier edgar.thier at theimagingsource.com
Mon Apr 10 08:59:12 UTC 2017


Hi Dimitrios,

Thanks for your response.

> What you can do is add a buffer probe to the sink pad of the queue hen you intend to disconnect
> once you signal stopping a file. On the next buffer recieved you trigger the eos event and then
> do the pipeline cleanup.

Currently my code looks like this:


    def eos_callback(self, pad, event):
        print("In EOS")
        self.pipeline.set_state(Gst.State.PAUSED)
        self.srcpad.unlink(self.queue_pad)
        self.pipeline.remove(self.image_bin)
        self.pipeline.set_state(Gst.State.PLAYING)

    def buffer_probe(self, pad, probe_info):
        print("Received next buffer")
        self.eos_probe =
self.filesink.get_static_pad("sink").add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM,
                                                                        self.eos_callback)
        pad.send_event(Gst.Event.new_eos())

    def _disconnect(self):
        print("Disconnecting")
        self.queue_pad.add_probe(Gst.PadProbeType.BUFFER,
                                 self.buffer_probe)

I call self._disconnect() to trigger a stop. The probe gets added, however buffer_probe is not
called. When I change the probe type to BLOCKING, buffer_probe gets called but my application hangs
itself. I am not sure what I am missing...

As to reusing the elements for saving the stream:
My plan was to simply throw that part of the pipeline away once the recording stopped and re-add a
new bin for recording when a new one is requested.

Regards,

Edgar


More information about the gstreamer-devel mailing list