Ejemplo n.º 1
0
    def testSetupFailGstLinking(self):
        p2 = pipeline_src("fakesink")  # this just can't work!
        c2 = pipeline_cnv("fakesink")  # and neither can this!

        # we're going to fail in gst - make sure the gst logger is silent
        import gst

        old_debug_level = gst.debug_get_default_threshold()
        gst.debug_set_default_threshold(gst.LEVEL_NONE)

        self.p.set_flow([p2, c2, self.cnv1])
        d = self.p.start_flow()

        if old_debug_level != gst.LEVEL_NONE:

            def _restore_gst_debug_level(rf):
                gst.debug_set_default_threshold(old_debug_level)
                return rf

            d.addBoth(_restore_gst_debug_level)
        # Because component setup errors get swallowed in
        # BaseComponent.setup() we won't get the exact error that will
        # be thrown, i.e. PipelineParseError. Instead, the component
        # will turn sad and we will get a ComponentSad failure from
        # the ComponentWrapper.
        return self.failUnlessFailure(d, ComponentSad)
Ejemplo n.º 2
0
    def setUp(self):
        self.prod = pipeline_src()
        self.cnv1 = pipeline_cnv()
        self.cnv2 = pipeline_cnv()
        self.components = [self.prod, self.cnv1, self.cnv2]

        self.p = ComponentTestHelper()
Ejemplo n.º 3
0
    def setUp(self):
        self.tp = comptest.ComponentTestHelper()
        prod = ('audiotestsrc wave=silence ! ffenc_mp2 name=encoder')
        self.s =\
            'flumotion.component.consumers.httpserver.httpserver.ICYStreamer'

        self.prod = comptest.pipeline_src(prod)
Ejemplo n.º 4
0
    def setUp(self):
        self.tp = comptest.ComponentTestHelper()
        prod = ('videotestsrc is-live=true ! '
                'video/x-raw-rgb,framerate=(fraction)1/2,width=320,height=240')
        self.s = 'flumotion.component.consumers.disker.disker_plug.DiskerPlug'

        self.prod = comptest.pipeline_src(prod)
Ejemplo n.º 5
0
    def testRunProvidesClocking(self):
        p2_pp = ('videotestsrc is-live=true ! '
                 'video/x-raw-rgb,framerate=(fraction)8/1,'
                 'width=32,height=24')
        p2 = pipeline_src(p2_pp)

        from flumotion.component.muxers.multipart import Multipart
        mux = ComponentWrapper('multipart-muxer', Multipart, name='mux')

        self.prod.feed(mux)
        p2.feed(mux)
        mux.feed(self.cnv1)

        self.clock_slave = p2

        def check_clocking(_):
            self.warning('check_clocking: %s %r' %
                         (self.clock_slave.name,
                          self.clock_slave.comp.pipeline.get_clock()))
            import gst
            pp = self.clock_slave.comp.pipeline
            # is there a better way to check if that component is
            # using an external clock source?
            self.failUnless(isinstance(pp.get_clock(), gst.NetClientClock),
                            "Didn't receive external clocking info.")
            return _
        task_d = defer.Deferred()
        task_d.addCallback(check_clocking)

        self.p.set_flow([self.prod, p2, mux, self.cnv1], auto_link=False)
        if self.prod is not self.p._master:
            # p2 (of [self.prod, p2]) seems to be the master this time
            self.clock_slave = self.prod
        d = self.p.run_flow(self.duration, tasks=[task_d])
        return d
Ejemplo n.º 6
0
    def testMasterClock(self):
        p2 = pipeline_src()
        self.components.append(p2)

        p2.feed(self.cnv1)
        self.prod.feed(self.cnv1)
        self.cnv1.feed(self.cnv2)

        self.p.set_flow([self.prod, p2, self.cnv1, self.cnv2], auto_link=False)

        # both prod and p2 require a clock, only one should provide it
        self.assertEquals(self.prod.cfg['clock-master'],
                          p2.cfg['clock-master'])
        self.assertEquals(self.cnv1.cfg['clock-master'], None)
        self.assertEquals(self.cnv2.cfg['clock-master'], None)

        master = self.prod
        slave = p2
        if master.cfg['clock-master'] != master.cfg['avatarId']:
            slave, master = master, slave

        # the master-clock component should provide a clock, and not
        # require an external clock source, as opposed the the slave
        self.assertEquals(master.sync, None)
        self.failIfEquals(slave.sync, None)
Ejemplo n.º 7
0
    def setUp(self):
        self.tp = comptest.ComponentTestHelper()
        prod = ('videotestsrc is-live=true ! '
                'video/x-raw-rgb,framerate=(fraction)1/2,width=320,height=240')
        self.s = 'flumotion.component.consumers.disker.disker_plug.DiskerPlug'

        self.prod = comptest.pipeline_src(prod)
    def setUp(self):
        self.tp = comptest.ComponentTestHelper()
        prod = ('audiotestsrc wave=silence ! ffenc_mp2 name=encoder')
        self.s =\
            'flumotion.component.consumers.httpserver.httpserver.ICYStreamer'

        self.prod = comptest.pipeline_src(prod)
    def setUp(self):
        self.tp = comptest.ComponentTestHelper()
        prod = ('videotestsrc is-live=true ! '
                'video/x-raw-rgb,framerate=(fraction)1/2,width=320,height=240,'
                'pixel-aspect-ratio=1/2,interlaced=true')
        self.s = 'flumotion.component.converters.video.video.Converter'

        self.prod = comptest.pipeline_src(prod)
Ejemplo n.º 10
0
    def setUp(self):
        self.tp = comptest.ComponentTestHelper()
        prod = ('videotestsrc is-live=true ! '
                'video/x-raw-rgb,framerate=(fraction)1/2,width=320,height=240,'
                'pixel-aspect-ratio=1/2,interlaced=true')
        self.s = 'flumotion.component.converters.video.video.Converter'

        self.prod = comptest.pipeline_src(prod)
Ejemplo n.º 11
0
    def setUp(self):
        self.duration = 2.0

        prod_pp = "videotestsrc is-live=true ! " "video/x-raw-rgb,framerate=(fraction)8/1," "width=32,height=24"
        self.prod = pipeline_src(prod_pp)

        self.cnv1 = pipeline_cnv()
        self.cnv2 = pipeline_cnv()

        self.p = ComponentTestHelper()
Ejemplo n.º 12
0
    def setUp(self):
        self.duration = 2.0

        prod_pp = ('videotestsrc is-live=true ! '
                   'video/x-raw-rgb,framerate=(fraction)8/1,'
                   'width=32,height=24')
        self.prod = pipeline_src(prod_pp)

        self.cnv1 = pipeline_cnv()
        self.cnv2 = pipeline_cnv()

        self.p = ComponentTestHelper()
    def setUp(self):
        if not gstreamer.element_factory_exists('keyunitscheduler'):
            from flumotion.component.effects.kuscheduler \
                    import kuscheduler
            kuscheduler.register()
        self.tp = comptest.ComponentTestHelper()
        prod = ('videotestsrc is-live=1 ! ' \
                'video/x-raw-yuv,width=(int)320,height=(int)240, '\
                    'framerate=(fraction)30/1 ! ' \
                'keyunitsscheduler interval = 1000000000 !' \
                'flumch264enc ! ismlmux ' \
                'trak-timescale=10000000 movie-timescale=10000000')
        self.s = \
            'flumotion.component.consumers.smoothstreamer.'\
            'SmoothHTTPLiveStreamer'

        self.prod = comptest.pipeline_src(prod)
Ejemplo n.º 14
0
    def testRunFailGstLinking(self):
        p2 = pipeline_src('fakesink') # this just can't work!
        c2 = pipeline_cnv('fakesink') # and neither can this!

        # we're going to fail in gst - make sure the gst logger is silent
        import gst
        old_debug_level = gst.debug_get_default_threshold()
        gst.debug_set_default_threshold(gst.LEVEL_NONE)

        self.p.set_flow([p2, c2, self.cnv1])
        d = self.p.run_flow(self.duration)

        if old_debug_level != gst.LEVEL_NONE:

            def _restore_gst_debug_level(rf):
                gst.debug_set_default_threshold(old_debug_level)
                return rf
            d.addBoth(_restore_gst_debug_level)
        # See the comment in test_setup_fail_gst_linking()
        return self.failUnlessFailure(d, ComponentSad)
Ejemplo n.º 15
0
    def testDontAutoLinkLinked(self):
        p2 = pipeline_src()
        self.components.append(p2)

        p2.feed(self.cnv1)
        self.prod.auto_link = False

        # [  p2:default] --> [default:cnv1], set explicitly
        # no p2 --> prod, explicitly prohibited
        # [prod:default] --> [default:cnv2]
        self.p.set_flow([p2, self.prod, self.cnv2, self.cnv1])

        prod_feed = "%s:%s" % (p2.name, p2.cfg["feed"][0])
        self.assertEquals([prod_feed], self.cnv1.cfg["source"])
        self.assertEquals({"default": [(prod_feed, "default")]}, self.cnv1.cfg["eater"])

        self.assertEquals([], self.prod.cfg["source"])
        self.assertEquals({}, self.prod.cfg["eater"])

        prod_feed = "%s:%s" % (self.prod.name, self.prod.cfg["feed"][0])
        self.assertEquals([prod_feed], self.cnv2.cfg["source"])
        self.assertEquals({"default": [(prod_feed, "default")]}, self.cnv2.cfg["eater"])
Ejemplo n.º 16
0
    def testSetupFailGstLinking(self):
        p2 = pipeline_src('fakesink') # this just can't work!
        c2 = pipeline_cnv('fakesink') # and neither can this!

        # we're going to fail in gst - make sure the gst logger is silent
        import gst
        old_debug_level = gst.debug_get_default_threshold()
        gst.debug_set_default_threshold(gst.LEVEL_NONE)

        self.p.set_flow([p2, c2, self.cnv1])
        d = self.p.start_flow()

        if old_debug_level != gst.LEVEL_NONE:

            def _restore_gst_debug_level(rf):
                gst.debug_set_default_threshold(old_debug_level)
                return rf
            d.addBoth(_restore_gst_debug_level)
        # Because component setup errors get swallowed in
        # BaseComponent.setup() we won't get the exact error that will
        # be thrown, i.e. PipelineParseError. Instead, the component
        # will turn sad and we will get a ComponentSad failure from
        # the ComponentWrapper.
        return self.failUnlessFailure(d, ComponentSad)
Ejemplo n.º 17
0
    def testDontAutoLinkLinked(self):
        p2 = pipeline_src()
        self.components.append(p2)

        p2.feed(self.cnv1)
        self.prod.auto_link = False

        # [  p2:default] --> [default:cnv1], set explicitly
        # no p2 --> prod, explicitly prohibited
        # [prod:default] --> [default:cnv2]
        self.p.set_flow([p2, self.prod, self.cnv2, self.cnv1])

        prod_feed = '%s:%s' % (p2.name, p2.cfg['feed'][0])
        self.assertEquals([prod_feed], self.cnv1.cfg['source'])
        self.assertEquals({'default': [(prod_feed, 'default')]},
                          self.cnv1.cfg['eater'])

        self.assertEquals([], self.prod.cfg['source'])
        self.assertEquals({}, self.prod.cfg['eater'])

        prod_feed = '%s:%s' % (self.prod.name, self.prod.cfg['feed'][0])
        self.assertEquals([prod_feed], self.cnv2.cfg['source'])
        self.assertEquals({'default': [(prod_feed, 'default')]},
                          self.cnv2.cfg['eater'])
 def setUp(self):
     self.tp = comptest.ComponentTestHelper()
     self.prod = comptest.pipeline_src('videotestsrc is-live=1 ! '
          'video/x-raw-yuv,format=(fourcc)UYVY,'
          'width=(int)320,height=(int)240,framerate=(fraction)30/1')