我正在尝试将 GStreamer appsrc 设置为视频源,但即使是一个微不足道的程序也根本不起作用,并且到目前为止会产生随机崩溃或挂起。你能帮忙找出问题吗?最小的崩溃代码:
import gst, gtk
def need_data(src, need_bytes):
src.emit("push-buffer", gst.Buffer(" "*need_bytes))
def on_message(bus, msg):
print "on_message", msg
pipeline = gst.parse_launch("appsrc name=src ! fakesink")
src = pipeline.get_by_name("src")
src.connect("need-data", need_data)
src.set_property("blocksize", 640*480*3)
bus = pipeline.get_bus()
bus.add_signal_watch()
bus.connect("message", on_message)
pipeline.set_state(gst.STATE_PLAYING)
gtk.main()