I use pygst in the project and it works fine. I'm trying to port it to a new introspection system (GI), but I have a different behavior.
In old pygst, I have something like this:
...
import pygst
pygst.require('0.10')
import gst
...
gobjects.threads_init()
...
def my_handler(bus, message):
...
player = gst.element_factory_make('playbin2', 'my_player')
bus = player.get_bus()
bus.connect('message', my_handler)
bus.add_signal_watch()
...
player.set_state(gst.STATE_PLAYING)
The message parameter has an .type attribute that can be used for selective processing (I am only interested in the end of the stream (EOS) and the error). Using the new system, I:
...
from gi.repository import Gst
import glib
import gobject
....
gobject.threads_init()
loop = glib.MainLoop(None, False)
def bus_handler(bus, message):
print message
...
Gst.init_check(None)
player = Gst.ElementFactory.make('playbin2', 'my_player')
player.set_property('uri', 'file:///home/kenji/button.ogg')
bus = player.get_bus()
bus.connect('message', bus_handler)
bus.add_signal_watch()
player.set_state(Gst.State.PLAYING)
However, the handler always receives the parameter message as None. I tried filtering them, but I still get nothing (i.e. All None messages).
GStreamer ( GstBus, add_signal_watch() playbin2), , . gst gir, , add_watch() , . glib - GTK, Gtk.main() ( ).
GStreamer 0.10.35.0 ( Gst.version()) Arch Linux 64, GStreamer 0.10.32.0 32- Ubuntu 11.04.
bus.connect()? ? , . ! =)