After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660612 - Bus broken with PyGI (message is None aka no EOS): missing GstMessage annotation?
Bus broken with PyGI (message is None aka no EOS): missing GstMessage annotat...
Status: RESOLVED DUPLICATE of bug 631901
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.35
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-10-01 03:51 UTC by Jason Gerard DeRose
Modified: 2011-10-01 17:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jason Gerard DeRose 2011-10-01 03:51:25 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):
  • File "./eos-bug-pygi.py", line 18 in on_message
    print('message: {!r}'.format(msg))
TypeError: unknown type GstMessage

Comment 1 Jason Gerard DeRose 2011-10-01 03:56:46 UTC
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()
Comment 2 Tim-Philipp Müller 2011-10-01 17:51:37 UTC
Duplicate of bug #659193 and bug #631901 I believe => pygi

*** This bug has been marked as a duplicate of bug 631901 ***