GNOME Bugzilla – Bug 660612
Bus broken with PyGI (message is None aka no EOS): missing GstMessage annotation?
Last modified: 2011-10-01 17:51:37 UTC
So I was able to port the Novacut renderer to PyGI save for one problem I wasn't able to work around: the message bus is broken under PyGI and I'm not getting an EOS signal. The render actually works fine, I just don't know when it's done. I finally came of with two illustrative test cases, which hopefully will allow someone with more G-I knowledge to spot the problem. Here is the working case for the static python-gst bindings: #!/usr/bin/python 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', 120) sink = Gst.ElementFactory.make('fakesink', None) pipeline.add(src) pipeline.add(sink) src.link(sink) pipeline.set_state(Gst.State.PLAYING) mainloop.run() And here is the broken PyGI case: #!/usr/bin/python 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() Here is the trace when I try to run the broken PyGI case: jderose@jgd-ws:~/bzr/novacut/trunk$ ./eos-bug-pygi.py ./eos-bug-pygi.py:37: Warning: g_value_get_object: assertion `G_VALUE_HOLDS_OBJECT (value)' failed mainloop.run() message: None message: None message: None message: None message: None message: None message: None message: None message: None message: None message: None message: None message: None Traceback (most recent call last):
+ Trace 228660
print('message: {!r}'.format(msg))
Oops, crap, got my copy+paste mixed up: Working static test case: #!/usr/bin/python import gobject gobject.threads_init() import gst 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) src = gst.element_factory_make('videotestsrc') src.set_property('num-buffers', 10) sink = gst.element_factory_make('fakesink') pipeline.add(src) pipeline.add(sink) src.link(sink) pipeline.set_state(gst.STATE_PLAYING) mainloop.run() Broken PyGI test case: #!/usr/bin/python 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()
Duplicate of bug #659193 and bug #631901 I believe => pygi *** This bug has been marked as a duplicate of bug 631901 ***