[pitivi: 25/28] smartscale.py: don't assume that width, height, etc will be present in the given caps



commit cdf20e12679ab52666eb9fd572c5314c5a9d5832
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Wed Feb 10 13:54:23 2010 -0800

    smartscale.py: don't assume that width, height, etc will be present in the
    given caps

 pitivi/elements/smartscale.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/elements/smartscale.py b/pitivi/elements/smartscale.py
index 29499da..f30f186 100644
--- a/pitivi/elements/smartscale.py
+++ b/pitivi/elements/smartscale.py
@@ -124,8 +124,10 @@ class SmartVideoScale(gst.Bin):
         dar = gst.Fraction(1, 1)
         if force or (caps and caps.is_fixed()):
             struc = caps[0]
-            width = struc["width"]
-            height = struc["height"]
+            if struc.has_field("width"):
+                width = struc["width"]
+            if struc.has_field("height"):
+                height = struc["height"]
             if struc.has_field('pixel-aspect-ratio'):
                 par = struc['pixel-aspect-ratio']
             dar = gst.Fraction(width * par.num, height * par.denom)



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