Last active
September 4, 2016 07:25
-
-
Save oozoofrog/96bfda13f9732272445cdf42a46450fa to your computer and use it in GitHub Desktop.
AVFrameのtupleのデータをArrayで変換 ref: http://qiita.com/funcodes/items/7b91c6b740f42ea66a04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct AVFrame { | |
... | |
uint8_t *data[AV_NUM_DATA_POINTERS]; // AV_NUM_DATA_POINTERS = 8 | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct AVFrame { | |
public var data: (UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?, UnsafeMutablePointer<UInt8>?) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tuplePointer: UnsafePointer<(UnsafePointer<UInt8>?, UnsafePointer<UInt8>?, ...)> = withUnsafePointer(to: $tuplePointer){$0} | |
let unsignedInteger8Buffer: UnsafePointer<UnsafePointer<UInt8>?> = UnsafePointer(tuplePointer.withMemoryRebound(to: (UnsafePointer<UInt8>?.self)!, capacity: 8){$0} | |
let bufferPointer: UnsafeBufferPointer<UnsafePointer<UInt8>?> = UnsafeBufferPointer(start: unsignedInteger8Buffer, count: 8) | |
let arr = Array(bufferPointer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment