[pitivi: 1/3] Allow importing multi-audio or multi-video clips.



commit 9c2e2f98bb66c7362111075f1274aeb2c22fbc24
Author: Alessandro Decina <alessandro d gmail com>
Date:   Thu May 21 17:52:58 2009 +0200

    Allow importing multi-audio or multi-video clips.
    
    Be less strict in mapping streams to tracks for now, adding the first stream of
    each kind to the timeline.
---
 pitivi/stream.py            |    2 +-
 pitivi/timeline/timeline.py |    5 +++--
 pitivi/ui/sourcelist.py     |    5 +++--
 tests/test_timeline.py      |    2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/pitivi/stream.py b/pitivi/stream.py
index a32d72b..6e7ef44 100644
--- a/pitivi/stream.py
+++ b/pitivi/stream.py
@@ -220,7 +220,7 @@ def find_decoder(pad):
             pad = pad.get_target()
             continue
 
-        element = pad.get_parent()
+        element = pad.get_parent_element()
         if element is None or isinstance(element, gst.Bin):
             return None
 
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f66f64a..30833b6 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -562,7 +562,7 @@ class Timeline(Signallable, Loggable):
                 track = track_object.track
                 track.removeTrackObject(track_object)
 
-    def addSourceFactory(self, factory, stream_map=None):
+    def addSourceFactory(self, factory, stream_map=None, strict=False):
         self.debug("factory:%r", factory)
         output_streams = factory.getOutputStreams()
         if not output_streams:
@@ -575,7 +575,8 @@ class Timeline(Signallable, Loggable):
                 # error out and require the caller to pass a stream_map
                 self.error("Couldn't find a complete stream mapping (self:%d < factory:%d)",
                            len(stream_map), len(output_streams))
-                raise TimelineError()
+                if strict:
+                    raise TimelineError()
 
         timeline_object = TimelineObject(factory)
         start = 0
diff --git a/pitivi/ui/sourcelist.py b/pitivi/ui/sourcelist.py
index 74fb8bd..944b3e9 100644
--- a/pitivi/ui/sourcelist.py
+++ b/pitivi/ui/sourcelist.py
@@ -35,7 +35,8 @@ from pitivi.ui.pathwalker import PathWalker
 from pitivi.ui.filelisterrordialog import FileListErrorDialog
 from pitivi.configure import get_pixmap_dir
 from pitivi.signalgroup import SignalGroup
-from pitivi.stream import VideoStream, AudioStream, TextStream
+from pitivi.stream import VideoStream, AudioStream, TextStream, \
+        MultimediaStream
 from pitivi.settings import GlobalSettings
 from pitivi.utils import beautify_length
 from pitivi.log.loggable import Loggable
@@ -114,7 +115,7 @@ def beautify_stream(stream):
     raise NotImplementedError
 
 def beautify_factory(factory):
-    ranks = {VideoStream: 0, AudioStream: 1}
+    ranks = {VideoStream: 0, AudioStream: 1, TextStream: 2, MultimediaStream: 3}
     def stream_sort_key(stream):
         return ranks[type(stream)]
 
diff --git a/tests/test_timeline.py b/tests/test_timeline.py
index 5f07385..e11510c 100644
--- a/tests/test_timeline.py
+++ b/tests/test_timeline.py
@@ -645,7 +645,7 @@ class TestTimelineAddFactory(TestCase):
         self.factory.addOutputStream(self.audio_stream2)
         self.factory.addOutputStream(self.audio_stream3)
         self.failUnlessRaises(TimelineError, self.timeline.addSourceFactory,
-                self.factory)
+                self.factory, strict=True)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 1)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 1)
         self.failUnlessEqual(len(self.video_track1.track_objects), 1)



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