Closed wibed closed 1 year ago
Refer scaling_video.
let data = UnsafeMutablePointer<UnsafeMutablePointer<UInt8>?>.allocate(capacity: 4)
data.initialize(to: nil)
let linesizes = UnsafeMutablePointer<Int32>.allocate(capacity: 4)
linesizes.initialize(to: 0)
av_image_alloc(
data, linesizes, Int32(width), Int32(height), pixelFormat, Int32(align)
)
i dont know how to construct the expected type.
the function on
SwsContext.scale
expects for dst a array of pointersyet i am having a hard time constructing an array of pointers as a pointer for dst i resorted to use the source value as a basis to allocate the pointer for the destination value following the description of the function
first i tried, but got a
bad dst image pointers
error i think i declared unmutable pointers as mutable, which resulted in the error.i tried using, but got an
Cannot convert value of type 'UnsafePointer<UnsafeMutablePointer<UInt8>>' to expected argument type >'UnsafePointer<UnsafeMutablePointer<UInt8>?>'
errori dont know how to allocate an optional pointer to pass it on for SwsContext. it may be necessary to mirror c's way of handling pointers with a struct as seen in
BufferData
.if you could give me a hint on how to handle this, would be greatly appreciated.