Esempio n. 1
0
    def testEncoderSettings(self):
        encsettings = {
            "bitrate": 40000,
            }
        set = StreamEncodeSettings(encoder="theoraenc",
                                   encodersettings=encsettings)
        b = EncoderFactory(settings=set)

        bin = b.makeBin()
        encoder = list(bin.elements())[0]
        for k, v in encsettings.iteritems():
            self.assertEquals(encoder.get_property(k), v)
Esempio n. 2
0
    def testMakeBin(self):
        set = StreamEncodeSettings(encoder="theoraenc")
        b = EncoderFactory(settings=set)

        bin = b.makeBin()
        self.assertEquals(bin.factory, b)

        # it should just be a bin containing theoraenc
        self.assertEquals(type(bin), gst.Bin)

        elements = list(bin.elements())
        self.assertEquals(len(elements), 1)

        elfact = elements[0].get_factory()
        self.assertEquals(elfact.get_name(), "theoraenc")
Esempio n. 3
0
    def testMakeBinFiltered(self):
        filtstream = VideoStream(caps=gst.Caps("video/x-raw-yuv,width=320,height=240"))
        set = StreamEncodeSettings(encoder="theoraenc",
                                   input_stream=filtstream)
        b = EncoderFactory(settings=set)

        bin = b.makeBin()
        self.assertEquals(bin.factory, b)

        # it should just be a bin containing the modifierbin and theoraenc
        self.assertEquals(type(bin), gst.Bin)

        elements = list(bin.elements())
        self.assertEquals(len(elements), 2)

        for elt in elements:
            if not isinstance(elt, gst.Bin):
                self.assertEquals(elt.get_factory().get_name(),
                                  "theoraenc")