mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
examples/: Updates for bus API.
Original commit message from CVS: 2005-09-29 Andy Wingo <wingo@pobox.com> * examples/pipeline-tester (Window.play): * examples/vumeter.py (Window.run): Updates for bus API.
This commit is contained in:
parent
ced71dad74
commit
b27e9ba001
3 changed files with 19 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-09-29 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* examples/pipeline-tester (Window.play):
|
||||||
|
* examples/vumeter.py (Window.run): Updates for bus API.
|
||||||
|
|
||||||
2005-09-29 Edward Hervey <edward@fluendo.com>
|
2005-09-29 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/gst.defs:
|
* gst/gst.defs:
|
||||||
|
|
|
@ -44,7 +44,7 @@ data = (('Video capture via V4L',
|
||||||
' ! xvimagesink'),
|
' ! xvimagesink'),
|
||||||
('Video capture via V4L, fixed frame rate',
|
('Video capture via V4L, fixed frame rate',
|
||||||
'v4lsrc name=source autoprobe=false autoprobe-fps=false \n'
|
'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'
|
' ! videorate \n'
|
||||||
' ! ffmpegcolorspace \n'
|
' ! ffmpegcolorspace \n'
|
||||||
' ! xvimagesink'),
|
' ! xvimagesink'),
|
||||||
|
@ -223,13 +223,17 @@ class Window(gtk.Window):
|
||||||
self.set_sensitive(True)
|
self.set_sensitive(True)
|
||||||
self.error('Could not create pipeline', str(e))
|
self.error('Could not create pipeline', str(e))
|
||||||
return False
|
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:
|
if pipeline.set_state(gst.STATE_PLAYING) != gst.STATE_CHANGE_SUCCESS:
|
||||||
# make sure we get error messages
|
# make sure we get error messages
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration()
|
gtk.main_iteration()
|
||||||
pipeline.set_state(gst.STATE_NULL)
|
pipeline.set_state(gst.STATE_NULL)
|
||||||
gobject.source_remove(watch_id)
|
bus.remove_signal_watch()
|
||||||
|
bus.disconnect(watch_id)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.pipeline = pipeline
|
self.pipeline = pipeline
|
||||||
|
@ -237,9 +241,11 @@ class Window(gtk.Window):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def stop(self):
|
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.set_state(gst.STATE_NULL)
|
||||||
self.pipeline = None
|
self.pipeline = None
|
||||||
gobject.source_remove(self.watch_id)
|
|
||||||
del self.watch_id
|
del self.watch_id
|
||||||
|
|
||||||
def play_toggled(self):
|
def play_toggled(self):
|
||||||
|
|
|
@ -89,17 +89,16 @@ class Window(gtk.Dialog):
|
||||||
s = 'alsasrc ! level message=true ! fakesink'
|
s = 'alsasrc ! level message=true ! fakesink'
|
||||||
pipeline = gst.parse_launch(s)
|
pipeline = gst.parse_launch(s)
|
||||||
self.set_sensitive(True)
|
self.set_sensitive(True)
|
||||||
# FIXME: using gst.MESSAGE_APPLICATION does not give me
|
pipeline.get_bus().add_signal_watch()
|
||||||
# any messages at all
|
i = pipeline.get_bus().connect('message::application', self.on_message)
|
||||||
watch_id = pipeline.get_bus().add_watch(gst.MESSAGE_ANY,
|
|
||||||
self.on_message)
|
|
||||||
if pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_SUCCESS:
|
if pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_SUCCESS:
|
||||||
print "going into main"
|
print "going into main"
|
||||||
gtk.Dialog.run(self)
|
gtk.Dialog.run(self)
|
||||||
else:
|
else:
|
||||||
self.error('Could not set state')
|
self.error('Could not set state')
|
||||||
|
pipeline.get_bus().disconnect(i)
|
||||||
|
pipeline.get_bus().remove_signal_watch()
|
||||||
pipeline.set_state(gst.STATE_NULL)
|
pipeline.set_state(gst.STATE_NULL)
|
||||||
gobject.source_remove(watch_id)
|
|
||||||
except gobject.GError, e:
|
except gobject.GError, e:
|
||||||
self.set_sensitive(True)
|
self.set_sensitive(True)
|
||||||
self.error('Could not create pipeline', e.__str__)
|
self.error('Could not create pipeline', e.__str__)
|
||||||
|
|
Loading…
Reference in a new issue