[pitivi: 4/13] Use pad.props.caps rather than pad.get_caps() in s



commit f62773d288635a9a192470a040d29aed01222e91
Author: Alessandro Decina <alessandro decina collabora co uk>
Date:   Wed Mar 11 16:02:32 2009 +0100

    Use pad.props.caps rather than pad.get_caps() in some places where we don't expect unfixed caps.
    
    Fixes #574595.
---
 pitivi/discoverer.py |    8 +++++---
 pitivi/stream.py     |    4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index ba4f897..7f032d2 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -413,6 +413,7 @@ class Discoverer(object, Signallable, Loggable):
     def _capsNotifyCb(self, pad, unused_property, ghost=None):
         if ghost is None:
             ghost = pad
+
         caps = pad.props.caps
         if caps is None or not caps.is_fixed():
             return
@@ -421,8 +422,7 @@ class Discoverer(object, Signallable, Loggable):
 
         self.unfixed_pads -= 1
         stream = self._addStreamFromPad(ghost)
-        caps_str = str(ghost.get_caps())
-        if caps_str.startswith("video/x-raw"):
+        if caps[0].get_name().startswith("video/x-raw"):
             self._newVideoPadCb(ghost, stream)
 
     def _newDecodedPadCb(self, unused_element, pad, is_last):
@@ -433,7 +433,9 @@ class Discoverer(object, Signallable, Loggable):
         # Demuxers don't seem to implement per stream duration queries anyway.
         self._maybeQueryDuration(pad)
 
-        if pad.get_caps().is_fixed():
+        caps = pad.props.caps
+
+        if caps is not None and caps.is_fixed():
             stream = self._addStreamFromPad(pad)
 
             caps_str = str(pad.get_caps())
diff --git a/pitivi/stream.py b/pitivi/stream.py
index acbfcec..6afa0e4 100644
--- a/pitivi/stream.py
+++ b/pitivi/stream.py
@@ -330,7 +330,9 @@ def get_stream_for_caps(caps, pad=None):
     return ret
 
 def get_stream_for_pad(pad):
-    caps = pad.get_caps()
+    caps = pad.props.caps
+    if caps is None:
+        caps = pad.get_caps()
     pad_id = get_pad_id(pad)
     stream = get_stream_for_caps(caps, pad)
     stream.pad_id = pad_id



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