mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
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.
This commit is contained in:
parent
e11b1fcafa
commit
44a2c63fc6
3 changed files with 32 additions and 8 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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.
|
||||
|
||||
2006-02-07 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* gst/gst.override:
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue