@@ -0,0 +1,1631 @@
+import pygst%0Apygst.require('0.10')%0Aimport gst%0Aimport gobject%0Agobject.threads_init()%0A%0Aclass TimesideSink(gst.BaseSink):%0A    %22%22%22%0A    a simple sink element with a hopsize property to adjust the size of the buffer emitted%0A    %22%22%22%0A    _caps = gst.caps_from_string('audio/x-raw-float, %5C%0A                    rate=%5B 1, 2147483647 %5D, %5C%0A                    channels=%5B 1, 2147483647 %5D, %5C%0A                    endianness=%7B 1234, 4321 %7D, %5C%0A                    width=32')%0A%0A    __gsttemplates__ = ( %0A            gst.PadTemplate (%22sink%22,%0A                gst.PAD_SINK,%0A                gst.PAD_ALWAYS,%0A                _caps),%0A            )%0A%0A    def __init__(self, name):%0A        self.__gobject_init__()%0A        self.set_name(name)%0A        self.adapter = gst.Adapter()%0A        self.set_property('sync', False)%0A%0A    def set_property(self, name, value): %0A        if name == 'hopsize':%0A            # blocksize is in byte, convert from hopsize %0A            from struct import calcsize%0A            self.set_property('blocksize', value * calcsize('f'))%0A        else:%0A            super(gst.BaseSink, self).set_property(name, value)%0A%0A    def do_render(self, buffer):%0A        self.adapter.push(buffer)%0A        return gst.FLOW_OK%0A%0A    def pull(self):%0A        # TODO use signals%0A        blocksize = self.get_property('blocksize')%0A        remaining = self.adapter.available()%0A        if remaining == 0:%0A            return None%0A        if remaining %3E= blocksize:%0A            return self.adapter.take_buffer(blocksize)%0A        if remaining %3C blocksize and remaining %3E 0:%0A            return self.adapter.take_buffer(remaining)%0A%0Agobject.type_register(TimesideSink)%0A%0A%0A

add gst sink