Exemplo n.º 1
0
    def tearDown(self):
        # Refcount must be either 1 or 2, to allow for a possibly still running
        # state-recalculation thread
        self.assertTrue(self.pipeline.__gstrefcount__ >= 1
                        and self.pipeline.__gstrefcount__ <= 2)

        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)
        gst.debug('deleting pipeline')
        del self.pipeline
        self.gccollect()

        self.assertEquals(self.fakesrc.__gstrefcount__, 1)  # parent gone
        self.assertEquals(self.fakesink.__gstrefcount__, 1)  # parent gone
        self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2
                          or 3)
        self.assertEquals(sys.getrefcount(self.fakesink), pygobject_2_13 and 2
                          or 3)
        gst.debug('deleting fakesrc')
        del self.fakesrc
        self.gccollect()
        gst.debug('deleting fakesink')
        del self.fakesink
        self.gccollect()

        TestCase.tearDown(self)
Exemplo n.º 2
0
 def tearDown(self):
     # FIXME: wait for state change thread to settle down
     while self.bin.__gstrefcount__ > 1:
         time.sleep(0.1)
     self.assertEquals(self.bin.__gstrefcount__, 1)
     del self.bin
     TestCase.tearDown(self)
Exemplo n.º 3
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalarflot")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     self.data = np.array(42.5, dtype="f")
     self.dset = self.f.create_dataset("x", data=self.data)
Exemplo n.º 4
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)
Exemplo n.º 5
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalarflot")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.array(42.5, dtype='f')
     self.dset = self.f.create_dataset('x', data=self.data)
Exemplo n.º 6
0
 def tearDown(self):
     self.pipeline.setState(STATE_NULL)
     self.pipeline.release()
     self.monitor.disconnectFromObj(self.pipeline)
     del self.pipeline
     del self.monitor
     TestCase.tearDown(self)
Exemplo n.º 7
0
 def setUp(self):
     TestCase.setUp(self)
     amix = find_mixer_element()
     if amix:
         self.mixer = amix.create()
     else:
         self.mixer = None
Exemplo n.º 8
0
 def tearDown(self):
     self.pipeline.setState(STATE_NULL)
     self.pipeline.release()
     self.monitor.disconnectFromObj(self.pipeline)
     del self.pipeline
     del self.monitor
     TestCase.tearDown(self)
Exemplo n.º 9
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test2dzerofloat")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     self.data = np.ones((0, 3), dtype="f")
     self.dset = self.f.create_dataset("x", data=self.data)
Exemplo n.º 10
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test3dfloat")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.ones((4,6,8), dtype='f')
     self.dset = self.f.create_dataset('x', data=self.data, dtype='f')
Exemplo n.º 11
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)
Exemplo n.º 12
0
 def setUp(self):
     self.registry = gst.registry_get_default()
     self.plugins = self.registry.get_plugin_list()
     self.efeatures = self.registry.get_feature_list(gst.TYPE_ELEMENT_FACTORY)
     self.tfeatures = self.registry.get_feature_list(gst.TYPE_TYPE_FIND_FACTORY)
     self.ifeatures = self.registry.get_feature_list(gst.TYPE_INDEX_FACTORY)
     TestCase.setUp(self)
Exemplo n.º 13
0
    def tearDown(self):
        gst.info("tearDown")
        self.assertTrue(self.pipeline.__gstrefcount__ >= 1
                        and self.pipeline.__gstrefcount__ <= 2)
        self.assertEquals(sys.getrefcount(self.pipeline), pygobject_2_13 and 2
                          or 3)
        self.assertEquals(self.src.__gstrefcount__, 2)
        self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
        self.assertEquals(self.sink.__gstrefcount__, 2)
        self.assertEquals(sys.getrefcount(self.sink), 3)
        gst.debug('deleting pipeline')
        del self.pipeline
        self.gccollect()

        self.assertEquals(self.src.__gstrefcount__, 1)  # parent gone
        self.assertEquals(self.sink.__gstrefcount__, 1)  # parent gone
        self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
        self.assertEquals(sys.getrefcount(self.sink), pygobject_2_13 and 2
                          or 3)
        gst.debug('deleting src')
        del self.src
        self.gccollect()
        gst.debug('deleting sink')
        del self.sink
        self.gccollect()

        TestCase.tearDown(self)
Exemplo n.º 14
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')
Exemplo n.º 15
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')
Exemplo n.º 16
0
 def tearDown(self):
     # FIXME: wait for state change thread to settle down
     while self.bin.__gstrefcount__ > 1:
         time.sleep(0.1)
     self.assertEquals(self.bin.__gstrefcount__, 1)
     del self.bin
     TestCase.tearDown(self)
Exemplo n.º 17
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test1dfloat")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     self.data = np.arange(13).astype("f")
     self.dset = self.f.create_dataset("x", data=self.data)
Exemplo n.º 18
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testempty")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.dset = self.f.create_dataset('x',dtype='S10')
     self.empty_obj = h5py.Empty(np.dtype("S10"))
Exemplo n.º 19
0
 def setUp(self):
     TestCase.setUp(self)
     filename = "dataset_testscalarcompound." + self.base_domain
     self.f = h5py.File(filename, 'w')
     self.data = np.array((42.5, -118, "Hello"),
                          dtype=[('a', 'f'), ('b', 'i'), ('c', '|S10')])
     self.dset = self.f.create_dataset('x', data=self.data)
Exemplo n.º 20
0
 def setUp(self):
     TestCase.setUp(self)
     amix = find_mixer_element()
     if amix:
         self.mixer = amix.create()
     else:
         self.mixer = None
Exemplo n.º 21
0
 def setUp(self):
     TestCase.setUp(self)
     self.factory = StubFactory()
     self.stream = VideoStream(gst.Caps('video/x-raw-rgb'))
     self.factory.addOutputStream(self.stream)
     self.track1 = Track(self.stream)
     self.track2 = Track(self.stream)
Exemplo n.º 22
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test1dfloat")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.arange(13).astype('f')
     self.dset = self.f.create_dataset('x', data=self.data)
Exemplo n.º 23
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalarcompound")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     self.data = np.array((42.5, -118, "Hello"), dtype=[("a", "f"), ("b", "i"), ("c", "|S10")])
     self.dset = self.f.create_dataset("x", data=self.data)
Exemplo n.º 24
0
 def tearDown(self):
     self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
     self.assertEquals(self.src.__gstrefcount__, 1)
     del self.src
     self.assertEquals(sys.getrefcount(self.sink), pygobject_2_13 and 2 or 3)
     self.assertEquals(self.sink.__gstrefcount__, 1)
     del self.sink
     TestCase.tearDown(self)
Exemplo n.º 25
0
 def setUp(self):
     TestCase.setUp(self)
     stream = AudioStream(gst.Caps("audio/x-raw-int"))
     self.factory = StubFactory()
     gst.debug("%r" % self.factory.duration)
     self.factory.addOutputStream(stream)
     self.track_object = SourceTrackObject(self.factory, stream)
     self.monitor = TrackSignalMonitor(self.track_object)
Exemplo n.º 26
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalarcompound")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.array((42.5, -118, "Hello"),
                          dtype=[('a', 'f'), ('b', 'i'), ('c', '|S10')])
     self.dset = self.f.create_dataset('x', data=self.data)
Exemplo n.º 27
0
 def setUp(self):
     TestCase.setUp(self)
     filename = "dataset_testscalararray." + self.base_domain
     self.f = h5py.File(filename, 'w')
     self.dt = np.dtype('(3,2)f')
     self.data = np.array([(3.2, -119), (42, 99.8), (3.14, 0)], dtype='f')
     self.dset = self.f.create_dataset('x', (), dtype=self.dt)
     self.dset[...] = self.data
Exemplo n.º 28
0
 def tearDown(self):
     self.discoverer.disconnect_by_function(self.discoveryErrorCb)
     self.discoverer.disconnect_by_function(self.discoveryDoneCb)
     self.discoverer = None
     self.factories = None
     self.error = None
     self.src = None
     TestCase.tearDown(self)
Exemplo n.º 29
0
 def tearDown(self):
     self.discoverer.disconnect_by_function(self.discoveryErrorCb)
     self.discoverer.disconnect_by_function(self.discoveryDoneCb)
     self.discoverer = None
     self.factories = None
     self.error = None
     self.src = None
     TestCase.tearDown(self)
Exemplo n.º 30
0
 def setUp(self):
     TestCase.setUp(self)
     filename = "dataset_testscalararray." + self.base_domain
     self.f = h5py.File(filename, 'w')
     self.dt = np.dtype('(3,2)f')
     self.data = np.array([(3.2, -119), (42, 99.8), (3.14, 0)], dtype='f')
     self.dset = self.f.create_dataset('x', (), dtype=self.dt)
     self.dset[...] = self.data
Exemplo n.º 31
0
 def setUp(self):
     TestCase.setUp(self)
     gst.debug("start")
     self.pipeline = Pipeline()
     self.monitor = SignalMonitor(self.pipeline, 'action-added',
                                  'action-removed', 'factory-added',
                                  'factory-removed', 'state-changed')
     self.assertEquals(self.monitor.action_added_count, 0)
     self.assertEquals(self.monitor.action_added_collect, [])
Exemplo n.º 32
0
 def setUp(self):
     TestCase.setUp(self)
     filename = "dataset_testempty." + self.base_domain
     self.f = h5py.File(filename, 'w')
     sid = h5py.h5s.create(h5py.h5s.NULL)
     tid = h5py.h5t.C_S1.copy()
     tid.set_size(10)
     dsid = h5py.h5d.create(self.f.id, b'x', tid, sid)
     self.dset = h5py.Dataset(dsid)
Exemplo n.º 33
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalararray")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     self.dt = np.dtype("(3,2)f")
     self.data = np.array([(3.2, -119), (42, 99.8), (3.14, 0)], dtype="f")
     self.dset = self.f.create_dataset("x", (), dtype=self.dt)
     self.dset[...] = self.data
Exemplo n.º 34
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalararray")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.dt = np.dtype('(3,2)f')
     self.data = np.array([(3.2, -119), (42, 99.8), (3.14, 0)], dtype='f')
     self.dset = self.f.create_dataset('x', (), dtype=self.dt)
     self.dset[...] = self.data
Exemplo n.º 35
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test3dfloat")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.ones((4, 6, 8), dtype='f')
     # TBD data in initializer not working
     self.dset = self.f.create_dataset('x', (4, 6, 8), dtype='f')
     self.dset[...] = self.data
Exemplo n.º 36
0
 def setUp(self):
     TestCase.setUp(self)
     self.caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5/1;video/x-raw-rgb,width=15,framerate=10/1')
     self.assertEquals(self.caps.__refcount__, 1)
     self.structure = self.caps[0]
     self.any = gst.Caps("ANY")
     self.assertEquals(self.any.__refcount__, 1)
     self.empty = gst.Caps()
     self.assertEquals(self.empty.__refcount__, 1)
Exemplo n.º 37
0
 def setUp(self):
     TestCase.setUp(self)
     filename = "dataset_testempty." + self.base_domain
     self.f = h5py.File(filename, 'w')
     sid = h5py.h5s.create(h5py.h5s.NULL)
     tid = h5py.h5t.C_S1.copy()
     tid.set_size(10)
     dsid = h5py.h5d.create(self.f.id, b'x', tid, sid)
     self.dset = h5py.Dataset(dsid)
Exemplo n.º 38
0
 def tearDown(self):
     self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
     self.assertEquals(self.src.__gstrefcount__, 1)
     del self.src
     self.assertEquals(sys.getrefcount(self.sink), pygobject_2_13 and 2
                       or 3)
     self.assertEquals(self.sink.__gstrefcount__, 1)
     del self.sink
     TestCase.tearDown(self)
Exemplo n.º 39
0
 def setUp(self):
     TestCase.setUp(self)
     gst.debug("start")
     self.pipeline = Pipeline()
     self.monitor = SignalMonitor(self.pipeline, 'action-added',
                                  'action-removed', 'factory-added',
                                  'factory-removed', 'state-changed')
     self.assertEquals(self.monitor.action_added_count, 0)
     self.assertEquals(self.monitor.action_added_collect, [])
Exemplo n.º 40
0
    def setUp(self):
        TestCase.setUp(self)
        self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
        self.assertEquals(self.pipeline.__gstrefcount__, 1)

        self.element = self.pipeline.get_by_name('source')
        self.assertEquals(self.pipeline.__gstrefcount__, 1)
        self.assertEquals(self.element.__gstrefcount__, 2)
        self.assertEquals(sys.getrefcount(self.element), pygobject_2_13 and 2 or 3)
Exemplo n.º 41
0
 def setUp(self):
     self.registry = gst.registry_get_default()
     self.plugins = self.registry.get_plugin_list()
     self.efeatures = self.registry.get_feature_list(
         gst.TYPE_ELEMENT_FACTORY)
     self.tfeatures = self.registry.get_feature_list(
         gst.TYPE_TYPE_FIND_FACTORY)
     self.ifeatures = self.registry.get_feature_list(gst.TYPE_INDEX_FACTORY)
     TestCase.setUp(self)
Exemplo n.º 42
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testempty")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     sid = h5py.h5s.create(h5py.h5s.NULL)
     tid = h5py.h5t.C_S1.copy()
     tid.set_size(10)
     dsid = h5py.h5d.create(self.f.id, b'x', tid, sid)
     self.dset = h5py.Dataset(dsid)
Exemplo n.º 43
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test1dfloat")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.arange(13).astype('f')
     # TBD data in initializer not working
     #self.dset = self.f.create_dataset('x', data=self.data)
     self.dset = self.f.create_dataset('x', (13, ), dtype='f')
     self.dset[...] = self.data
Exemplo n.º 44
0
    def setUp(self):
        TestCase.setUp(self)
        self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
        self.assertEquals(self.pipeline.__gstrefcount__, 1)

        self.element = self.pipeline.get_by_name('source')
        self.assertEquals(self.pipeline.__gstrefcount__, 1)
        self.assertEquals(self.element.__gstrefcount__, 2)
        self.assertEquals(sys.getrefcount(self.element), pygobject_2_13 and 2
                          or 3)
Exemplo n.º 45
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_test1dzerofloat")
     print("filename:", filename)
     self.f = h5py.File(filename, 'w')
     self.data = np.ones((0,), dtype='f')
     # TBD data in initializer not working
     #self.dset = self.f.create_dataset('x', data=self.data)
     self.dset = self.f.create_dataset('x', (0,), maxshape=(None,),  dtype='f')
     self.dset[...] = self.data
Exemplo n.º 46
0
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testempty")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     sid = h5py.h5s.create(h5py.h5s.NULL)
     tid = h5py.h5t.C_S1.copy()
     tid.set_size(10)
     dsid = h5py.h5d.create(self.f.id, b"x", tid, sid)
     self.dset = h5py.Dataset(dsid)
Exemplo n.º 47
0
 def setUp(self):
     TestCase.setUp(self)
     self.factory = StubSourceFactory('name')
     caps = gst.Caps('video/x-raw-rgb')
     self.stream = VideoStream(caps, pad_name='src0')
     # source factories can't have input streams
     self.failUnlessRaises(AssertionError,
             self.factory.addInputStream, self.stream)
     self.factory.addOutputStream(self.stream)
     self.monitor = SignalMonitor(self.factory, 'bin-created', 'bin-released')
Exemplo n.º 48
0
 def tearDown(self):
     self.pipeline.set_state(gst.STATE_NULL)
     self.sink.disconnect(self.sigid)
     if os.path.exists(self.filename):
         os.remove(self.filename)
     del self.bus
     del self.pipeline
     del self.source
     del self.sink
     del self.handoffs
     TestCase.tearDown(self)
Exemplo n.º 49
0
 def setUp(self):
     TestCase.setUp(self)
     gst.info("start")
     self.filename = tempfile.mktemp()
     open(self.filename, 'w').write(''.join(map(str, range(10))))
     
     self.pipeline = gst.parse_launch('filesrc name=source location=%s blocksize=1 ! fakesink signal-handoffs=1 name=sink' % self.filename)
     self.source = self.pipeline.get_by_name('source')
     self.sink = self.pipeline.get_by_name('sink')
     self.sigid = self.sink.connect('handoff', self.handoff_cb)
     self.bus = self.pipeline.get_bus()
Exemplo n.º 50
0
 def setUp(self):
     TestCase.setUp(self)
     self.factory = StubSourceFactory('name')
     caps = gst.Caps('video/x-raw-rgb')
     self.stream = VideoStream(caps, pad_name='src0')
     # source factories can't have input streams
     self.failUnlessRaises(AssertionError, self.factory.addInputStream,
                           self.stream)
     self.factory.addOutputStream(self.stream)
     self.monitor = SignalMonitor(self.factory, 'bin-created',
                                  'bin-released')
Exemplo n.º 51
0
 def tearDown(self):
     self.pipeline.set_state(gst.STATE_NULL)
     self.sink.disconnect(self.sigid)
     if os.path.exists(self.filename):
         os.remove(self.filename)
     del self.bus
     del self.pipeline
     del self.source
     del self.sink
     del self.handoffs
     TestCase.tearDown(self)
Exemplo n.º 52
0
 def setUp(self):
     TestCase.setUp(self)
     self.src = gst.Pad("src", gst.PAD_SRC)
     self.sink = gst.Pad("sink", gst.PAD_SINK)
     caps = gst.caps_from_string("foo/bar")
     self.src.set_caps(caps)
     self.sink.set_caps(caps)
     self.src.set_active(True)
     self.sink.set_active(True)
     self.sink.set_chain_function(self._chain_func)
     self.buffers = []
Exemplo n.º 53
0
    def tearDown(self):
        gst.debug('setting pipeline to NULL')
        self.pipeline.set_state(gst.STATE_NULL)
        gst.debug('set pipeline to NULL')
        # FIXME: wait for state change thread to die
        while self.pipeline.__gstrefcount__ > 1:
            gst.debug('waiting for self.pipeline G rc to drop to 1')
            time.sleep(0.1)
        self.assertEquals(self.pipeline.__gstrefcount__, 1)

        del self.sink
        del self.pipeline
        TestCase.tearDown(self)
Exemplo n.º 54
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()
Exemplo n.º 55
0
    def setUp(self):
        TestCase.setUp(self)
        self.discoverer = Discoverer1()
        self.discoverer.current_uri = "meh"
        # don't plug the thumbnailing branch
        self.discoverer.current_uri = "file:///foo/bar"
        self.src = gst.Bin()
        self.discoverer.pipeline = self.src
        self.discoverer.current_duration = 10 * gst.SECOND
        self.factories = []
        self.error = None
        self.error_detail = None

        self.discoverer.connect("discovery-error", self.discoveryErrorCb)
        self.discoverer.connect("discovery-done", self.discoveryDoneCb)
Exemplo n.º 56
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")
Exemplo n.º 57
0
    def tearDown(self):
        # Refcount must be either 1 or 2, to allow for a possibly still running
        # state-recalculation thread
        self.assertTrue (self.pipeline.__gstrefcount__ >= 1 and self.pipeline.__gstrefcount__ <= 2)

        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)
        gst.debug('deleting pipeline')
        del self.pipeline
        self.gccollect()

        self.assertEquals(self.fakesrc.__gstrefcount__, 1) # parent gone
        self.assertEquals(self.fakesink.__gstrefcount__, 1) # parent gone
        self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2 or 3)
        self.assertEquals(sys.getrefcount(self.fakesink), pygobject_2_13 and 2 or 3)
        gst.debug('deleting fakesrc')
        del self.fakesrc
        self.gccollect()
        gst.debug('deleting fakesink')
        del self.fakesink
        self.gccollect()

        TestCase.tearDown(self)