diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-08-22 19:47:25 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-08-25 17:29:57 (GMT) |
commit | 9fa464474cadc0ab088a3ae4c6a05bbd5a1a9d95 (patch) | |
tree | 517dfc6e8687e85c87307f4a4814f806bc0121d4 | |
parent | 32e1688db1dc45f9ed75d844ff7b651d835cfd44 (diff) |
Update time and state on seek
When the horizontal scroll changes its value it updates the time
position (label) to know where are we going to drop the stream.
The state of the stream[1] is updated with a timeout of 1ns, so it
doesn't consume too much CPU. This impacts directily the performance
on seeking videos and audios.
[1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-get-state
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
-rw-r--r-- | jukeboxactivity.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/jukeboxactivity.py b/jukeboxactivity.py index aebbc98..5951b01 100644 --- a/jukeboxactivity.py +++ b/jukeboxactivity.py @@ -558,11 +558,6 @@ class JukeboxActivity(activity.Activity): if self.was_playing: self.player.pause() - # don't timeout-update position during seek - if self.update_id != -1: - GObject.source_remove(self.update_id) - self.update_id = -1 - # make sure we get changed notifies if self.changed_id == -1: self.changed_id = self.control.hscale.connect('value-changed', @@ -573,7 +568,7 @@ class JukeboxActivity(activity.Activity): real = long(scale.get_value() * self.p_duration / 100) # in ns self.player.seek(real) # allow for a preroll - self.player.get_state(timeout=50 * gst.MSECOND) # 50 ms + self.player.get_state() # timeout = 1 ns def scale_button_release_cb(self, widget, event): # see seek.cstop_seek @@ -589,7 +584,8 @@ class JukeboxActivity(activity.Activity): self.player.play() if self.update_id != -1: - self.error('Had a previous update timeout id') + GObject.source_remove(self.seek_timeout_id) + self.update_id = -1 else: self.update_id = GObject.timeout_add(self.UPDATE_INTERVAL, self.update_scale_cb) |