[pitivi] Make a single implementation of EffectFactory instead of the AudioEffectFactory and VideoEffectFacto



commit a73a8196a43d1e400afc5e29dbc67603e579bd5f
Author: Thibault Saunier <tsaunier src gnome org>
Date:   Mon May 24 11:37:21 2010 -0400

    Make a single implementation of EffectFactory instead of the AudioEffectFactory and VideoEffectFactory

 pitivi/factories/operation.py     |   12 ---
 pitivi/timeline/timeline.py       |   12 +--
 pitivi/timeline/track.py          |    1 -
 pitivi/ui/effectlist.py           |   24 ++----
 pitivi/ui/sourcelist.py           |   12 ++--
 pitivi/ui/timeline.py             |    1 +
 tests/common.py                   |    9 +--
 tests/test_factories_operation.py |    6 +-
 tests/test_timeline.py            |  179 ++++++++++++++++++-------------------
 9 files changed, 112 insertions(+), 144 deletions(-)
---
diff --git a/pitivi/factories/operation.py b/pitivi/factories/operation.py
index 370114e..55acc0e 100644
--- a/pitivi/factories/operation.py
+++ b/pitivi/factories/operation.py
@@ -58,18 +58,6 @@ class EffectFactory (TransformFactory):
     """
     Factories that applies an effect on a stream
     """
-    pass
-
-class VideoEffectFactory (EffectFactory):
-
-    def __init__ (self, effect, name=''):
-        TransformFactory.__init__(self, name)
-        self._effect = effect
-
-    def _makeBin (self, *args):
-        return gst.element_factory_make(self._effect)
-
-class AudioEffectFactory (EffectFactory):
     def __init__ (self, effect, name=''):
         TransformFactory.__init__(self, name)
         self._effect = effect
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 1aa6b02..1985b3c 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -31,7 +31,6 @@ from pitivi.stream import match_stream_groups_map
 from pitivi.utils import start_insort_right, infinity, getPreviousObject, \
         getNextObject
 from pitivi.timeline.gap import Gap, SmallestGapsFinder, invalid_gap
-from pitivi.factories.operation import VideoEffectFactory, AudioEffectFactory
 
 # Selection modes
 SELECT = 0
@@ -1697,11 +1696,8 @@ class Timeline(Signallable, Loggable):
             raise TimelineError()
         input_stream = input_stream[0]
 
-        if isinstance (factory, VideoEffectFactory):
-          track = self._getEffectTrack(input_stream)
-        elif isinstance (factory, AudioEffectFactory):
-          track = self._getEffectTrack(input_stream)
-        else:
+        track = self._getEffectTrack(input_stream)
+        if track is None:
           raise TimelineError()
 
         timeline_object = TimelineObject(factory)
@@ -1714,9 +1710,7 @@ class Timeline(Signallable, Loggable):
         return timeline_object
 
     def _getEffectTrack(self, stream):
-        for track in self.tracks:
-            if track.stream == stream:
-                return track
+        return [track for track in self.tracks if track.stream == stream][0]
 
     def _getSourceFactoryStreamMap(self, factory):
         # track.stream -> track
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index ea4a00e..2d7c34a 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -620,7 +620,6 @@ class TrackObject(Signallable, Loggable):
         if self.gnl_object is None:
             raise TrackError()
 
-        #print "SELF.FACTORY: %s %s" % (self.factory, self.stream)
         bin = self.factory.makeBin(self.stream)
         self.gnl_object.add(bin)
         self._rebuild_interpolators = True
diff --git a/pitivi/ui/effectlist.py b/pitivi/ui/effectlist.py
index e534552..8e48648 100644
--- a/pitivi/ui/effectlist.py
+++ b/pitivi/ui/effectlist.py
@@ -31,7 +31,7 @@ from gettext import gettext as _
 from gettext import ngettext
 
 import pitivi.ui.dnd as dnd
-from pitivi.factories.operation import VideoEffectFactory, AudioEffectFactory
+from pitivi.factories.operation import EffectFactory
 
 from pitivi.settings import GlobalSettings
 from pitivi.utils import beautify_length
@@ -64,10 +64,10 @@ class EffectList(gtk.VBox, Loggable):
         self._dragX = 0
         self._dragY = 0
         self._ignoreRelease = False
-        
+
         # Store
         # icon, icon, infotext, objectfactory
-        self.storemodel = gtk.ListStore(gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, 
+        self.storemodel = gtk.ListStore(gtk.gdk.Pixbuf, gtk.gdk.Pixbuf,
                                         str, object, str, str)
 
         # Scrolled Windows
@@ -114,7 +114,7 @@ class EffectList(gtk.VBox, Loggable):
                               self._treeViewQueryTooltipCb)
         self.treeview.connect("button-release-event",
             self._treeViewButtonReleaseCb)
-        self.treeview.connect("drag_begin", 
+        self.treeview.connect("drag_begin",
                               self._dndDragBeginCb)
 
         self.pack_start(self.treeview_scrollwin)
@@ -125,7 +125,6 @@ class EffectList(gtk.VBox, Loggable):
     def _addFactories(self, effects):
         #TODO find a way to associate an icon to each effect
         thumbnail_file = os.path.join (os.getcwd(), "icons", "24x24", "pitivi.png")
-
         pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail_file)
 
         for effect in effects:
@@ -176,7 +175,7 @@ class EffectList(gtk.VBox, Loggable):
 
             self._dragStarted = False
             self._dragSelection = False
-            self._dragButton = event.button 
+            self._dragButton = event.button
             self._dragX = int(event.x)
             self._dragY = int(event.y)
 
@@ -245,9 +244,9 @@ class EffectList(gtk.VBox, Loggable):
 
     def _getEffects():
         raise NotImplementedError()
-    
+
     def _getFactoryFromEffect(self, effect):
-        raise NotImplementedError()
+        return EffectFactory(effect.get_name())
 
     def _getDndTuple(self):
         raise NotImplementedError()
@@ -259,10 +258,6 @@ class VideoEffectList (EffectList):
 
     def _getEffects(self):
         return self.app.effects.simple_video
-
-    def _getFactoryFromEffect(self, effect):
-        return VideoEffectFactory(effect.get_name())
-
     def _getDndTuple(self):
         return  [dnd.VIDEO_EFFECT_TUPLE, dnd.EFFECT_TUPLE]
 
@@ -274,10 +269,7 @@ class AudioEffectList (EffectList):
     def _getEffects(self):
         return self.app.effects.simple_audio
 
-    def _getFactoryFromEffect(self, effect):
-        return AudioEffectFactory(effect.get_name())
-
     def _getDndTuple(self):
         return  [dnd.AUDIO_EFFECT_TUPLE, dnd.EFFECT_TUPLE]
-        
+
 gobject.type_register(EffectList)
diff --git a/pitivi/ui/sourcelist.py b/pitivi/ui/sourcelist.py
index b68bd8c..24b3552 100644
--- a/pitivi/ui/sourcelist.py
+++ b/pitivi/ui/sourcelist.py
@@ -1,4 +1,4 @@
-# PiTiVi , Non-linear video editor
+## PiTiVi , Non-linear video editor
 #
 #       ui/sourcelist.py
 #
@@ -93,7 +93,7 @@ ui = '''
 </ui>
 '''
 
-INVISIBLE = gtk.gdk.pixbuf_new_from_file(os.path.join(get_pixmap_dir(), 
+INVISIBLE = gtk.gdk.pixbuf_new_from_file(os.path.join(get_pixmap_dir(),
     "invisible.png"))
 
 class SourceList(gtk.VBox, Loggable):
@@ -271,7 +271,7 @@ class SourceList(gtk.VBox, Loggable):
                 _("Import folder of clips to use"), self._importSourcesFolderCb),
         )
 
-        # only available when selection is non-empty 
+        # only available when selection is non-empty
         selection_actions = (
             ("RemoveSources", gtk.STOCK_DELETE,
                 _("_Remove from project"), "<Control>Delete", None,
@@ -387,7 +387,7 @@ class SourceList(gtk.VBox, Loggable):
 
 
     ## Explanatory message methods
-    
+
     def _setClipView(self, show):
         """ Set which clip view to use when sourcelist is showing clips. If
         none is given, the current one is used. Show: one of SHOW_TREEVIEW or
@@ -736,7 +736,7 @@ class SourceList(gtk.VBox, Loggable):
 
             self._dragStarted = False
             self._dragSelection = False
-            self._dragButton = event.button 
+            self._dragButton = event.button
             self._dragX = int(event.x)
             self._dragY = int(event.y)
 
@@ -926,7 +926,7 @@ class SourceList(gtk.VBox, Loggable):
         return paths
 
     def getSelectedItems(self):
-        return [self.storemodel[path][COL_URI] 
+        return [self.storemodel[path][COL_URI]
             for path in self.getSelectedPaths()]
 
     def _dndDataGetCb(self, unused_widget, context, selection,
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 8b0890b..19e23e0 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -407,6 +407,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
         self.warning("self._factories:%r, self._temp_objects:%r",
                      not not self._factories,
                      not not self._temp_objects)
+        print "DRAG_MOTION"
         if self._factories is None:
             atom = gtk.gdk.atom_intern(dnd.FILESOURCE_TUPLE[0])
             self.drag_get_data(context, atom, timestamp)
diff --git a/tests/common.py b/tests/common.py
index 388c6d7..b311725 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -9,7 +9,7 @@ import os
 import gc
 import unittest
 from pitivi.factories.base import ObjectFactory, SourceFactory, SinkFactory
-from pitivi.factories.operation import VideoEffectFactory, AudioEffectFactory
+from pitivi.factories.operation import EffectFactory
 from pitivi.pipeline import Pipeline
 
 detect_leaks = os.environ.get("PITIVI_TEST_DETECT_LEAKS", "1") not in ("0", "")
@@ -163,10 +163,7 @@ class StubFactory(SourceFactory):
     def _releaseBin(self, bin):
         pass
 
-class FakeVideoEffectFactory(VideoEffectFactory):
+class FakeEffectFactory(EffectFactory):
     def __init__(self):
-        VideoEffectFactory.__init__(self, 'identity', "identity")
+        EffectFactory.__init__(self, 'identity', "identity")
 
-class FakeAudioEffectFactory(AudioEffectFactory):
-    def __init__(self):
-        AudioEffectFactory.__init__(self, 'identity', "identity")
diff --git a/tests/test_factories_operation.py b/tests/test_factories_operation.py
index a7a5a95..46ea2bc 100644
--- a/tests/test_factories_operation.py
+++ b/tests/test_factories_operation.py
@@ -29,19 +29,19 @@ import gst
 from common import TestCase
 
 from pitivi.log.log import debug
-from pitivi.factories.operation import VideoEffectFactory
+from pitivi.factories.operation import EffectFactory
 
 class TestVideoEffectFactory(TestCase):
     def setUp(self):
         TestCase.setUp(self)
-        self.factory = VideoEffectFactory ('identity', 'identity')
+        self.factory = EffectFactory ('identity', 'identity')
 
     def testMakeBin (self):
         bin = self.factory.makeBin()
         bin2 = self.factory.makeBin()
         self.failUnless(isinstance(bin, gst.BaseTransform))
         self.failUnless(bin.get_factory().get_name() == "identity" )
-        debug ('TestVideoEffectFactory','%s %s','Bin is:', bin.get_factory().get_name())
+        debug ('TestOperationFactory','%s %s','Bin is:', bin.get_factory().get_name())
         self.factory.releaseBin(bin)
         self.factory.releaseBin(bin2)
 
diff --git a/tests/test_timeline.py b/tests/test_timeline.py
index b8e0aa1..3c569e9 100644
--- a/tests/test_timeline.py
+++ b/tests/test_timeline.py
@@ -23,8 +23,7 @@ import pygst
 pygst.require("0.10")
 import gst
 
-from tests.common import FakeSourceFactory, FakeVideoEffectFactory,\
-     FakeAudioEffectFactory
+from tests.common import FakeSourceFactory, FakeEffectFactory
 from pitivi.timeline.timeline import Timeline, TimelineObject, TimelineError, \
         Selection, Link, TimelineEdges, MoveContext, TrimStartContext, \
         TrimEndContext
@@ -42,15 +41,15 @@ class TimelineSignalMonitor(SignalMonitor):
 
 class TestTimelineObjectAddRemoveTrackObjects(TestCase):
     def testAddRemoveTrackObjects(self):
-        factory = StubFactory()
-        timeline_object1 = TimelineObject(factory)
-        timeline_object2 = TimelineObject(factory)
+        source_factory = StubFactory()
+        timeline_object1 = TimelineObject(source_factory)
+        timeline_object2 = TimelineObject(source_factory)
 
         stream = AudioStream(gst.Caps('audio/x-raw-int'))
-        factory.addOutputStream(stream)
+        source_factory.addOutputStream(stream)
         track = Track(stream)
-        track_object1 = SourceTrackObject(factory, stream)
-        track_object2 = SourceTrackObject(factory, stream)
+        track_object1 = SourceTrackObject(source_factory, stream)
+        track_object2 = SourceTrackObject(source_factory, stream)
 
         track.addTrackObject(track_object1)
         timeline_object1.addTrackObject(track_object1)
@@ -77,16 +76,16 @@ class TestTimelineObjectAddRemoveTrackObjects(TestCase):
 class TestTimelineObjectProperties(TestCase):
     def setUp(self):
         TestCase.setUp(self)
-        factory = StubFactory()
-        self.timeline_object = TimelineObject(factory)
+        source_factory = StubFactory()
+        self.timeline_object = TimelineObject(source_factory)
         self.monitor = SignalMonitor(self.timeline_object, 'start-changed',
                 'duration-changed', 'in-point-changed', 'out-point-changed',
                 'media-duration-changed', 'priority-changed')
         stream = AudioStream(gst.Caps('audio/x-raw-int'))
-        factory.addOutputStream(stream)
+        source_factory.addOutputStream(stream)
         self.track = Track(stream)
-        self.track_object1 = SourceTrackObject(factory, stream)
-        self.track_object2 = SourceTrackObject(factory, stream)
+        self.track_object1 = SourceTrackObject(source_factory, stream)
+        self.track_object2 = SourceTrackObject(source_factory, stream)
         self.track.addTrackObject(self.track_object1)
         self.track.addTrackObject(self.track_object2)
 
@@ -284,19 +283,19 @@ class TestTimelineAddRemoveTracks(TestCase):
 
 class TestTimelineAddRemoveTimelineObjects(TestCase):
     def testAddRemoveTimelineObjects(self):
-        factory = StubFactory()
+        source_factory = StubFactory()
         stream = AudioStream(gst.Caps('audio/x-raw-int'))
-        factory.addOutputStream(stream)
+        source_factory.addOutputStream(stream)
         timeline = Timeline()
         track = Track(stream)
 
-        track_object1 = SourceTrackObject(factory, stream)
-        track_object2 = SourceTrackObject(factory, stream)
+        track_object1 = SourceTrackObject(source_factory, stream)
+        track_object2 = SourceTrackObject(source_factory, stream)
         track.addTrackObject(track_object1)
         track.addTrackObject(track_object2)
 
-        timeline_object1 = TimelineObject(factory)
-        timeline_object2 = TimelineObject(factory)
+        timeline_object1 = TimelineObject(source_factory)
+        timeline_object2 = TimelineObject(source_factory)
 
         self.failUnlessRaises(TimelineError,
                 timeline.addTimelineObject, timeline_object1)
@@ -317,21 +316,21 @@ class TestTimelineAddRemoveTimelineObjects(TestCase):
         timeline.removeTimelineObject(timeline_object2)
 
     def testRemoveFactory(self):
-        factory = StubFactory()
+        source_factory = StubFactory()
         stream = AudioStream(gst.Caps("audio/x-raw-int"))
-        factory.addOutputStream(stream)
+        source_factory.addOutputStream(stream)
         track = Track(stream)
-        track_object1 = SourceTrackObject(factory, stream)
+        track_object1 = SourceTrackObject(source_factory, stream)
         track.addTrackObject(track_object1)
-        track_object2 = SourceTrackObject(factory, stream)
+        track_object2 = SourceTrackObject(source_factory, stream)
         track.addTrackObject(track_object2)
-        track_object3 = SourceTrackObject(factory, stream)
+        track_object3 = SourceTrackObject(source_factory, stream)
         track.addTrackObject(track_object3)
-        timeline_object1 = TimelineObject(factory)
+        timeline_object1 = TimelineObject(source_factory)
         timeline_object1.addTrackObject(track_object1)
-        timeline_object2 = TimelineObject(factory)
+        timeline_object2 = TimelineObject(source_factory)
         timeline_object2.addTrackObject(track_object2)
-        timeline_object3 = TimelineObject(factory)
+        timeline_object3 = TimelineObject(source_factory)
         timeline_object3.addTrackObject(track_object3)
         timeline = Timeline()
         timeline.addTrack(track)
@@ -340,28 +339,28 @@ class TestTimelineAddRemoveTimelineObjects(TestCase):
         timeline.addTimelineObject(timeline_object3)
 
         self.failUnlessEqual(len(timeline.timeline_objects), 3)
-        timeline.removeFactory(factory)
+        timeline.removeFactory(source_factory)
         self.failUnlessEqual(len(timeline.timeline_objects), 0)
 
 class TestTimeline(TestCase):
     def setUp(self):
-        self.factory = StubFactory()
+        self.source_factory = StubFactory()
         self.stream = AudioStream(gst.Caps('audio/x-raw-int'))
-        self.factory.addOutputStream(self.stream)
+        self.source_factory.addOutputStream(self.stream)
         self.track1 = Track(self.stream)
         self.timeline = Timeline()
         TestCase.setUp(self)
 
     def tearDown(self):
-        del self.factory
+        del self.source_factory
         del self.stream
         del self.track1
         del self.timeline
 
     def makeTimelineObject(self):
-        track_object = SourceTrackObject(self.factory, self.stream)
+        track_object = SourceTrackObject(self.source_factory, self.stream)
         self.track1.addTrackObject(track_object)
-        timeline_object = TimelineObject(self.factory)
+        timeline_object = TimelineObject(self.source_factory)
         timeline_object.addTrackObject(track_object)
         self.timeline.addTimelineObject(timeline_object)
 
@@ -724,10 +723,10 @@ class TestLink(TestCase):
         pass
 
     def testAddRemoveTimelineObjects(self):
-        factory = StubFactory()
-        factory.addOutputStream(VideoStream(gst.Caps("video/x-raw-yuv")))
-        timeline_object1 = TimelineObject(factory)
-        timeline_object2 = TimelineObject(factory)
+        source_factory = StubFactory()
+        source_factory.addOutputStream(VideoStream(gst.Caps("video/x-raw-yuv")))
+        timeline_object1 = TimelineObject(source_factory)
+        timeline_object2 = TimelineObject(source_factory)
 
         link = Link()
         link.addTimelineObject(timeline_object1)
@@ -744,22 +743,22 @@ class TestLink(TestCase):
 
     def setUp(self):
         TestCase.setUp(self)
-        self.factory = StubFactory()
+        self.source_factory = StubFactory()
         self.stream = AudioStream(gst.Caps('audio/x-raw-int'))
-        self.factory.addOutputStream(self.stream)
+        self.source_factory.addOutputStream(self.stream)
         self.track1 = Track(self.stream)
         self.track2 = Track(self.stream)
-        self.track_object1 = SourceTrackObject(self.factory, self.stream)
-        self.track_object2 = SourceTrackObject(self.factory, self.stream)
-        self.track_object3 = SourceTrackObject(self.factory, self.stream)
+        self.track_object1 = SourceTrackObject(self.source_factory, self.stream)
+        self.track_object2 = SourceTrackObject(self.source_factory, self.stream)
+        self.track_object3 = SourceTrackObject(self.source_factory, self.stream)
         self.track1.addTrackObject(self.track_object1)
         self.track1.addTrackObject(self.track_object2)
         self.track2.addTrackObject(self.track_object3)
-        self.timeline_object1 = TimelineObject(self.factory)
+        self.timeline_object1 = TimelineObject(self.source_factory)
         self.timeline_object1.addTrackObject(self.track_object1)
-        self.timeline_object2 = TimelineObject(self.factory)
+        self.timeline_object2 = TimelineObject(self.source_factory)
         self.timeline_object2.addTrackObject(self.track_object2)
-        self.timeline_object3 = TimelineObject(self.factory)
+        self.timeline_object3 = TimelineObject(self.source_factory)
         self.timeline_object3.addTrackObject(self.track_object3)
 
     def tearDown(self):
@@ -778,7 +777,7 @@ class TestLink(TestCase):
         del self.track1
         del self.track2
         del self.stream
-        del self.factory
+        del self.source_factory
         TestCase.tearDown(self)
 
     def testLinkAttribute(self):
@@ -834,7 +833,7 @@ class TestLink(TestCase):
         self.failUnlessEqual(timeline_object3.link, link3)
 
     def testChangeStart(self):
-        factory = self.factory
+        source_factory = self.source_factory
         stream = self.stream
         track1 = self.track1
         track2 = self.track2
@@ -984,10 +983,10 @@ class TestTimelineEdges(TestCase):
         self.failUnlessEqual(self.timeline_edges.snapToEdge(3000), (2000, 1000))
 
     def testAdjacenctObjs(self):
-        factory = FakeSourceFactory()
+        source_factory = FakeSourceFactory()
         stream = AudioStream(gst.Caps("meh"))
-        track_object1 = SourceTrackObject(factory, stream)
-        track_object2 = SourceTrackObject(factory, stream)
+        track_object1 = SourceTrackObject(source_factory, stream)
+        track_object2 = SourceTrackObject(source_factory, stream)
         track_object1.start = 500 
         track_object1.duration = 500
         track_object2.start = 1000
@@ -1010,7 +1009,7 @@ class TestTimelineEdges(TestCase):
 
         track_object1.release()
         track_object2.release()
-        del factory
+        del source_factory
 
 class TestTimelineAddFactory(TestCase):
     def setUp(self):
@@ -1030,9 +1029,8 @@ class TestTimelineAddFactory(TestCase):
         self.timeline.addTrack(self.video_track1)
         self.timeline.addTrack(self.video_track2)
 
-        self.factory = StubFactory()
-        self.video_effect_factory = FakeVideoEffectFactory()
-        self.audio_effect_factory = FakeAudioEffectFactory()
+        self.source_factory = StubFactory()
+        self.effect_factory = FakeEffectFactory()
 
     def tearDown(self):
         del self.audio_stream1
@@ -1045,56 +1043,55 @@ class TestTimelineAddFactory(TestCase):
         del self.video_track1
         del self.video_track2
         del self.timeline
-        del self.factory
-        del self.video_effect_factory
-        del self.audio_effect_factory
+        del self.source_factory
+        del self.effect_factory
         TestCase.tearDown(self)
 
     def testNoStreams(self):
-        self.failUnlessRaises(TimelineError, self.timeline.addSourceFactory, self.factory)
+        self.failUnlessRaises(TimelineError, self.timeline.addSourceFactory, self.source_factory)
 
     def testAudioOnly(self):
-        self.factory.addOutputStream(self.audio_stream1)
-        self.timeline.addSourceFactory(self.factory)
+        self.source_factory.addOutputStream(self.audio_stream1)
+        self.timeline.addSourceFactory(self.source_factory)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 1)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 0)
         self.failUnlessEqual(len(self.video_track1.track_objects), 0)
         self.failUnlessEqual(len(self.video_track2.track_objects), 0)
 
     def testVideoOnly(self):
-        self.factory.addOutputStream(self.video_stream1)
-        self.timeline.addSourceFactory(self.factory)
+        self.source_factory.addOutputStream(self.video_stream1)
+        self.timeline.addSourceFactory(self.source_factory)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 0)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 0)
         self.failUnlessEqual(len(self.video_track1.track_objects), 1)
         self.failUnlessEqual(len(self.video_track2.track_objects), 0)
 
     def testVideoStreamVideoEffect(self):
-        self.factory.addOutputStream(self.video_stream1)
-        self.timeline.addSourceFactory(self.factory)
-        self.video_effect_factory.addInputStream(self.video_stream1)
-        self.video_effect_factory.addOutputStream(self.video_stream2)
-        self.timeline.addEffectFactory(self.video_effect_factory)
+        self.source_factory.addOutputStream(self.video_stream1)
+        self.timeline.addSourceFactory(self.source_factory)
+        self.effect_factory.addInputStream(self.video_stream1)
+        self.effect_factory.addOutputStream(self.video_stream2)
+        self.timeline.addEffectFactory(self.effect_factory)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 0)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 0)
         self.failUnlessEqual(len(self.video_track1.track_objects), 2)
         self.failUnlessEqual(len(self.video_track2.track_objects), 0)
 
     def testAudioStreamAudioEffect(self):
-        self.factory.addOutputStream(self.audio_stream1)
-        self.timeline.addSourceFactory(self.factory)
-        self.audio_effect_factory.addInputStream(self.audio_stream1)
-        self.audio_effect_factory.addOutputStream(self.audio_stream2)
-        self.timeline.addEffectFactory(self.audio_effect_factory)
+        self.source_factory.addOutputStream(self.audio_stream1)
+        self.timeline.addSourceFactory(self.source_factory)
+        self.effect_factory.addInputStream(self.audio_stream1)
+        self.effect_factory.addOutputStream(self.audio_stream2)
+        self.timeline.addEffectFactory(self.effect_factory)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 2)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 0)
         self.failUnlessEqual(len(self.video_track1.track_objects), 0)
         self.failUnlessEqual(len(self.video_track2.track_objects), 0)
 
     def test1Audio1Video(self):
-        self.factory.addOutputStream(self.audio_stream1)
-        self.factory.addOutputStream(self.video_stream1)
-        self.timeline.addSourceFactory(self.factory)
+        self.source_factory.addOutputStream(self.audio_stream1)
+        self.source_factory.addOutputStream(self.video_stream1)
+        self.timeline.addSourceFactory(self.source_factory)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 1)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 0)
         self.failUnlessEqual(len(self.video_track1.track_objects), 1)
@@ -1102,11 +1099,11 @@ class TestTimelineAddFactory(TestCase):
 
     def testConflictNotEnoughTracks(self):
         # 3 audio streams, only 2 audio tracks in the timeline
-        self.factory.addOutputStream(self.audio_stream1)
-        self.factory.addOutputStream(self.audio_stream2)
-        self.factory.addOutputStream(self.audio_stream3)
+        self.source_factory.addOutputStream(self.audio_stream1)
+        self.source_factory.addOutputStream(self.audio_stream2)
+        self.source_factory.addOutputStream(self.audio_stream3)
         self.failUnlessRaises(TimelineError, self.timeline.addSourceFactory,
-                self.factory, strict=True)
+                self.source_factory, strict=True)
         self.failUnlessEqual(len(self.audio_track1.track_objects), 0)
         self.failUnlessEqual(len(self.audio_track2.track_objects), 0)
         self.failUnlessEqual(len(self.video_track1.track_objects), 0)
@@ -1117,22 +1114,22 @@ class TestContexts(TestCase):
     def setUp(self):
         TestCase.setUp(self)
         self.timeline = Timeline()
-        self.factory = StubFactory()
+        self.source_factory = StubFactory()
         self.stream = AudioStream(gst.Caps('audio/x-raw-int'))
-        self.factory.addOutputStream(self.stream)
+        self.source_factory.addOutputStream(self.stream)
         self.track1 = Track(self.stream)
         self.track2 = Track(self.stream)
-        self.track_object1 = SourceTrackObject(self.factory, self.stream)
-        self.track_object2 = SourceTrackObject(self.factory, self.stream)
-        self.track_object3 = SourceTrackObject(self.factory, self.stream)
+        self.track_object1 = SourceTrackObject(self.source_factory, self.stream)
+        self.track_object2 = SourceTrackObject(self.source_factory, self.stream)
+        self.track_object3 = SourceTrackObject(self.source_factory, self.stream)
         self.track1.addTrackObject(self.track_object1)
         self.track1.addTrackObject(self.track_object2)
         self.track2.addTrackObject(self.track_object3)
-        self.timeline_object1 = TimelineObject(self.factory)
+        self.timeline_object1 = TimelineObject(self.source_factory)
         self.timeline_object1.addTrackObject(self.track_object1)
-        self.timeline_object2 = TimelineObject(self.factory)
+        self.timeline_object2 = TimelineObject(self.source_factory)
         self.timeline_object2.addTrackObject(self.track_object2)
-        self.timeline_object3 = TimelineObject(self.factory)
+        self.timeline_object3 = TimelineObject(self.source_factory)
         self.timeline_object3.addTrackObject(self.track_object3)
         self.timeline.addTimelineObject(self.timeline_object1)
         self.timeline.addTimelineObject(self.timeline_object2)
@@ -1205,7 +1202,7 @@ class TestContexts(TestCase):
         self.failUnlessEqual(self.track_object2.duration,  10 * gst.SECOND)
         self.failUnlessEqual(self.track_object3.start, 1 * gst.SECOND)
         self.failUnlessEqual(self.track_object3.duration,  10 * gst.SECOND)
-        
+
         # move to
         # track1:     [focus][t2]
         # track2:             [t3 ]
@@ -1424,9 +1421,9 @@ class TestContexts(TestCase):
         self.failUnlessEqual(self.track_object3.priority, 1)
 
     def testMoveContextMarginsZigZag(self):
-        self.track_object4 = SourceTrackObject(self.factory, self.stream)
+        self.track_object4 = SourceTrackObject(self.source_factory, self.stream)
         self.track1.addTrackObject(self.track_object4)
-        self.timeline_object4 = TimelineObject(self.factory)
+        self.timeline_object4 = TimelineObject(self.source_factory)
         self.timeline_object4.addTrackObject(self.track_object4)
         self.timeline.addTimelineObject(self.timeline_object4)
 
@@ -1803,7 +1800,7 @@ class TestContexts(TestCase):
         del self.track_object3
         del self.track1
         del self.track2
-        del self.factory
+        del self.source_factory
         del self.stream
         del self.timeline
         del self.other



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