def create_expression(inbuf, outbuf, caps, expression): rate = caps[0]["rate"] dt = 1.0/float(rate) t_start = float(inbuf.timestamp) / float(gst.SECOND) dur = float(inbuf.duration) / float(gst.SECOND) t_end = t_start + dur t = numpy.arange(t_start, t_end, dt) y = eval(expression, numpy.__dict__, {'t': t}) unitsize = pipeio.get_unit_size(caps) bufsize = unitsize * len(t) outbuf[0:bufsize] = y.flatten().astype(pipeio.numpy_dtype_from_caps(caps)).data
def do_get_unit_size(self, caps): return pipeio.get_unit_size(caps)