I have a gstreamer application where I am creating a video with images. I need to create the video for a predefined time. I would like to send eos after the predefined time. I know that this can be achieved using new_single_shot_id in gstClock. But I could not find any example on how to use new_single_shot_id to create a trigger which is bound to a function that sends eos to pipeline.
My simplified pipeline code is like this.
class Main(object):
def __init__(self, location):
self.pipeline = Gst.Pipeline()
self.img = Gst.ElementFactory.make("uridecodebin", "img1")
self.img.set_property("uri", location)
self.pipeline.add(self.img)
self.freeze = Gst.ElementFactory.make("imagefreeze", "freeze")
self.pipeline.add(self.freeze)
self.sink = Gst.ElementFactory.make("autovideosink", "sink0")
self.pipeline.add(self.sink)
self.img.link(self.freeze)
self.freeze.link(self.sink)
self.clock = self.pipeline.get_clock()
#self.trigger = Gst.SystemClock.new_single_shot_id(self.clock, 10)
def send_eos():
#code to send eos
pass
def run(self):
self.pipeline.set_state(Gst.State.PLAYING)
GObject.MainLoop().run()
I am new to gstreamer and not experienced in c programming. Examples in python will be of great help.
self.pipeline.send_event(Gst.Event.new_eos())