public static CMBlockBuffer CreateEmpty (uint subBlockCapacity, CMBlockBufferFlags flags, out CMBlockBufferError error) { IntPtr buffer; error = CMBlockBufferCreateEmpty (IntPtr.Zero, subBlockCapacity, flags, out buffer); if (error != CMBlockBufferError.None) return null; return new CMBlockBuffer (buffer, true); }
public static CMBlockBuffer FromBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error) { // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set if (!flags.HasFlag(CMBlockBufferFlags.PermitEmptyReference)) { if (targetBuffer == null) { throw new ArgumentNullException("targetBuffer"); } } IntPtr buffer; error = CMBlockBufferCreateWithBufferReference(IntPtr.Zero, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags, out buffer); if (error != CMBlockBufferError.None) { return(null); } return(new CMBlockBuffer(buffer, true)); }
public static CMBlockBuffer CreateEmpty(uint subBlockCapacity, CMBlockBufferFlags flags, out CMBlockBufferError error) { IntPtr buffer; error = CMBlockBufferCreateEmpty(IntPtr.Zero, subBlockCapacity, flags, out buffer); if (error != CMBlockBufferError.None) { return(null); } return(new CMBlockBuffer(buffer, true)); }
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 static CMBlockBuffer FromMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags, out CMBlockBufferError error) { if (data == null) { throw new ArgumentNullException(nameof(data)); } var allocator = new CMManagedArrayBlockAllocator(data); return(FromMemoryBlock(IntPtr.Zero, (uint)data.Length, allocator, offsetToData, (uint)data.Length, flags, out error)); }
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 static CMBlockBuffer FromMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags, out CMBlockBufferError error) { if (data == null) throw new ArgumentNullException (nameof (data)); var allocator = new CMManagedArrayBlockAllocator (data); return FromMemoryBlock (IntPtr.Zero, (uint) data.Length, allocator, offsetToData, (uint) data.Length, flags, out error); }
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 static CMBlockBuffer FromBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error) { // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set if (!flags.HasFlag (CMBlockBufferFlags.PermitEmptyReference)) if (targetBuffer == null) throw new ArgumentNullException ("targetBuffer"); IntPtr buffer; error = CMBlockBufferCreateWithBufferReference (IntPtr.Zero, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags, out buffer); if (error != CMBlockBufferError.None) return null; return new CMBlockBuffer (buffer, true); }
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 static CMBlockBuffer?FromBuffer(CMBlockBuffer?targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error) { // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set if (!flags.HasFlag(CMBlockBufferFlags.PermitEmptyReference)) { if (targetBuffer is null) { ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(targetBuffer)); } } IntPtr buffer; error = CMBlockBufferCreateWithBufferReference(IntPtr.Zero, targetBuffer.GetHandle(), offsetToData, dataLength, flags, out buffer); if (error != CMBlockBufferError.None) { return(null); } return(new CMBlockBuffer(buffer, true)); }