Example #1
0
    def testLoadTrackEffect(self):
        # create fake document tree
        element = Element("track-object",\
                type="pitivi.timeline.track.TrackEffect",
                start=ts(1 * gst.SECOND), duration=ts(10 * gst.SECOND),
                in_point=ts(5 * gst.SECOND),
                media_duration=ts(15 * gst.SECOND), priority=ts(5), id="1")
        effect_elem = SubElement(element, "effect")
        factory_elem = SubElement(effect_elem, "factory", name="identity")
        properties_elem = SubElement(effect_elem, "gst-element-properties", sync="(bool)True")

        # insert our fake factory into the context
        stream = AudioStream(gst.Caps("audio/x-raw-int"))
        factory = EffectFactory('identity')
        factory.addInputStream(stream)
        factory.addOutputStream(stream)
        self.formatter.avalaible_effects._effect_factories_dict['identity'] = factory

        track = Track(stream)
        track_object = self.formatter._loadTrackObject(track, element)
        self.failUnless(isinstance(track_object, TrackEffect))
        self.failUnlessEqual(track_object.factory, factory)
        self.failUnlessEqual(track_object.stream, stream)

        self.failUnlessEqual(track_object.start, 1 * gst.SECOND)
        self.failUnlessEqual(track_object.duration, 10 * gst.SECOND)
        self.failUnlessEqual(track_object.in_point, 5 * gst.SECOND)
        self.failUnlessEqual(track_object.media_duration, 15 * gst.SECOND)
        self.failUnlessEqual(track_object.priority, 5)
Example #2
0
    def testSaveTrackEffect(self):
        video_stream = VideoStream(gst.Caps("video/x-raw-yuv"))
        audio_stream = AudioStream(gst.Caps("audio/x-raw-int"))

        effect1 = EffectFactory('identity', 'identity')
        effect1.addOutputStream(video_stream)
        effect1.addInputStream(video_stream)

        #It is necessary to had the identity factory to the
        #effect_factories_dictionnary
        self.formatter.avalaible_effects._effect_factories_dict['identity'] =\
                                                                     effect1
        track_effect = TrackEffect(effect1, video_stream,
                start=10 * gst.SECOND, duration=20 * gst.SECOND,
                in_point=5 * gst.SECOND, media_duration=15 * gst.SECOND,
                priority=10)

        track = Track(video_stream)
        track.addTrackObject(track_effect)

        element = self.formatter._saveTrackObject(track_effect)
        self.failUnlessEqual(element.tag, "track-object")
        self.failUnlessEqual(element.attrib["type"],
                qual(track_effect.__class__))
        self.failUnlessEqual(element.attrib["start"], ts(10 * gst.SECOND))
        self.failUnlessEqual(element.attrib["duration"], ts(20 * gst.SECOND))
        self.failUnlessEqual(element.attrib["in_point"], ts(5 * gst.SECOND))
        self.failUnlessEqual(element.attrib["media_duration"],
                ts(15 * gst.SECOND))
        self.failUnlessEqual(element.attrib["priority"], "(int)10")

        effect_element = element.find('effect')
        self.failIfEqual(effect_element, None)
        self.failIfEqual(effect_element.find("factory"), None)
        self.failIfEqual(effect_element.find("gst-element-properties"), None)
Example #3
0
    def testLoadTrackEffect(self):
        # create fake document tree
        element = Element("track-object",\
                type="pitivi.timeline.track.TrackEffect",
                start=ts(1 * gst.SECOND), duration=ts(10 * gst.SECOND),
                in_point=ts(5 * gst.SECOND),
                media_duration=ts(15 * gst.SECOND), priority=ts(5), id="1")
        effect_elem = SubElement(element, "effect")
        factory_elem = SubElement(effect_elem, "factory", name="identity")
        properties_elem = SubElement(effect_elem,
                                     "gst-element-properties",
                                     sync="(bool)True")

        # insert our fake factory into the context
        stream = AudioStream(gst.Caps("audio/x-raw-int"))
        factory = EffectFactory('identity')
        factory.addInputStream(stream)
        factory.addOutputStream(stream)
        self.formatter.avalaible_effects._effect_factories_dict[
            'identity'] = factory

        track = Track(stream)
        track_object = self.formatter._loadTrackObject(track, element)
        self.failUnless(isinstance(track_object, TrackEffect))
        self.failUnlessEqual(track_object.factory, factory)
        self.failUnlessEqual(track_object.stream, stream)

        self.failUnlessEqual(track_object.start, 1 * gst.SECOND)
        self.failUnlessEqual(track_object.duration, 10 * gst.SECOND)
        self.failUnlessEqual(track_object.in_point, 5 * gst.SECOND)
        self.failUnlessEqual(track_object.media_duration, 15 * gst.SECOND)
        self.failUnlessEqual(track_object.priority, 5)
class TestEffectFactory(TestCase):
    def setUp(self):
        TestCase.setUp(self)
        self.stream = VideoStream(gst.Caps("video/x-raw-rgb"))
        self.factory = EffectFactory('identity', 'identity')
        self.factory.addOutputStream(self.stream)
        self.factory.addInputStream(self.stream)

    def testMakeBin(self):
        bin = self.factory.makeBin()
        bin2 = self.factory.makeBin()
        csp = bin.elements().next()
        self.failUnless(isinstance(bin, gst.Bin))
        self.failUnless(csp)
        self.factory.releaseBin(bin)
        self.factory.releaseBin(bin2)

    def tearDown(self):
        del self.factory
        TestCase.tearDown(self)
Example #5
0
class TestEffectFactory(TestCase):
    def setUp(self):
        TestCase.setUp(self)
        self.stream = VideoStream(gst.Caps("video/x-raw-rgb"))
        self.factory = EffectFactory ('identity', 'identity')
        self.factory.addOutputStream(self.stream)
        self.factory.addInputStream(self.stream)

    def testMakeBin (self):
        bin, fx = self.factory.makeBin()
        bin2, fx = self.factory.makeBin()
        csp = bin.elements().next()
        self.failUnless(isinstance(bin, gst.Bin))
        self.failUnless(csp)
        self.factory.releaseBin(bin)
        self.factory.releaseBin(bin2)

    def tearDown(self):
        del self.factory
        TestCase.tearDown(self)
Example #6
0
    def testSaveTrackEffect(self):
        video_stream = VideoStream(gst.Caps("video/x-raw-yuv"))
        audio_stream = AudioStream(gst.Caps("audio/x-raw-int"))

        effect1 = EffectFactory('identity', 'identity')
        effect1.addOutputStream(video_stream)
        effect1.addInputStream(video_stream)

        #It is necessary to had the identity factory to the
        #effect_factories_dictionnary
        self.formatter.avalaible_effects._effect_factories_dict['identity'] =\
                                                                     effect1
        track_effect = TrackEffect(effect1,
                                   video_stream,
                                   start=10 * gst.SECOND,
                                   duration=20 * gst.SECOND,
                                   in_point=5 * gst.SECOND,
                                   media_duration=15 * gst.SECOND,
                                   priority=10)

        track = Track(video_stream)
        track.addTrackObject(track_effect)

        element = self.formatter._saveTrackObject(track_effect)
        self.failUnlessEqual(element.tag, "track-object")
        self.failUnlessEqual(element.attrib["type"],
                             qual(track_effect.__class__))
        self.failUnlessEqual(element.attrib["start"], ts(10 * gst.SECOND))
        self.failUnlessEqual(element.attrib["duration"], ts(20 * gst.SECOND))
        self.failUnlessEqual(element.attrib["in_point"], ts(5 * gst.SECOND))
        self.failUnlessEqual(element.attrib["media_duration"],
                             ts(15 * gst.SECOND))
        self.failUnlessEqual(element.attrib["priority"], "(int)10")

        effect_element = element.find('effect')
        self.failIfEqual(effect_element, None)
        self.failIfEqual(effect_element.find("factory"), None)
        self.failIfEqual(effect_element.find("gst-element-properties"), None)