def testADumbExample(self): gst.info("creating pipeline") pipeline = gst.parse_launch("fakesrc ! fakesink") gst.info("pipeliner:%s" % pipeline.__gstrefcount__) bus = pipeline.get_bus() gst.info("got bus, pipeliner:%d, busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__))
def testBinIterateRecurse(self): pipeline = gst.parse_launch("fakesrc name=src ! fakesink name=sink") elements = list(pipeline.recurse()) fakesrc = pipeline.get_by_name("src") fakesink = pipeline.get_by_name("sink") self.assertEqual(elements[0], fakesink) self.assertEqual(elements[1], fakesrc)
def testBinIterateSinks(self): pipeline = gst.parse_launch("fakesrc name=src ! fakesink name=sink") elements = list(pipeline.sinks()) fakesrc = pipeline.get_by_name("src") fakesink = pipeline.get_by_name("sink") self.assertEqual(len(elements), 1) self.failUnless(fakesink in elements) self.failUnless(not fakesrc in elements)
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)
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()
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()
def setUp(self): TestCase.setUp(self) self.pipeline = gst.parse_launch('fakesrc ! fakesink name=sink') self.sink = self.pipeline.get_by_name('sink') self.pipeline.set_state(gst.STATE_PLAYING)
def setUp(self): TestCase.setUp(self) self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink') src = self.pipeline.get_by_name('source') self.srcpad = src.get_pad('src')
def testGoodConstructor(self): loop = gobject.MainLoop() gst.info ("creating pipeline") pipeline = gst.parse_launch("fakesrc ! fakesink") gst.info ("getting bus") bus = pipeline.get_bus() gst.info ("got bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info ("about to add a watch on the bus") watch_id = bus.add_watch(self._message_received, pipeline, loop, "one") gst.info ("added a watch on the bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 3) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("setting to playing") ret = pipeline.set_state(gst.STATE_PLAYING) gst.info("set to playing %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to paused") ret = pipeline.set_state(gst.STATE_PAUSED) gst.info("set to paused %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to ready") ret = pipeline.set_state(gst.STATE_READY) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to READY %s, loop.run" % ret) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to NULL") ret = pipeline.set_state(gst.STATE_NULL) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to NULL %s" % ret) self.gccollect() self.assertEquals(bus.__gstrefcount__, 3) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("about to remove the watch id") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.failUnless(gobject.source_remove(watch_id)) gst.info("bus watch id removed") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.gccollect() gst.info("pipeliner:%d/%d busr:%d" % (pipeline.__gstrefcount__, pipeline.__grefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("removing pipeline") del pipeline gst.info("pipeline removed") gst.info("busr:%d" % bus.__gstrefcount__) self.gccollect() # flush the bus bus.set_flushing(True) bus.set_flushing(False) self.gccollect() # FIXME: refcount is still 2 self.assertEquals(bus.__gstrefcount__, 1)
def testParseLaunch(self): pipeline = gst.parse_launch('fakesrc ! fakesink')
def testGoodConstructor(self): loop = gobject.MainLoop() gst.info("creating pipeline") pipeline = gst.parse_launch("fakesrc ! fakesink") gst.info("getting bus") bus = pipeline.get_bus() gst.info("got bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("about to add a watch on the bus") watch_id = bus.connect("message", self._message_received, pipeline, loop, "one") bus.add_signal_watch() gst.info("added a watch on the bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 3) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("setting to playing") ret = pipeline.set_state(gst.STATE_PLAYING) gst.info("set to playing %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to paused") ret = pipeline.set_state(gst.STATE_PAUSED) gst.info("set to paused %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to ready") ret = pipeline.set_state(gst.STATE_READY) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to READY %s, loop.run" % ret) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to NULL") ret = pipeline.set_state(gst.STATE_NULL) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to NULL %s" % ret) self.gccollect() self.assertEquals(bus.__gstrefcount__, 3) # FIXME: state change thread needs to die while pipeline.__gstrefcount__ > 1: gst.debug('waiting for pipeline refcount to drop') time.sleep(0.1) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("about to remove the watch id") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) bus.remove_signal_watch() gst.info("bus watch id removed") bus.disconnect(watch_id) gst.info("disconnected callback") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.gccollect() gst.info("pipeliner:%d/%d busr:%d" % (pipeline.__gstrefcount__, pipeline.__grefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("removing pipeline") del pipeline gst.info("pipeline removed") gst.info("busr:%d" % bus.__gstrefcount__) self.gccollect() # flush the bus bus.set_flushing(True) bus.set_flushing(False) self.gccollect() # FIXME: refcount is still 2 self.assertEquals(bus.__gstrefcount__, 1)
def testGoodConstructor(self): loop = gobject.MainLoop() gst.info("creating pipeline") pipeline = gst.parse_launch("fakesrc ! fakesink") gst.info("getting bus") bus = pipeline.get_bus() gst.info("got bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("about to add a watch on the bus") watch_id = bus.add_watch(self._message_received, pipeline, loop, "one") gst.info("added a watch on the bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 3) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("setting to playing") ret = pipeline.set_state(gst.STATE_PLAYING) gst.info("set to playing %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to paused") ret = pipeline.set_state(gst.STATE_PAUSED) gst.info("set to paused %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to ready") ret = pipeline.set_state(gst.STATE_READY) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to READY %s, loop.run" % ret) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to NULL") ret = pipeline.set_state(gst.STATE_NULL) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to NULL %s" % ret) self.gccollect() self.assertEquals(bus.__gstrefcount__, 3) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("about to remove the watch id") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.failUnless(gobject.source_remove(watch_id)) gst.info("bus watch id removed") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.gccollect() gst.info("pipeliner:%d/%d busr:%d" % (pipeline.__gstrefcount__, pipeline.__grefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("removing pipeline") del pipeline gst.info("pipeline removed") gst.info("busr:%d" % bus.__gstrefcount__) self.gccollect() # flush the bus bus.set_flushing(True) bus.set_flushing(False) self.gccollect() # FIXME: refcount is still 2 self.assertEquals(bus.__gstrefcount__, 1)
def testGoodConstructor(self): loop = gobject.MainLoop() gst.info ("creating pipeline") pipeline = gst.parse_launch("fakesrc ! fakesink") gst.info ("getting bus") bus = pipeline.get_bus() gst.info ("got bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info ("about to add a watch on the bus") watch_id = bus.connect("message", self._message_received, pipeline, loop, "one") bus.add_signal_watch() gst.info ("added a watch on the bus") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 3) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("setting to playing") ret = pipeline.set_state(gst.STATE_PLAYING) gst.info("set to playing %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to paused") ret = pipeline.set_state(gst.STATE_PAUSED) gst.info("set to paused %s, loop.run" % ret) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to ready") ret = pipeline.set_state(gst.STATE_READY) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to READY %s, loop.run" % ret) loop.run() gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("setting to NULL") ret = pipeline.set_state(gst.STATE_NULL) gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) gst.info("set to NULL %s" % ret) self.gccollect() self.assertEquals(bus.__gstrefcount__, 3) # FIXME: state change thread needs to die while pipeline.__gstrefcount__ > 1: gst.debug('waiting for pipeline refcount to drop') time.sleep(0.1) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("about to remove the watch id") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) bus.remove_signal_watch() gst.info("bus watch id removed") bus.disconnect(watch_id) gst.info("disconnected callback") gst.info("pipeliner:%d busr:%d" % (pipeline.__gstrefcount__, bus.__gstrefcount__)) self.gccollect() gst.info("pipeliner:%d/%d busr:%d" % (pipeline.__gstrefcount__, pipeline.__grefcount__, bus.__gstrefcount__)) self.assertEquals(bus.__gstrefcount__, 2) self.assertEquals(pipeline.__gstrefcount__, 1) gst.info("removing pipeline") del pipeline gst.info("pipeline removed") gst.info("busr:%d" % bus.__gstrefcount__) self.gccollect() # flush the bus bus.set_flushing(True) bus.set_flushing(False) self.gccollect() # FIXME: refcount is still 2 self.assertEquals(bus.__gstrefcount__, 1)
def setUp(self): self.gctrack() self.pipeline = gst.parse_launch('audiotestsrc num-buffers=100 ! vorbisenc name=encoder ! oggmux name=muxer ! fakesink')
def setUp(self): TestCase.setUp(self) self.pipeline = gst.parse_launch("fakesrc name=source ! fakesink") src = self.pipeline.get_by_name("source") self.srcpad = src.get_pad("src")