I'm trying to use CoreVideo with Swift but I'm getting this error:
let flags : CVOptionFlags = 0
CVPixelBufferLockBaseAddress(imageBuffer, flags)
^~~~~~~~~~~~~~~~~
Cannot convert the expression's type 'CVReturn' to type 'CVPixelBuffer!'
CVPixelBufferLockBaseAddress(imageBuffer, 0)
^~~~~~~~~~~~~~~~~
Cannot convert the expression's type 'CVReturn' to type 'CVOptionFlags'
Why does it matter that it can't convert the value if I'm not using it anyways? Should I be passing the 2nd argument differently?
I guess it will be working.
var tmp : COpaquePointer = CMSampleBufferGetImageBuffer(imageBuffer).toOpaque()
var pixelBuf : CVPixelBuffer = (Unmanaged<CVPixelBuffer>.fromOpaque(tmp)).takeUnretainedValue()
CVPixelBufferLockBaseAddress(pixelBuf, 0)