diff options
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/pipeline-tester | 6 | ||||
-rw-r--r-- | examples/play.py | 24 |
2 files changed, 22 insertions, 8 deletions
diff --git a/examples/pipeline-tester b/examples/pipeline-tester index 5cd99d7..069d891 100755 --- a/examples/pipeline-tester +++ b/examples/pipeline-tester @@ -67,6 +67,12 @@ data = (('Video capture via V4L', ('Video test, RGB format', 'videotestsrc \n' ' ! video/x-raw-rgb,red_mask=0xff00 \n' + ' ! ffmpegcolorspace \n' + ' ! ximagesink'), + ('Software scaling', + 'videotestsrc \n' + ' ! video/x-raw-rgb,height=200,width=320 \n' + ' ! videoscale method=2 \n' ' ! ximagesink'), ('Reencode Vorbis to mulaw, play via ALSA', 'filesrc location=cooldance.ogg \n' diff --git a/examples/play.py b/examples/play.py index c3137e7..95f9f25 100644 --- a/examples/play.py +++ b/examples/play.py @@ -29,20 +29,16 @@ class GstPlayer: def query_position(self): "Returns a (position, duration) tuple" try: - ret = self.player.query_position(gst.FORMAT_TIME) + position, format = self.player.query_position(gst.FORMAT_TIME) except: position = gst.CLOCK_TIME_NONE - else: - position = ret[0] try: - ret = self.player.query_duration(gst.FORMAT_TIME) + duration, format = self.player.query_duration(gst.FORMAT_TIME) except: duration = gst.CLOCK_TIME_NONE - else: - duration = ret[0] - return (position, duration, ret[1]) + return (position, duration) def seek(self, location): """ @@ -222,7 +218,7 @@ class PlayerWindow(gtk.Window): self.update_scale_cb) def update_scale_cb(self): - self.p_position, self.p_duration, format = self.player.query_position() + self.p_position, self.p_duration = self.player.query_position() if self.p_position != gst.CLOCK_TIME_NONE: value = self.p_position * 100.0 / self.p_duration self.adjustment.set_value(value) @@ -260,7 +256,19 @@ class PlayerWindow(gtk.Window): self.adjustment.set_value(0.0) def main(args): + def usage(): + sys.stderr.write("usage: %s URI-OF-MEDIA-FILE\n" % args[0]) + sys.exit(1) + w = PlayerWindow() + + if len(args) != 2: + usage() + + if not gst.uri_is_valid(args[1]): + sys.stderr.write("Error: Invalid URI: %s\n" % args[1]) + sys.exit(1) + w.load_file(args[1]) w.show_all() |