summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2006-02-10 10:53:22 +0000
committerAndy Wingo <wingo@pobox.com>2006-02-10 10:53:22 +0000
commit44a2c63fc61cf58709b11218c34305c5382a655e (patch)
treef66810d89ec291ec9cc5e623bcef27dbfaa23ac7 /examples
parente11b1fcafae35ae823c955311d45c1a169fe2856 (diff)
examples/play.py (GstPlayer.query_position)
Original commit message from CVS: 2006-02-10 Andy Wingo <wingo@pobox.com> * examples/play.py (GstPlayer.query_position) (PlayerWindow.update_scale_cb): Only return position, duration from query_position -- fixes a bugaboo. (main): Add some input validation. * examples/pipeline-tester (data): Add a pipeline to test software scaling.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/pipeline-tester6
-rw-r--r--examples/play.py24
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()