Commit c0160a6f authored by Alexandru Băluț's avatar Alexandru Băluț

previewers: Remove double initial scheduling

_schedule_next_thumb_generation was being called twice, causing two
timeouts to be created:
- from _start_thumbnailing_cb,
- from __bus_message_cb because the pipeline has been PAUSED.

Now we only schedule when the pipeline has been PAUSED.

Additionally, we create the pipeline only if needed, to avoid waiting
for no reason.

Differential Revision:
parent a0dcb66a
......@@ -495,6 +495,10 @@ class VideoPreviewer(Previewer, Zoomable, Loggable):
thumbnail will be generated +/- 10%. Even then, it will only
happen when the gobject loop is idle to avoid blocking the UI.
if self._thumb_cb_id is not None:
# A thumb has already been scheduled.
if not self.queue:
# Nothing left to do.
self.debug("Thumbnails generation complete")
......@@ -525,18 +529,22 @@ class VideoPreviewer(Previewer, Zoomable, Loggable):
self.__start_id = None
if isinstance(self.ges_elem, GES.ImageSource):
self.debug('Now generating thumbnail for: %s', path_from_uri(self.uri))
self.debug("Generating thumbnail for image: %s", path_from_uri(self.uri))
self.__image_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
Gst.uri_get_location(self.uri), -1, self.thumb_height, True)
self.thumb_width = self.__image_pixbuf.props.width
self.debug('Now generating thumbnails for: %s', path_from_uri(self.uri))
self.pipeline = self._setup_pipeline()
# Update the thumbnails with what we already have, if anything.
if self.queue:
self.debug("Generating thumbnails for video: %s, %s", path_from_uri(self.uri), self.queue)
# When the pipeline status is set to PAUSED,
# the first thumbnail generation will be scheduled.
self.pipeline = self._setup_pipeline()
def _create_next_thumb_cb(self):
"""Creates a missing thumbnail."""
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