[pitivi] _project: Take into account Encoding GstPreset when looking for element



commit 0dab6aa4da5fae94c6e51ceb8584d37fe4da9ca5
Author: Thibault Saunier <thibault saunier osg samsung com>
Date:   Fri Jan 6 09:48:59 2017 -0300

    _project: Take into account Encoding GstPreset when looking for element
    
    Otherwise we might pick an incompatible element and thus fail later when
    actually rendering
    
    Reviewed-by: Alex Băluț <alexandru balut gmail com>
    Differential Revision: https://phabricator.freedesktop.org/D1592

 pitivi/project.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 5b037e4..fafbb01 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -1505,6 +1505,19 @@ class Project(Loggable, GES.Project):
                                                    False)
         if factories:
             factories.sort(key=lambda x: - x.get_rank())
+            preset = profile.get_preset()
+            # Make sure that if a #Gst.Preset is set we find an
+            # element that can handle that preset.
+            if preset:
+                for factory in factories:
+                    elem = factory.create()
+                    if isinstance(elem, Gst.Preset):
+                        if elem.load_preset(preset):
+                            return factory.get_name()
+                self.error("Could not find any element with preset %s",
+                           preset)
+                return None
+
             return factories[0].get_name()
         return None
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]