X-Git-Url: https://git.ao2.it/experiments/gstreamer.git/blobdiff_plain/06fbbcb846a06000f216b99d40243f4f973edd4c..7bdb0839fbadd5c43133b7e14a49d41d3dd84e44:/python/gst-trick-mode.py diff --git a/python/gst-trick-mode.py b/python/gst-trick-mode.py index 833892b..cc0e7a6 100755 --- a/python/gst-trick-mode.py +++ b/python/gst-trick-mode.py @@ -58,24 +58,14 @@ class Player: def set_rate(self, rate): self._rate = rate - try: - position, fmt = self._player.query_position(Gst.Format.TIME) - except: - position = 0 + position = self._player.query_position(Gst.Format.TIME)[1] # Create the seek event - if rate > 0: - seek_event = Gst.Event.new_seek(rate, - Gst.Format.TIME, - Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, - Gst.SeekType.SET, position, - Gst.SeekType.NONE, 0) - else: - seek_event = Gst.Event.new_seek(rate, - Gst.Format.TIME, - Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, - Gst.SeekType.SET, 0, - Gst.SeekType.SET, position) + seek_event = Gst.Event.new_seek(rate, + Gst.Format.TIME, + Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, + Gst.SeekType.SET, position, + Gst.SeekType.SET, -1) if seek_event: self._player.send_event(seek_event)