[pitivi] render: Add a static _factory_formats static field.
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] render: Add a static _factory_formats static field.
- Date: Fri, 4 Oct 2013 21:17:23 +0000 (UTC)
commit 9244b9339ce74e8a2db6cb43a5fb0f5d3ed0bf54
Author: Mathieu Duponchelle <mduponchelle1 gmail com>
Date: Wed Oct 2 19:05:26 2013 +0200
render: Add a static _factory_formats static field.
This field is used because of introspection problems in
fixating the static_pad_templates, for some reason we can't do
it more than once, so we keep the result stored.
pitivi/render.py | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/pitivi/render.py b/pitivi/render.py
index 3ac588d..2f7962b 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -313,6 +313,8 @@ class RenderDialog(Loggable):
"""
INHIBIT_REASON = _("Currently rendering")
+ _factory_formats = {}
+
def __init__(self, app, project, pipeline=None):
from pitivi.preset import RenderPresetManager
@@ -886,16 +888,23 @@ class RenderDialog(Loggable):
self.progress = RenderingProgressDialog(self.app, self)
self.window.hide() # Hide the rendering settings dialog while rendering
- # Now find a format to set on the restriction caps.
- # The reason is we can't send different formats on the encoders.
- factory = Gst.ElementFactory.find(self.project.vencoder)
- for struct in factory.get_static_pad_templates():
- if struct.direction == Gst.PadDirection.SINK:
- caps = struct.get_caps()
- fixed = caps.fixate()
- fmt = fixed.get_structure(0).get_value("format")
- self.project.video_profile.get_restriction()[0]["format"] = fmt
- break
+ encoder_string = self.project.vencoder
+ try:
+ fmt = self._factory_formats[encoder_string]
+ self.project.video_profile.get_restriction()[0]["format"] = fmt
+ except KeyError:
+ # Now find a format to set on the restriction caps.
+ # The reason is we can't send different formats on the encoders.
+ factory = Gst.ElementFactory.find(self.project.vencoder)
+ for struct in factory.get_static_pad_templates():
+ if struct.direction == Gst.PadDirection.SINK:
+ caps = struct.get_caps()
+ caps = caps.copy()
+ fixed = caps.fixate()
+ fmt = fixed.get_structure(0).get_value("format")
+ self.project.video_profile.get_restriction()[0]["format"] = fmt
+ self._factory_formats[encoder_string] = fmt
+ break
self._pipeline.set_render_settings(self.outfile, self.project.container_profile)
self.startAction()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]