[gst-devel] gst-python problem: refcount for gst.Buffer too big?

Артём Попов artfwo at gmail.com
Fri Apr 21 04:17:01 CEST 2006

Hi all,

I'm trying to write a gst element in python, based on
GstBaseTransform. The core of such an element would be "transform" and
"transform_ip" methods, with receive GstBuffer arguments. Both of
these methods don't work for me, due to too large reference count of
Buffers passed to them. By the way, the "transform" method requires
"get_unit_size" virtual method to be implemented, the patch is here:


in "transform_ip", buffer refcount is 3, and that makes the buffer unwritable
in "transform", both buffer refcounts are 2, what makes output buffer
unwritable as well...

def transform_ip (self, outbuf):
    print outbuf.__grefcount__ # always prints 3
    return gst.FLOW_OK

def transform (self, inbuf, outbuf):
    print inbuf.__grefcount__ # always prints 2
    print outbuf.__grefcount__ # always prints 2
    return gst.FLOW_OK

"gst_buffer_is_writable" checks, that the buffer refcount should be 1,
and gst-python uses just that to enable or disable data writing to the
buffer. So, how can I solve (or maybe workaround) this problem?
Thanks. --Artem

More information about the gstreamer-devel mailing list