mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
examples/pipeline-tester: Fix for state change changes.
Original commit message from CVS: 2005-10-18 Andy Wingo <wingo@pobox.com> * examples/pipeline-tester: Fix for state change changes.
This commit is contained in:
parent
840d8e2072
commit
7fbe25b7a0
2 changed files with 11 additions and 16 deletions
|
@ -1,5 +1,7 @@
|
||||||
2005-10-18 Andy Wingo <wingo@pobox.com>
|
2005-10-18 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* examples/pipeline-tester: Fix for state change changes.
|
||||||
|
|
||||||
* gst/gstmessage.override (_wrap_gst_message_tp_repr): Add a repr
|
* gst/gstmessage.override (_wrap_gst_message_tp_repr): Add a repr
|
||||||
for messages.
|
for messages.
|
||||||
(_wrap_gst_message_tp_repr): Is your message repr t00 sma11?
|
(_wrap_gst_message_tp_repr): Is your message repr t00 sma11?
|
||||||
|
|
|
@ -194,9 +194,11 @@ class Window(gtk.Window):
|
||||||
m.format_secondary_text(secondary)
|
m.format_secondary_text(secondary)
|
||||||
m.run()
|
m.run()
|
||||||
m.destroy()
|
m.destroy()
|
||||||
|
self.stop()
|
||||||
|
|
||||||
def on_message(self, bus, message):
|
def on_message(self, bus, message):
|
||||||
t = message.type
|
t = message.type
|
||||||
|
print message
|
||||||
if t == gst.MESSAGE_STATE_CHANGED:
|
if t == gst.MESSAGE_STATE_CHANGED:
|
||||||
pass
|
pass
|
||||||
elif t == gst.MESSAGE_ERROR:
|
elif t == gst.MESSAGE_ERROR:
|
||||||
|
@ -227,18 +229,9 @@ class Window(gtk.Window):
|
||||||
bus = pipeline.get_bus()
|
bus = pipeline.get_bus()
|
||||||
bus.add_signal_watch()
|
bus.add_signal_watch()
|
||||||
watch_id = bus.connect('message', self.on_message)
|
watch_id = bus.connect('message', self.on_message)
|
||||||
if pipeline.set_state(gst.STATE_PLAYING) != gst.STATE_CHANGE_SUCCESS:
|
self.pipeline = pipeline
|
||||||
# make sure we get error messages
|
self.watch_id = watch_id
|
||||||
while gtk.events_pending():
|
pipeline.set_state(gst.STATE_PLAYING)
|
||||||
gtk.main_iteration()
|
|
||||||
pipeline.set_state(gst.STATE_NULL)
|
|
||||||
bus.remove_signal_watch()
|
|
||||||
bus.disconnect(watch_id)
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
self.pipeline = pipeline
|
|
||||||
self.watch_id = watch_id
|
|
||||||
return True
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
bus = self.pipeline.get_bus()
|
bus = self.pipeline.get_bus()
|
||||||
|
@ -254,9 +247,9 @@ class Window(gtk.Window):
|
||||||
self.button.set_label(gtk.STOCK_MEDIA_PLAY)
|
self.button.set_label(gtk.STOCK_MEDIA_PLAY)
|
||||||
self.playing = False
|
self.playing = False
|
||||||
else:
|
else:
|
||||||
if self.play():
|
self.play()
|
||||||
self.playing = True
|
self.playing = True
|
||||||
self.button.set_label(gtk.STOCK_MEDIA_STOP)
|
self.button.set_label(gtk.STOCK_MEDIA_STOP)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
w = Window()
|
w = Window()
|
||||||
|
|
Loading…
Reference in a new issue