Example #1
0
 def setUp(self):
     TestCase.setUp(self)
     self.pipeline = gst.Pipeline()
     self.src = gst.element_factory_make('fakesrc')
     self.src.set_property('num-buffers', 10)
     self.pipeline.add(self.src)
     self.srcpad = self.src.get_pad('src')
Example #2
0
    def setUp(self):
        TestCase.setUp(self)
        self.pipeline = gst.Pipeline()
        self.assertEquals(self.pipeline.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.pipeline), pygobject_2_13 and 2
                          or 3)

        self.fakesrc = gst.element_factory_make('fakesrc')
        self.fakesink = gst.element_factory_make('fakesink')
        self.assertEquals(self.fakesrc.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2
                          or 3)

        self.pipeline.add(self.fakesrc, self.fakesink)
        self.assertEquals(self.fakesrc.__gstrefcount__, 2)  # added
        self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2
                          or 3)
        self.assertEquals(self.fakesink.__gstrefcount__, 2)  # added
        self.assertEquals(sys.getrefcount(self.fakesink), pygobject_2_13 and 2
                          or 3)

        self.fakesrc.link(self.fakesink)

        self.assertEquals(self.pipeline.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.pipeline), pygobject_2_13 and 2
                          or 3)
        self.assertEquals(self.fakesrc.__gstrefcount__, 2)
        self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2
                          or 3)
        self.assertEquals(self.fakesink.__gstrefcount__, 2)
        self.assertEquals(sys.getrefcount(self.fakesink), pygobject_2_13 and 2
                          or 3)
Example #3
0
 def setUp(self):
     self.gctrack()
     self.pipeline = gst.Pipeline('test-pipeline')
     source = gst.element_factory_make('fakesrc', 'source')
     source.set_property('num-buffers', 5)
     sink = gst.element_factory_make('fakesink', 'sink')
     self.pipeline.add(source, sink)
     gst.element_link_many(source, sink)
Example #4
0
 def testGoodConstructor(self):
     name = 'test-pipeline'
     pipeline = gst.Pipeline(name)
     self.assertEquals(pipeline.__gstrefcount__, 1)
     assert pipeline is not None, 'pipeline is None'
     self.failUnless(isinstance(pipeline, gst.Pipeline),
         'pipeline is not a GstPipline')
     assert pipeline.get_name() == name, 'pipelines name is wrong'
     self.assertEquals(pipeline.__gstrefcount__, 1)
Example #5
0
    def testGet(self):
        pipeline = gst.Pipeline('test')
        self.assertEquals(pipeline.__gstrefcount__, 1)
        bus = pipeline.get_bus()
        self.assertEquals(pipeline.__gstrefcount__, 1)
        # one for python and one for the pipeline
        self.assertEquals(bus.__gstrefcount__, 2)

        del pipeline
		if not pygobject_2_13:
Example #6
0
    def setUp(self):
        TestCase.setUp(self)
        self.pipeline = gst.Pipeline('test-pipeline')
        source = gst.element_factory_make('fakesrc', 'source')
        sink = gst.element_factory_make('fakesink', 'sink')
        self.pipeline.add(source, sink)
        gst.element_link_many(source, sink)

        self.bus = self.pipeline.get_bus()
        self.assertEquals(self.bus.__gstrefcount__, 2)
        self.handler = self.bus.add_watch(self._message_received)
        self.assertEquals(self.bus.__gstrefcount__, 3)
        self.assertEquals(self.pipeline.__gstrefcount__, 1)

        self.loop = gobject.MainLoop()
Example #7
0
    def setUp(self):
        gst.info("setUp")
        TestCase.setUp(self)
        self.pipeline = gst.Pipeline()
        self.assertEquals(self.pipeline.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.pipeline), pygobject_2_13 and 2
                          or 3)

        self.src = SrcBin()
        self.src.prepare()
        self.sink = SinkBin()
        self.sink.prepare()
        self.assertEquals(self.src.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
        self.assertEquals(self.sink.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.sink), pygobject_2_13 and 2
                          or 3)
        gst.info("end of SetUp")
Example #8
0
    def testApplication(self):
        self.loop = gobject.MainLoop()
        gst.info("creating new pipeline")
        bin = gst.Pipeline()
        bus = bin.get_bus()
        bus.add_signal_watch()
        self.got_message = False
        bus.connect('message::application', self.message_application_cb)

        struc = gst.Structure("foo")
        msg = gst.message_new_application(bin, struc)
        # the bus is flushing in NULL, so we need to set the pipeline to READY
        bin.set_state(gst.STATE_READY)
        bus.post(msg)
        self.loop.run()
        bus.remove_signal_watch()
        bin.set_state(gst.STATE_NULL)
        self.failUnless(self.got_message == True)
        self.gccollect()