在预定义的时间后使用new_single_shot_id在gstreamer中发送eos [英] Sending eos in gstreamer after pre-defined time using new_single_shot_id

查看:100
本文介绍了在预定义的时间后使用new_single_shot_id在gstreamer中发送eos的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gstreamer应用程序,在其中创建带有图像的视频.我需要在预定的时间内创建视频.我想在预定义的时间后发送EOS.我知道可以使用gstClock中的new_single_shot_id来实现.但是我找不到任何有关如何使用new_single_shot_id创建触发器的示例,该触发器绑定到将eos发送到管道的函数.

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()

我是gstreamer的新手,没有c编程经验. python中的示例将有很大帮助.

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())

这篇关于在预定义的时间后使用new_single_shot_id在gstreamer中发送eos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆