wolf71
Nov 28, 2016 - 10:51
using objcblock define a callback function.and need return a objc obj(<AVAudioCompressedBuffer@0x170210290: 0/12288 bytes>). but had error.
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 339, in 'converting callback result'
TypeError: cannot be converted to pointer
def conv_block(self,inNumberOfPackets,buffstat):
# buffstat: 0-have data 1-no data 2-endOfStream 3-error
print '@1',inNumberOfPackets,buffstat.contents.value
buffstat.contents.value = 2
print '@2',inNumberOfPackets,buffstat.contents.value
print inBuffer #<AVAudioPCMBuffer@0x174217ae0: 8192/8192 bytes>
return inBuffer
# if using return c_void_p(inBuffer) Error:cannot be converted to pointer
convblock=ObjCBlock(conv_block,restype=c_void_p,argtypes=[c_void_p,c_int32,POINTER(c_long)])