vidi/Player.py: rename the quit() method to stop()
[vidi-player.git] / vidi / Player.py
index 26a9832..58c3ece 100755 (executable)
@@ -30,6 +30,10 @@ GObject.threads_init()
 class Player(object):
     def __init__(self, pipeline):
         self.pipeline = pipeline
+        bus = self.pipeline.get_bus()
+        bus.add_signal_watch()
+        bus.connect("message", self.bus_message_cb)
+
         self.mainloop = GObject.MainLoop()
 
     @staticmethod
@@ -37,25 +41,21 @@ class Player(object):
         pipeline = Gst.parse_launch(pipeline_string)
         return Player(pipeline)
 
-    def quit(self):
+    def stop(self):
         self.mainloop.quit()
         self.pipeline.set_state(Gst.State.NULL)
 
     def bus_message_cb(self, unused_bus, message):
         if message.type == Gst.MessageType.EOS:
-            self.quit()
+            self.stop()
 
     def play(self):
-        bus = self.pipeline.get_bus()
-        bus.add_signal_watch()
-        bus.connect("message", self.bus_message_cb)
-
         self.pipeline.set_state(Gst.State.PLAYING)
 
         try:
             self.mainloop.run()
         except KeyboardInterrupt:
-            self.quit()
+            self.stop()
             return 1
 
         return 0