GStreamer bus sends None message

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:

... # other imports
import pygst
pygst.require('0.10')
import gst
... # other imports

gobjects.threads_init()

...

def my_handler(bus, message):
    # handle the 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)
# start the main Glib loop

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:

... # other imports
from gi.repository import Gst
import glib
import gobject
.... # other imports

gobject.threads_init()

loop = glib.MainLoop(None, False)

def bus_handler(bus, message):
    print message
    # handle the 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)
# start the main loop

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()? ? , . ! =)

+5
4

add_signal_watch_full(), , , . , .

+1

, . add_signal_watch_full add_signal_watch , , G_PRIORITY_DEFAULT. C , 940. , , , , , , . , , , .: -)

, . PyGObject GStreamer 0.10 . :

: " , GStreamer0.10 PyGI, GStreamer0.10 ( API)".

, :

  • GStreamer 1.0.
  • PyGST.
  • PyGObject GStreamer 0.10, , EOS. .
+1

GTK , gobject.Mainloop(), . , mainloop, ( ), - :

g_loop = threading.Thread(target=gobject.MainLoop().run)
g_loop.daemon = True
g_loop.start()

, , Gstreamer.

0

, C.

, , 0.10 1.0, , .

Removing the shared libraries associated with 0.10 solved my problem.

0
source

All Articles