[pitivi: 2/28] factories/base.py: move videoscale element to base SourceFactory



commit ab918b386fd6ae56b4385d965f69b3d27c8df15b
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Wed Jan 27 14:02:39 2010 -0800

    factories/base.py: move videoscale element to base SourceFactory

 pitivi/factories/base.py |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/factories/base.py b/pitivi/factories/base.py
index 3ddbe9f..572cad7 100644
--- a/pitivi/factories/base.py
+++ b/pitivi/factories/base.py
@@ -208,6 +208,8 @@ class SourceFactory(ObjectFactory):
         'bin-released': ['bin']
     }
 
+    ffscale_factory = 'ffvideoscale'
+
     # make this an attribute to inject it from tests
     singleDecodeBinClass = SingleDecodeBin
 
@@ -395,14 +397,26 @@ class SourceFactory(ObjectFactory):
                 b.csp = gst.element_factory_make("identity")
 
             b.alpha = gst.element_factory_make("alpha", "internal-alpha")
+            # use ffvideoscale only if available AND width < 2048
+            if (output_stream.width < 2048) and (not output_stream.has_alpha()):
+                try:
+                    b.scale = gst.element_factory_make(self.ffscale_factory, "scale")
+                    b.scale.props.method = 9
+                except gst.ElementNotFoundError:
+                    b.scale = gst.element_factory_make("videoscale", "scale")
+                    b.scale.props.method = 2
+            else:
+                b.scale = gst.element_factory_make("videoscale", "scale")
+                b.scale.props.method = 2
 
-            b.add(b.queue, b.csp, b.alpha)
-            gst.element_link_many(b.queue, b.csp)
+            b.add(b.queue, b.scale, b.csp, b.alpha)
+            gst.element_link_many(b.queue, b.scale, b.csp)
             if child_bin:
                 gst.element_link_many(b.csp, b.child, b.alpha)
                 b.child.sync_state_with_parent()
             else:
                 gst.element_link_many(b.csp, b.alpha)
+            b.scale.sync_state_with_parent()
             b.queue.sync_state_with_parent()
             b.csp.sync_state_with_parent()
             b.alpha.sync_state_with_parent()
@@ -425,7 +439,7 @@ class SourceFactory(ObjectFactory):
             pad.link(topbin.aconv.get_pad("sink"))
             topbin.ghostpad = gst.GhostPad("src", topbin.volume.get_pad("src"))
         elif hasattr(topbin, "alpha"):
-            for element in [topbin.queue, topbin.csp, topbin.alpha]:
+            for element in [topbin.queue, topbin.scale, topbin.csp, topbin.alpha]:
                 element.sync_state_with_parent()
 
             pad.link(topbin.queue.get_pad("sink"))



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