[pitivi] Never apply rendering video size to the track restriction caps
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Never apply rendering video size to the track restriction caps
- Date: Mon, 21 Dec 2015 16:53:16 +0000 (UTC)
commit 248ac77a1e909521b13b7ed602bbbd96eb6563c4
Author: Thibault Saunier <tsaunier gnome org>
Date: Fri Dec 18 13:13:31 2015 +0100
Never apply rendering video size to the track restriction caps
Otherwise the result will not be correct as the scaling will be done at
the source level instead of doing it *after* the video compositor.
Fixes: T3421
Differential Revision: https://phabricator.freedesktop.org/D590
pitivi/project.py | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index b02d70a..c184562 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -852,19 +852,27 @@ class Project(Loggable, GES.Project):
# Encoding related properties
def set_rendering(self, rendering):
+ video_restrictions = self.video_profile.get_restriction().copy_nth(0)
+ video_restrictions_struct = video_restrictions[0]
+
if rendering and self._has_rendering_values != rendering:
- self.videowidth = self.videowidth * self.render_scale / 100
- self.videoheight = self.videoheight * self.render_scale / 100
+ width = int(video_restrictions_struct["width"] * self.render_scale / 100)
+ height = int(video_restrictions_struct["height"] * self.render_scale / 100)
+
+ video_restrictions.set_value('width', width)
+ video_restrictions.set_value('height', height)
elif self._has_rendering_values != rendering:
- self.videowidth = self.videowidth / self.render_scale * 100
- self.videoheight = self.videoheight / self.render_scale * 100
- else:
- restriction = self.video_profile.get_restriction().copy_nth(0)
- self.video_profile.set_restriction(restriction)
+ width = int(video_restrictions_struct["width"] / self.render_scale * 100)
+ height = int(video_restrictions_struct["height"] / self.render_scale * 100)
+ video_restrictions.set_value("width", width)
+ video_restrictions.set_value("height", height)
+ else:
restriction = self.audio_profile.get_restriction().copy_nth(0)
self.audio_profile.set_restriction(restriction)
+
self._has_rendering_values = rendering
+ self.video_profile.set_restriction(video_restrictions)
@staticmethod
def _set_restriction(profile, name, value):
@@ -1127,10 +1135,12 @@ class Project(Loggable, GES.Project):
return True
def update_restriction_caps(self):
+ # Get the height/width without rendering settings applied
+ width, height = self.getVideoWidthAndHeight()
caps = Gst.Caps.new_empty_simple("video/x-raw")
- caps.set_value("width", self.videowidth)
- caps.set_value("height", self.videoheight)
+ caps.set_value("width", width)
+ caps.set_value("height", height)
caps.set_value("framerate", self.videorate)
for track in self.timeline.get_tracks():
if isinstance(track, GES.VideoTrack):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]