[pitivi: 6/28] factories/base.py: add setFilterCaps method to dynamically set caps on SourceFactory bins



commit 462482e13c715610312251328cebe698d518fc2b
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Mon Feb 1 19:44:22 2010 -0800

    factories/base.py: add setFilterCaps method to dynamically set caps on
    SourceFactory bins

 pitivi/factories/base.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/factories/base.py b/pitivi/factories/base.py
index 1f192ae..d0bfe4e 100644
--- a/pitivi/factories/base.py
+++ b/pitivi/factories/base.py
@@ -219,6 +219,7 @@ class SourceFactory(ObjectFactory):
         self.uri = uri
         self.max_bins = -1
         self.current_bins = 0
+        self._filtercaps = gst.Caps("video/x-raw-rgb;video/x-raw-yuv")
 
     def getInterpolatedProperties(self, stream):
         self.debug("stream:%r", stream)
@@ -419,9 +420,7 @@ class SourceFactory(ObjectFactory):
                 b.scale = gst.element_factory_make("videoscale", "scale")
                 b.scale.props.method = 2
             b.filter = gst.element_factory_make("capsfilter")
-            b.filter.props.caps = gst.Caps("video/x-raw-rgb,"
-                "width=320,height=240;video/x-raw-yuv,width=320,"
-                "height=240")
+            b.filter.props.caps = self._filtercaps
 
             b.add(b.queue, b.scale, b.filter, b.csp, b.alpha)
             gst.element_link_many(b.queue, b.scale, b.filter, b.csp)
@@ -486,6 +485,12 @@ class SourceFactory(ObjectFactory):
     def addInputStream(self, stream):
         raise AssertionError("source factories can't have input streams")
 
+    def setFilterCaps(self, caps):
+        self._filtercaps = caps
+        for b in self.bins:
+            if hasattr(b, "filter"):
+                b.filter.props.caps = caps
+
 class SinkFactory(ObjectFactory):
     """
     Base class for factories that consume input and have no output.



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