examples/pipeline-tester: Fix for state change changes.
authorAndy Wingo <wingo@pobox.com>
Tue, 18 Oct 2005 10:29:02 +0000 (10:29 +0000)
committerAndy Wingo <wingo@pobox.com>
Tue, 18 Oct 2005 10:29:02 +0000 (10:29 +0000)
Original commit message from CVS:
2005-10-18  Andy Wingo  <wingo@pobox.com>

* examples/pipeline-tester: Fix for state change changes.

ChangeLog
examples/pipeline-tester

index 92ebe11..5b656e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 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
        for messages.
        (_wrap_gst_message_tp_repr): Is your message repr t00 sma11?
index 029d7b7..63c11d7 100755 (executable)
@@ -194,9 +194,11 @@ class Window(gtk.Window):
             m.format_secondary_text(secondary)
         m.run()
         m.destroy()
-                              
+        self.stop()
+
     def on_message(self, bus, message):
         t = message.type
+        print message
         if t == gst.MESSAGE_STATE_CHANGED:
             pass
         elif t == gst.MESSAGE_ERROR:
@@ -227,18 +229,9 @@ class Window(gtk.Window):
         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)
-            bus.remove_signal_watch()
-            bus.disconnect(watch_id)
-            return False
-        else:
-            self.pipeline = pipeline
-            self.watch_id = watch_id
-            return True
+        self.pipeline = pipeline
+        self.watch_id = watch_id
+        pipeline.set_state(gst.STATE_PLAYING)
 
     def stop(self):
         bus = self.pipeline.get_bus()
@@ -254,9 +247,9 @@ class Window(gtk.Window):
             self.button.set_label(gtk.STOCK_MEDIA_PLAY)
             self.playing = False
         else:
-            if self.play():
-                self.playing = True
-                self.button.set_label(gtk.STOCK_MEDIA_STOP)
+            self.play()
+            self.playing = True
+            self.button.set_label(gtk.STOCK_MEDIA_STOP)
 
 if __name__ == '__main__':
     w = Window()