Ejemplo n.º 1
0
 def setUp(self):
     common.TestCase.setUp(self)
     self.vsrc = common.FakeSourceFactory("videotestsrc")
     self.vsrc.addOutputStream(
         VideoStream(gst.Caps("video/x-raw-yuv"), pad_name="src"))
     self.asrc = common.FakeSourceFactory("audiotestsrc")
     self.asrc.addOutputStream(
         AudioStream(gst.Caps("audio/x-raw-float"), pad_name="src"))
     self.vsettings = StreamEncodeSettings(encoder="theoraenc")
     self.asettings = StreamEncodeSettings(encoder="vorbisenc")
Ejemplo n.º 2
0
    def testSimpleStreams(self):
        """Test a RenderSettings with exact stream settings"""
        # let's force the video to some unusual size
        outs = VideoStream(
            gst.Caps("video/x-raw-yuv,width=624,height=230,framerate=10/1"))
        fset = StreamEncodeSettings(encoder="theoraenc", input_stream=outs)
        settings = RenderSettings(settings=[fset], muxer="oggmux")
        sf = RenderSinkFactory(RenderFactory(settings=settings),
                               common.FakeSinkFactory())

        a = RenderAction()
        a.addConsumers(sf)
        a.addProducers(self.vsrc)

        p = Pipeline()
        a.setPipeline(p)

        a.activate()
        self.assertEquals(len(a._links), 1)

        p.play()
        time.sleep(3)
        p.getState()
        p.stop()
        a.deactivate()

        p.release()
Ejemplo n.º 3
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)
Ejemplo n.º 4
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")
Ejemplo n.º 5
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")
Ejemplo n.º 6
0
    def setUp(self):
        self.mainloop = gobject.MainLoop()

        samples = os.path.join(os.path.dirname(__file__), "samples")
        self.facs = []
        self.facs.append([
            PictureFileSourceFactory(
                'file://' + os.path.join(samples, "flat_colour1_640x480.png")),
            VideoStream(
                gst.Caps(
                    "video/x-raw-rgb,bpp=(int)24,depth=(int)24,endianness=(int)4321,red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255"
                ))
        ])
        self.facs.append([
            PictureFileSourceFactory(
                'file://' + os.path.join(samples, "flat_colour2_640x480.png")),
            VideoStream(
                gst.Caps(
                    "video/x-raw-rgb,bpp=(int)24,depth=(int)24,endianness=(int)4321,red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255"
                ))
        ])
        self.facs.append([
            PictureFileSourceFactory(
                'file://' + os.path.join(samples, "flat_colour3_320x180.png")),
            VideoStream(
                gst.Caps(
                    "video/x-raw-rgb,bpp=(int)24,depth=(int)24,endianness=(int)4321,red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255"
                ))
        ])
        # one video with a different resolution
        self.facs.append([
            VideoTestSourceFactory(),
            VideoStream(
                gst.Caps(
                    'video/x-raw-yuv,width=(int)640,height=(int)480,format=(fourcc)I420'
                ))
        ])

        # configure durations and add output streams to factories
        for fac in self.facs:
            factory = fac[0]
            stream = fac[1]
            factory.duration = self.clip_duration
            factory.addOutputStream(stream)
        self.track_objects = []
        self.track = Track(self.facs[0][1])
        self.timeline = Timeline()
        self.timeline.addTrack(self.track)

        vsettings = StreamEncodeSettings(encoder="theoraenc")
        rsettings = RenderSettings(settings=[vsettings], muxer="oggmux")
        self.fakesink = common.FakeSinkFactory()
        rendersink = RenderSinkFactory(RenderFactory(settings=rsettings),
                                       self.fakesink)
        self.render = RenderAction()
        self.pipeline = Pipeline()
        self.pipeline.connect("eos", self._renderEOSCb)
        self.pipeline.connect("error", self._renderErrorCb)
        self.pipeline.addAction(self.render)
        self.render.addConsumers(rendersink)
        timeline_factory = TimelineSourceFactory(self.timeline)
        self.render.addProducers(timeline_factory)
Ejemplo n.º 7
0
 def setUp(self):
     TestCase.setUp(self)
     self.audiosettings = StreamEncodeSettings(encoder="vorbisenc")
     self.videosettings = StreamEncodeSettings(encoder="theoraenc")
Ejemplo n.º 8
0
    def testSimple(self):
        set = StreamEncodeSettings(encoder="theoraenc")
        b = EncoderFactory(settings=set)

        self.assertEquals(b.settings, set)