Sending eos in gstreamer after pre-defined time using new_single_shot_id

China☆狼群 提交于 2019-12-23 04:24:29

问题


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:


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



来源:https://stackoverflow.com/questions/27103221/sending-eos-in-gstreamer-after-pre-defined-time-using-new-single-shot-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!