[pitivi] render: Take into account video size scaling value when rendering
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] render: Take into account video size scaling value when rendering
- Date: Thu, 17 Oct 2013 23:28:39 +0000 (UTC)
commit 79fb9abf3b4101cbafe2579c6ef1ca573d217f9a
Author: Thibault Saunier <thibault saunier collabora com>
Date: Thu Oct 17 08:52:50 2013 -0300
render: Take into account video size scaling value when rendering
https://bugzilla.gnome.org/show_bug.cgi?id=709473
pitivi/project.py | 29 +++++++++++++++++++++++++----
pitivi/render.py | 4 +++-
2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index ad831f3..6dbb3e7 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -604,6 +604,7 @@ class Project(Loggable, GES.Project):
self._vcodecsettings_cache = {}
# A (aencoder -> acodecsettings) map.
self._acodecsettings_cache = {}
+ self._has_rendering_values = False
#-----------------#
# Our properties #
@@ -647,6 +648,19 @@ class Project(Loggable, GES.Project):
self.setModificationState(True)
# Encoding related properties
+ def set_rendering(self, rendering):
+ if rendering and self._has_rendering_values != rendering:
+ copy = Gst.Caps.from_string(self.video_profile.get_restriction().to_string())
+ self.video_profile.set_restriction(copy)
+ self.videowidth = self.videowidth * self.render_scale / 100
+ self.videoheight = self.videoheight * self.render_scale / 100
+ elif self._has_rendering_values != rendering:
+ copy = Gst.Caps.from_string(self.video_profile.get_restriction().to_string())
+ self.video_profile.set_restriction(copy)
+ self.videowidth = self.videowidth / self.render_scale * 100
+ self.videoheight = self.videoheight / self.render_scale * 100
+ self._has_rendering_values = rendering
+
@property
def videowidth(self):
return self.video_profile.get_restriction()[0]["width"]
@@ -905,10 +919,17 @@ class Project(Loggable, GES.Project):
@type render: bool
"""
if render:
- scale = self.render_scale
- else:
- scale = 100
- return self.videowidth * scale / 100, self.videoheight * scale / 100
+ if not self._has_rendering_values:
+ return (self.videowidth * self.render_scale / 100,
+ self.videoheight * self.render_scale / 100)
+ else:
+ return self.videowidth, self.videoheight
+
+ if self._has_rendering_values:
+ return (self.videowidth / self.render_scale * 100,
+ self.videoheight / self.render_scale * 100)
+
+ return self.videowidth, self.videoheight
def getVideoCaps(self, render=False):
""" Returns the GstCaps corresponding to the video settings """
diff --git a/pitivi/render.py b/pitivi/render.py
index 2f7962b..e9bfabe 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -836,6 +836,7 @@ class RenderDialog(Loggable):
def _shutDown(self):
""" The render process has been aborted, shutdown the gstreamer pipeline
and disconnect from its signals """
+ self.project.set_rendering(False)
self._is_rendering = False
self._rendering_is_paused = False
self._time_spent_paused = 0
@@ -906,6 +907,7 @@ class RenderDialog(Loggable):
self._factory_formats[encoder_string] = fmt
break
+ self.project.set_rendering(True)
self._pipeline.set_render_settings(self.outfile, self.project.container_profile)
self.startAction()
self.progress.window.show()
@@ -1049,7 +1051,7 @@ class RenderDialog(Loggable):
self.updateResolution()
def updateResolution(self):
- width, height = self.project.getVideoWidthAndHeight(render=True)
+ width, height = self.project.getVideoWidthAndHeight(True)
self.resolution_label.set_text(u"%d×%d" % (width, height))
def _projectSettingsButtonClickedCb(self, button):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]