I am using Gstreamer (Gst-python) to write a pipeline that samples images out of a video and creates a slideshow out of these images. For that I am using valve element to sample the images and imagefreeze to create the slideshow. My pipeline looks something like the following : source --- tee --- queue1 --- valve --- imagefreeze -- sink --- queue2 --- sink
Currently, I am attaching a callback to GObject mainloop with "timeout_add_seconds". In this callback I am toggling the drop property of valve to let one image buffer pass through, and it works. The problem is when I insert imagefreeze it does not refresh automatically so I tried to change its state to READY then to PLAYING. This works for the first call of the function but the entire pipeline freezes at the second call and I could not figure out why. here's my callback snippet :
def toggle(pipeline):
imagefreeze = pipeline.get_by_name("freeze")
imagefreeze.set_state(Gst.State.PAUSED)
imagefreeze.set_state(Gst.State.READY)
valve = pipeline.get_by_name("valve")
valve.set_property("drop", 0)
time.sleep(0.1)
imagefreeze.set_state(Gst.State.PAUSED)
imagefreeze.set_state(Gst.State.PLAYING)
valve.set_property("drop", 1)
return True
Is it a correct approach to do so? otherwise how can I force imagefreeze plugin to refresh its output when the input buffer changes?