Rename class callbacks to avoid ambiguities with possible class members
authorAntonio Ospite <ao2@ao2.it>
Thu, 30 Aug 2018 14:16:38 +0000 (16:16 +0200)
committerAntonio Ospite <ao2@ao2.it>
Thu, 30 Aug 2018 14:16:38 +0000 (16:16 +0200)
python/gst-input-selector-switch.py
python/gst-playbin-switch.py

index f653dfa..31b93d0 100755 (executable)
@@ -43,7 +43,7 @@ class Player:
         self.pipeline.set_state(Gst.State.NULL)
         self.loop.quit()
 
         self.pipeline.set_state(Gst.State.NULL)
         self.loop.quit()
 
-    def switch(self):
+    def on_switch(self):
         active_pad = self.selector.get_property("active-pad")
         if active_pad.get_name() == "sink_0":
             new_pad = self.selector.get_static_pad("sink_1")
         active_pad = self.selector.get_property("active-pad")
         if active_pad.get_name() == "sink_0":
             new_pad = self.selector.get_static_pad("sink_1")
@@ -76,7 +76,7 @@ def main():
 
     def stdin_cb(source, condition):
         source.readline()
 
     def stdin_cb(source, condition):
         source.readline()
-        player.switch()
+        player.on_switch()
         return True
 
     GObject.io_add_watch(sys.stdin, GObject.IO_IN, stdin_cb)
         return True
 
     GObject.io_add_watch(sys.stdin, GObject.IO_IN, stdin_cb)
index 5333f53..85be7f2 100755 (executable)
@@ -58,7 +58,7 @@ class Player:
         self.pipeline.set_state(Gst.State.NULL)
         self.loop.quit()
 
         self.pipeline.set_state(Gst.State.NULL)
         self.loop.quit()
 
-    def switch(self):
+    def on_switch(self):
         self.uri_index ^= 1
         print("Next: %s" % self.uris[self.uri_index])
 
         self.uri_index ^= 1
         print("Next: %s" % self.uris[self.uri_index])
 
@@ -94,7 +94,7 @@ def main():
 
     def stdin_cb(source, condition):
         source.readline()
 
     def stdin_cb(source, condition):
         source.readline()
-        player.switch()
+        player.on_switch()
         return True
 
     GObject.io_add_watch(sys.stdin, GObject.IO_IN, stdin_cb)
         return True
 
     GObject.io_add_watch(sys.stdin, GObject.IO_IN, stdin_cb)