gst-trick-mode.py: pass file names in the command line not URIs
authorAntonio Ospite <ao2@ao2.it>
Wed, 17 Sep 2014 11:33:55 +0000 (13:33 +0200)
committerAntonio Ospite <ao2@ao2.it>
Wed, 17 Sep 2014 11:44:02 +0000 (13:44 +0200)
python/gst-trick-mode.py

index a01daba..0bb5877 100755 (executable)
@@ -17,12 +17,11 @@ GObject.threads_init()
 
 
 class Player:
 
 
 class Player:
-    def __init__(self, filename, rate):
-        self._filename = filename
+    def __init__(self, uri, rate):
         self._rate = rate
 
         self._player = Gst.ElementFactory.make("playbin", "player")
         self._rate = rate
 
         self._player = Gst.ElementFactory.make("playbin", "player")
-        self._player.set_property("uri", filename)
+        self._player.set_property("uri", uri)
 
         bus = self._player.get_bus()
         bus.add_signal_watch()
 
         bus = self._player.get_bus()
         bus.add_signal_watch()
@@ -73,17 +72,15 @@ class Player:
 
 def main(args):
     def usage():
 
 def main(args):
     def usage():
-        sys.stdout.write("usage: %s <URI-OF-MEDIA-FILE>\n" % args[0])
+        sys.stdout.write("usage: %s <filename>\n" % args[0])
 
     if len(args) != 2:
         usage()
         sys.exit(1)
 
 
     if len(args) != 2:
         usage()
         sys.exit(1)
 
-    if not Gst.uri_is_valid(args[1]):
-        sys.stderr.write("Error: Invalid URI: %s\n" % args[1])
-        sys.exit(1)
+    uri = Gst.filename_to_uri(args[1])
 
 
-    player = Player(args[1], 3.0)
+    player = Player(uri, 3.0)
     player.run()
 
 if __name__ == '__main__':
     player.run()
 
 if __name__ == '__main__':