Comment 2 for bug 873712

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

I consider this a good test case for this bug. Same problem whether you use Python2 or Python3 (but for Novacut, we care about Python3). Currently this script will fail with:

TypeError: unknown type GstMessage

#!/usr/bin/python3

from gi.repository import GObject
GObject.threads_init()

from gi.repository import Gst
Gst.init(None)

mainloop = GObject.MainLoop()
pipeline = Gst.Pipeline()

def on_eos(bus, msg):
    print('eos: {!r}'.format(msg))
    pipeline.set_state(gst.STATE_NULL)
    mainloop.quit()

def on_message(bus, msg):
    print('message: {!r}'.format(msg))

bus = pipeline.get_bus()
bus.add_signal_watch()
bus.connect('message::eos', on_eos)
bus.connect('message', on_message)

bus = pipeline.get_bus()
bus.add_signal_watch()
bus.connect('message::eos', on_eos)

src = Gst.ElementFactory.make('videotestsrc', None)
src.set_property('num-buffers', 10)
sink = Gst.ElementFactory.make('fakesink', None)
pipeline.add(src)
pipeline.add(sink)
src.link(sink)

pipeline.set_state(Gst.State.PLAYING)
mainloop.run()