[pitivi] project: Set video properties atomically
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] project: Set video properties atomically
- Date: Tue, 25 Aug 2020 14:33:22 +0000 (UTC)
commit 298b00101196d4773e8c24b1cd30aa9cd4b1b133
Author: Thibault Saunier <tsaunier igalia com>
Date: Mon May 18 09:53:00 2020 -0400
project: Set video properties atomically
This is cleaner and would avoid having GES do calculation while
setting the project setting.
Also ensure that we set project width/height as int
pitivi/project.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index c4b479fa..7bdae9f8 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -1051,8 +1051,8 @@ class Project(Loggable, GES.Project):
height (int): The new project height.
framerate (Gst.Fraction): The new project framerate.
"""
- changed = any([self._set_video_restriction("width", width),
- self._set_video_restriction("height", height),
+ changed = any([self._set_video_restriction("width", int(width)),
+ self._set_video_restriction("height", int(height)),
self._set_video_restriction("framerate", framerate)])
if changed:
self.update_restriction_caps()
@@ -2029,12 +2029,14 @@ class Project(Loggable, GES.Project):
if video_streams and self._has_default_video_settings:
video = video_streams[0]
if not video.is_image():
- self.videowidth = video.get_natural_width()
- self.videoheight = video.get_natural_height()
+ videowidth = video.get_natural_width()
+ videoheight = video.get_natural_height()
+ videorate = self.videorate
if video.get_framerate_num() > 0:
# The asset has a non-variable framerate.
- self.videorate = Gst.Fraction(video.get_framerate_num(),
- video.get_framerate_denom())
+ videorate = Gst.Fraction(video.get_framerate_num(),
+ video.get_framerate_denom())
+ self.set_video_properties(videowidth, videoheight, videorate)
self._has_default_video_settings = False
emit = True
audio_streams = info.get_audio_streams()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]