[gnome-music/wip/mschraal/gapless-v3: 82/83] gstplayer: Reset tick on stream start



commit 4fc6dca7026f1ac2e8307b6a6649c81e100139dc
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Aug 29 23:36:24 2018 +0200

    gstplayer: Reset tick on stream start

 gnomemusic/gstplayer.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index b9b6c332..4d435fe1 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -68,7 +68,7 @@ class GstPlayer(GObject.GObject):
         Gst.init(None)
 
         self._duration = None
-
+        self._tick = 0
         self._missing_plugin_messages = []
         self._settings = Gio.Settings.new('org.gnome.Music')
 
@@ -140,13 +140,14 @@ class GstPlayer(GObject.GObject):
 
         # TODO: Workaround the first duration change not being emitted
         # and hence smoothscale not being initialized properly.
-        if self.duration is None:
-            self._on_duration_changed(None, None)
+        # if self.duration is None:
+        #     self._on_duration_changed(None, None)
 
     @log
     def _on_clock_tick(self, clock, time, id, data):
-        tick = time / Gst.SECOND
-        self.emit('clock-tick', tick)
+        self.emit('clock-tick', self._tick)
+        print("TICK", self._tick)
+        self._tick += 1
 
     @log
     def _on_bus_state_changed(self, bus, message):
@@ -206,6 +207,7 @@ class GstPlayer(GObject.GObject):
 
         def delayed_query(bus, message):
             self._on_duration_changed(None, None)
+            self._tick = 0
             self.emit('stream-start')
 
             return False


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]