def testBufferCaps(self): buffer = gst.Buffer() caps = gst.caps_from_string('foo/blah') gst.info("before settings caps") buffer.set_caps(caps) gst.info("after settings caps") c = buffer.get_caps() gst.info("after getting caps") self.assertEquals(caps, c)
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)
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 = []
def testLinkFiltered(self): # a filtered link uses capsfilter and thus needs a bin bin = gst.Bin() src = gst.element_factory_make('fakesrc') sink = gst.element_factory_make('fakesink') bin.add(src, sink) caps = gst.caps_from_string("audio/x-raw-int") self.failUnless(src.link(sink, caps)) # DANGER WILL. src is not actually connected to sink, since # there's a capsfilter in the way. What a leaky abstraction. # FIXME # src.unlink(sink) # instead, mess with pads directly pad = src.get_pad('src') pad.unlink(pad.get_peer()) pad = sink.get_pad('sink') pad.get_peer().unlink(pad)
def testEncoderDescription(self): assert hasattr(gst.pbutils, 'get_encoder_description') self.assertEquals(gst.pbutils.get_encoder_description(gst.caps_from_string("audio/mpeg,mpegversion=1,layer=3")), 'MPEG-1 Layer 3 (MP3) encoder')
def testConstructor(self): template = gst.PadTemplate("template", gst.PAD_SINK, gst.PAD_ALWAYS, gst.caps_from_string("audio/x-raw-int")) self.failUnless(template) self.assertEquals(sys.getrefcount(template), pygobject_2_13 and 2 or 3)