Пример #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)
Пример #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)
Пример #3
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 = 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)
Пример #4
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)
Пример #5
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)
Пример #6
0
    def _setAllEffects(self):
        """
        go trough the list of element factories and
        add them to the correct list filtering if necessary
        """
        factlist = gst.registry_get_default().get_feature_list(
            gst.ElementFactory)
        for element_factory in factlist:
            klass = element_factory.get_klass()
            if "Effect" in klass and element_factory.get_name()\
              not in BLACKLISTED_EFFECTS:
                name = element_factory.get_name()
                effect = EffectFactory(
                    name, name, self._getEffectCategories(name),
                    self._getEffectName(element_factory),
                    self._getEffectDescripton(element_factory))
                added = self.addStreams(element_factory, effect)

                if added is True:
                    if 'Audio' in klass:
                        self.audio_effects.append(element_factory)
                    elif 'Video' in klass:
                        self.video_effects.append(element_factory)
                    self._addEffectToDic(name, effect)
Пример #7
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)
Пример #8
0
    def __init__(self, stream):
        EffectFactory.__init__(self, "identity", "identity")

        caps = gst.Caps('video/x-raw-rgb')
        self.addOutputStream(stream)
        self.addInputStream(stream)
Пример #9
0
 def __init__(self):
     EffectFactory.__init__(self, 'identity', "identity")
     self.duration = 42 * gst.SECOND
Пример #10
0
 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)
Пример #11
0
 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)
Пример #12
0
    def __init__(self, stream):
        EffectFactory.__init__(self, "identity", "identity")

        caps = gst.Caps('video/x-raw-rgb')
        self.addOutputStream(stream)
        self.addInputStream(stream)
Пример #13
0
 def __init__(self):
     EffectFactory.__init__(self, 'identity', "identity")
     self.duration = 42 * gst.SECOND