0

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.

1 Answers1

0

self.pipeline.send_event(Gst.Event.new_eos())

Rolf of Saxony
  • 21,661
  • 5
  • 39
  • 60
  • Although this might answer the question, one should also add an explanation to the code segment. – BDL Jul 22 '15 at 12:18
  • I struggled with the fact that the answer is almost self-explanatory but you can the read the gory details, here: https://developer.gnome.org/gstreamer/stable/gstreamer-GstEvent.html#gst-event-new-eos – Rolf of Saxony Jul 22 '15 at 14:22