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



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

    gstplayer: Reset tick on stream start

 gnomemusic/gstplayer.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index d909cf06..0366bc97 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -68,6 +68,7 @@ class GstPlayer(GObject.GObject):
         Gst.init(None)
 
         self._duration = -1.
+        self._tick = 0
 
         self._missing_plugin_messages = []
         self._settings = Gio.Settings.new('org.gnome.Music')
@@ -141,13 +142,14 @@ class GstPlayer(GObject.GObject):
 
         # TODO: Workaround the first duration change not being emitted
         # and hence smoothscale not being initialized properly.
-        if self.props.duration == -1.:
-            self._on_duration_changed(None, None)
+        # if self.props.duration == -1.:
+        #     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):
@@ -209,6 +211,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]