I use the ExternalAccessory wrapper-based SDK to read the image source file with the following pseudo-code.
let read = buffer.withUnsafeMutableBytes { bufferPointer in
self.sessionController.readFile(handle, data: bufferPointer, len: UInt32(min(remainingToRead, UInt64(bufferSize))))
}
if read == 0 {
completion(fileURL!, FileError.readFile)
return // Read error
}
remainingToRead -= UInt64(read)
fileHandle?.write(buffer)
What I want to achieve is that I read the file stream of the image thumbnail directly from the external device, not the file stream of the original image file, does anyone have a good solution for this?
I tried to read the image raw file and then compress it, but this will affect the speed of the image display.
Also, do I need to consider C language to process the file stream to implement this feature?