Esempio n. 1
0
    def testMultiple(self):
        """Test a dual stream encoding with separates sources"""
        settings = RenderSettings(settings=[self.asettings, self.vsettings],
                                  muxer="oggmux")
        sf = RenderSinkFactory(RenderFactory(settings=settings),
                               common.FakeSinkFactory())
        a = RenderAction()
        a.addConsumers(sf)
        a.addProducers(self.vsrc, self.asrc)

        p = Pipeline()
        a.setPipeline(p)

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

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

        a.unsetPipeline()

        p.release()
Esempio 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()
Esempio n. 3
0
    def _createAction(self, sources):
        """Creates a L{RenderAction}."""
        settings = export_settings_to_render_settings(self.settings,
                                                      self.have_video,
                                                      self.have_audio)
        sf = RenderSinkFactory(RenderFactory(settings=settings),
                               URISinkFactory(uri=self.outfile))
        a = RenderAction()
        a.addProducers(*sources)
        a.addConsumers(sf)

        return a
Esempio n. 4
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)