[pitivi: 12/13] discoverer: link the pads even before we get a not
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi: 12/13] discoverer: link the pads even before we get a not
- Date: Mon, 16 Mar 2009 08:04:50 -0400 (EDT)
commit d5cbac4c3434e3eef0dd183cc57347c7863b4a1f
Author: Alessandro Decina <alessandro decina collabora co uk>
Date: Thu Mar 12 17:14:02 2009 +0100
discoverer: link the pads even before we get a notify::caps signal.
---
pitivi/discoverer.py | 22 +++++++++-------------
tests/test_discoverer.py | 4 ++--
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index edde766..1c3752d 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -431,17 +431,9 @@ class Discoverer(object, Signallable, Loggable):
fakesink.sync_state_with_parent()
def _capsNotifyCb(self, pad, unused_property, ghost=None):
- import pdb
if ghost is None:
ghost = pad
- if not ghost.is_linked():
- caps_str = str(pad.get_caps())
- if caps_str.startswith("video/x-raw"):
- self._newVideoPadCb(ghost)
- else:
- self._newPadCb(ghost)
-
caps = pad.props.caps
if caps is None or not caps.is_fixed():
return
@@ -455,6 +447,13 @@ class Discoverer(object, Signallable, Loggable):
def _newDecodedPadCb(self, unused_element, pad, is_last):
self.info("pad:%s caps:%s is_last:%s", pad, pad.get_caps(), is_last)
+
+ caps_str = str(pad.get_caps())
+ if caps_str.startswith("video/x-raw"):
+ self._newVideoPadCb(pad)
+ else:
+ self._newPadCb(pad)
+
# try to get the duration
# NOTE: this gets the duration only once, usually for the first stream.
# Demuxers don't seem to implement per stream duration queries anyway.
@@ -464,10 +463,7 @@ class Discoverer(object, Signallable, Loggable):
if caps is not None and caps.is_fixed():
stream = self._addStreamFromPad(pad)
-
- caps_str = str(pad.get_caps())
- if caps_str.startswith("video/x-raw"):
- self._newVideoPadCb(pad)
+ if isinstance(stream, VideoStream):
stream.thumbnail = self.thumbnails[pad]
else:
# add the stream once the caps are fixed
@@ -493,6 +489,6 @@ if __name__ == '__main__':
import gobject
discoverer = Discoverer()
- discoverer.addFiles(sys.argv[1:])
+ discoverer.addFiles(['file://%s' % i for i in sys.argv[1:]])
loop = gobject.MainLoop()
loop.run()
diff --git a/tests/test_discoverer.py b/tests/test_discoverer.py
index 68b311f..e4be18b 100644
--- a/tests/test_discoverer.py
+++ b/tests/test_discoverer.py
@@ -320,11 +320,11 @@ class TestAnalysis(TestCase):
self.failUnlessEqual(self.discoverer.current_streams, [])
self.discoverer._newDecodedPadCb(None, video, False)
self.failUnlessEqual(len(self.discoverer.current_streams), 0)
- self.failUnlessEqual(self.discoverer.new_video_pad_cb, 0)
+ self.failUnlessEqual(self.discoverer.new_video_pad_cb, 1)
self.discoverer._newDecodedPadCb(None, audio, False)
self.failUnlessEqual(len(self.discoverer.current_streams), 0)
- self.failUnlessEqual(self.discoverer.new_video_pad_cb, 0)
+ self.failUnlessEqual(self.discoverer.new_video_pad_cb, 1)
# fix the caps
video.set_caps(gst.Caps('video/x-raw-rgb, framerate=25/1'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]