-
-
Save spouliot/a1e7d90015c22445afb205c74ceb5b0b to your computer and use it in GitHub Desktop.
This file contains 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
[DllImport(Constants.CoreMediaLibrary)] | |
extern static /* OSStatus */ CMBlockBufferError CMBlockBufferCreateWithMemoryBlock ( | |
/* CFAllocatorRef */ IntPtr structureAllocator, | |
/* void * */ IntPtr memoryBlock, | |
/* size_t */ nuint blockLength, | |
/* CFAllocatorRef */ IntPtr blockAllocator, | |
/* CMBlockBufferCustomBlockSource* */ IntPtr customBlockSource, // Can be null | |
/* size_t */ nuint offsetToData, | |
/* size_t */ nuint dataLength, | |
CMBlockBufferFlags flags, | |
/* CMBlockBufferRef* */ out IntPtr newBlockBuffer); | |
public static CMBlockBuffer FromMemoryBlock (IntPtr memoryBlock, nuint blockLength, CMCustomBlockAllocator customBlockSource, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error) | |
{ | |
var blockAllocator = memoryBlock == IntPtr.Zero ? IntPtr.Zero : CFAllocator.Null.Handle; | |
IntPtr buffer; | |
error = CMBlockBufferCreateWithMemoryBlock (IntPtr.Zero, memoryBlock, blockLength, blockAllocator, IntPtr.Zero, offsetToData, dataLength, flags, out buffer); | |
if (error != CMBlockBufferError.None) | |
return null; | |
return ObjCRuntime.Runtime.GetINativeObject<CMBlockBuffer> (buffer, true); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment