public static CMBlockBuffer CreateContiguous(CMBlockBuffer sourceBuffer, CMCustomBlockAllocator customBlockSource, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error) { if (sourceBuffer == null) { throw new ArgumentNullException("sourceBuffer"); } IntPtr buffer; if (customBlockSource == null) { error = CMBlockBufferCreateContiguous(IntPtr.Zero, sourceBuffer.handle, IntPtr.Zero, IntPtr.Zero, offsetToData, dataLength, flags, out buffer); } else { error = CMBlockBufferCreateContiguous(IntPtr.Zero, sourceBuffer.handle, IntPtr.Zero, ref customBlockSource.Cblock, offsetToData, dataLength, flags, out buffer); } if (error != CMBlockBufferError.None) { return(null); } var block = new CMBlockBuffer(buffer, true); block.customAllocator = customBlockSource; return(block); }
public CMBlockBufferError AppendMemoryBlock(IntPtr memoryBlock, nuint blockLength, CMCustomBlockAllocator customBlockSource, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags) { if (Handle == IntPtr.Zero) { throw new ObjectDisposedException("BlockBuffer"); } var blockAllocator = memoryBlock == IntPtr.Zero ? IntPtr.Zero : CFAllocator.Null.Handle; if (customBlockSource == null) { return(CMBlockBufferAppendMemoryBlock(Handle, memoryBlock, blockLength, blockAllocator, IntPtr.Zero, offsetToData, dataLength, flags)); } else { return(CMBlockBufferAppendMemoryBlock(Handle, memoryBlock, blockLength, blockAllocator, ref customBlockSource.Cblock, offsetToData, dataLength, flags)); } }
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; if (customBlockSource == null) { error = CMBlockBufferCreateWithMemoryBlock(IntPtr.Zero, memoryBlock, blockLength, blockAllocator, IntPtr.Zero, offsetToData, dataLength, flags, out buffer); } else { error = CMBlockBufferCreateWithMemoryBlock(IntPtr.Zero, memoryBlock, blockLength, blockAllocator, ref customBlockSource.Cblock, offsetToData, dataLength, flags, out buffer); } if (error != CMBlockBufferError.None) { return(null); } var block = new CMBlockBuffer(buffer, true); block.customAllocator = customBlockSource; return(block); }
public CMBlockBufferError AppendMemoryBlock(IntPtr memoryBlock, nuint blockLength, CMCustomBlockAllocator customBlockSource, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags) { var blockAllocator = memoryBlock == IntPtr.Zero ? NativeHandle.Zero : CFAllocator.Null.Handle; if (customBlockSource is null) { return(CMBlockBufferAppendMemoryBlock(GetCheckedHandle(), memoryBlock, blockLength, blockAllocator, IntPtr.Zero, offsetToData, dataLength, flags)); } else { return(CMBlockBufferAppendMemoryBlock(GetCheckedHandle(), memoryBlock, blockLength, blockAllocator, ref customBlockSource.Cblock, offsetToData, dataLength, flags)); } }