From b27e9ba001b958c3632ffdaafe199e82d2dd993f Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 29 Sep 2005 16:38:06 +0000 Subject: [PATCH] examples/: Updates for bus API. Original commit message from CVS: 2005-09-29 Andy Wingo * examples/pipeline-tester (Window.play): * examples/vumeter.py (Window.run): Updates for bus API. --- ChangeLog | 5 +++++ examples/pipeline-tester | 14 ++++++++++---- examples/vumeter.py | 9 ++++----- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d33584b390..a2cbf6b9d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-29 Andy Wingo + + * examples/pipeline-tester (Window.play): + * examples/vumeter.py (Window.run): Updates for bus API. + 2005-09-29 Edward Hervey * gst/gst.defs: diff --git a/examples/pipeline-tester b/examples/pipeline-tester index 540cfbbd07..029d7b717d 100755 --- a/examples/pipeline-tester +++ b/examples/pipeline-tester @@ -44,7 +44,7 @@ data = (('Video capture via V4L', ' ! xvimagesink'), ('Video capture via V4L, fixed frame rate', 'v4lsrc name=source autoprobe=false autoprobe-fps=false \n' - ' ! video/x-raw-yuv,framerate=(double)7.5 \n' + ' ! video/x-raw-yuv,format=(fourcc)I420,framerate=(double)7.5 \n' ' ! videorate \n' ' ! ffmpegcolorspace \n' ' ! xvimagesink'), @@ -223,13 +223,17 @@ class Window(gtk.Window): self.set_sensitive(True) self.error('Could not create pipeline', str(e)) return False - watch_id = pipeline.get_bus().add_watch(self.on_message) + + bus = pipeline.get_bus() + bus.add_signal_watch() + watch_id = bus.connect('message', self.on_message) if pipeline.set_state(gst.STATE_PLAYING) != gst.STATE_CHANGE_SUCCESS: # make sure we get error messages while gtk.events_pending(): gtk.main_iteration() pipeline.set_state(gst.STATE_NULL) - gobject.source_remove(watch_id) + bus.remove_signal_watch() + bus.disconnect(watch_id) return False else: self.pipeline = pipeline @@ -237,9 +241,11 @@ class Window(gtk.Window): return True def stop(self): + bus = self.pipeline.get_bus() + bus.disconnect(self.watch_id) + bus.remove_signal_watch() self.pipeline.set_state(gst.STATE_NULL) self.pipeline = None - gobject.source_remove(self.watch_id) del self.watch_id def play_toggled(self): diff --git a/examples/vumeter.py b/examples/vumeter.py index 5bd31682ec..aba621c603 100755 --- a/examples/vumeter.py +++ b/examples/vumeter.py @@ -89,17 +89,16 @@ class Window(gtk.Dialog): s = 'alsasrc ! level message=true ! fakesink' pipeline = gst.parse_launch(s) self.set_sensitive(True) - # FIXME: using gst.MESSAGE_APPLICATION does not give me - # any messages at all - watch_id = pipeline.get_bus().add_watch(gst.MESSAGE_ANY, - self.on_message) + pipeline.get_bus().add_signal_watch() + i = pipeline.get_bus().connect('message::application', self.on_message) if pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_SUCCESS: print "going into main" gtk.Dialog.run(self) else: self.error('Could not set state') + pipeline.get_bus().disconnect(i) + pipeline.get_bus().remove_signal_watch() pipeline.set_state(gst.STATE_NULL) - gobject.source_remove(watch_id) except gobject.GError, e: self.set_sensitive(True) self.error('Could not create pipeline', e.__str__)