[pitivi] stream.py: implement has_alpha() for RGB and YUV streams



commit 6dc1d2f0198e0ff06d221369deefcb3261e9441f
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Thu Jan 7 13:48:13 2010 -0800

    stream.py: implement has_alpha() for RGB and YUV streams

 pitivi/stream.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/stream.py b/pitivi/stream.py
index 5f70f5f..5b3aa1d 100644
--- a/pitivi/stream.py
+++ b/pitivi/stream.py
@@ -143,7 +143,8 @@ class VideoStream(MultimediaStream):
         self.videotype = struct.get_name()
         self.raw = self.videotype.startswith("video/x-raw-")
 
-        for property_name in ('width', 'height', 'framerate', 'format'):
+        for property_name in ('width', 'height', 'framerate', 'format',
+            'bpp', 'depth'):
             try:
                 setattr(self, property_name, struct[property_name])
             except KeyError:
@@ -165,6 +166,15 @@ class VideoStream(MultimediaStream):
         except:
             self.dar = gst.Fraction(4, 3)
 
+    def has_alpha(self):
+        if self.videotype == "video/x-raw-rgb":
+            return ((hasattr(self, 'bpp') and (self.bpp == 32)) and
+                    (hasattr(self, 'depth') and (self.depth == 32)))
+        elif self.videotype == "video/x-raw-yuv":
+            return (hasattr(self, 'format') and
+                    self.format == gst.Fourcc('AYUV'))
+        return False
+
 class AudioStream(MultimediaStream):
     """
     Audio stream



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