From 2483d94a26386079a13f63aa6740d72ace46ea82 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 17 Sep 2014 15:46:02 +0200 Subject: [PATCH 1/1] gst-trick-mode.py: fix seeking with a negative rate --- python/gst-trick-mode.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/python/gst-trick-mode.py b/python/gst-trick-mode.py index 43cd8f4..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) -- 2.1.4