All pastes #298290 Raw Edit

Something

public text v1 · immutable
#298290 ·published 2006-12-31 20:12 UTC
rendered paste body
libfooid has a function fp_calculate. Defined as follows:

FOOIDAPI int fp_calculate(t_fooid *fi, int songlen, unsigned char** buff);

It takes the data in fi and songlen to create an audio fingerprint, which it will store in buff. I don't understand pointers very well, but I take it that it can take the memory location pointed by &buff and store a value in it, so that buff outside fp_calculate also has the value. Right?

My PyObject "self" has a member "unsigned char * buff". In my function "fooid_fp_calculate(fooid_fooidObject * self, PyObject * args)" I take self, and pass self->buff into fp_calculate. I want self->buff to be filled by this function, and to reference it from Python. However, I do not know how to run fp_calculate so that it just works(tm): that I can get to it from Python, that it keeps its value, and so that Python doesn't segfault on DECREF().