Skip to content

Instantly share code, notes, and snippets.

@spouliot

spouliot/file.cs Secret

Created Apr 6, 2016
Embed
What would you like to do?
[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