Commit 2fa4b631 authored by Jean Felder's avatar Jean Felder

player: Fix signal emission after a seek operation

As the seek_simple operation is asynchronous, the seek-finished signal
cannot directly be emitted by the Player.

Fix the issue by listening to the reset-time message in
GstPlayer. This message is sent once the seek_simple operation is
finished. The seek-finished signal is then transmitted to the Player.
parent 4804e73f
Pipeline #86940 passed with stages
in 7 minutes and 47 seconds
......@@ -51,7 +51,8 @@ class GstPlayer(GObject.GObject):
__gsignals__ = {
'eos': (GObject.SignalFlags.RUN_FIRST, None, ()),
'clock-tick': (GObject.SignalFlags.RUN_FIRST, None, (int, ))
'clock-tick': (GObject.SignalFlags.RUN_FIRST, None, (int, )),
'seek-finished': (GObject.SignalFlags.RUN_FIRST, None, ())
def __repr__(self):
......@@ -86,6 +87,7 @@ class GstPlayer(GObject.GObject):
self._bus.connect('message::async-done', self._on_async_done)
self._bus.connect('message::error', self._on_bus_error)
self._bus.connect('message::element', self._on_bus_element)
self._bus.connect('message::reset-time', self._on_reset_time)
self._bus.connect('message::eos', self._on_bus_eos)
self._bus.connect('message::new-clock', self._on_new_clock)
......@@ -135,6 +137,10 @@ class GstPlayer(GObject.GObject):
def _on_reset_time(self, bus, message):
def _on_new_clock(self, bus, message):
clock = message.parse_new_clock()
......@@ -275,7 +281,6 @@ class GstPlayer(GObject.GObject):
:param float seconds: Position in seconds to seek
# FIXME: seek should be signalled to MPRIS
Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT,
seconds * Gst.SECOND)
......@@ -579,6 +579,7 @@ class Player(GObject.GObject):
self._gst_player = GstPlayer(application)
self._gst_player.connect('clock-tick', self._on_clock_tick)
self._gst_player.connect('eos', self._on_eos)
self._gst_player.connect('seek-finished', self._on_seek_finished)
'duration', self, 'duration', GObject.BindingFlags.SYNC_CREATE)
......@@ -878,7 +879,6 @@ class Player(GObject.GObject):
duration_second = self._gst_player.props.duration
if position_second <= duration_second:
def get_mpris_playlist(self):
......@@ -892,3 +892,8 @@ class Player(GObject.GObject):
:rtype: list of index and Grl.Media
return self._playlist.get_mpris_playlist()
def _on_seek_finished(self, klass):
# FIXME: Just a proxy
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment