示例#1
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferCreateWithBufferReference(
     /* CFAllocatorRef */ IntPtr structureAllocator,
     /* CMBlockBufferRef */ IntPtr targetBuffer,
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags,
     /* CMBlockBufferRef* */ out IntPtr newBlockBuffer);
		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);
		}
示例#3
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferCreateContiguous(
     /* CFAllocatorRef */ IntPtr structureAllocator,
     /* CMBlockBufferRef */ IntPtr sourceBuffer,
     /* CFAllocatorRef */ IntPtr blockAllocator,
     /* CMBlockBufferCustomBlockSource */ IntPtr customBlockSource,             // Can be null
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags,
     /* CMBlockBufferRef* */ out IntPtr newBlockBuffer);
示例#4
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferAppendMemoryBlock(
     /* CMBlockBufferRef */ IntPtr buffer,
     /* 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);
示例#5
0
 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);
示例#6
0
        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));
        }
示例#7
0
 static extern 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);
示例#8
0
 extern static CMBlockBufferError CMBlockBufferCreateEmpty(IntPtr allocator, uint subBlockCapacity, CMBlockBufferFlags flags, out IntPtr output);
示例#9
0
        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;
        }
示例#10
0
 static extern CMBlockBufferError CMBlockBufferCreateWithBufferReference(
     /* CFAllocatorRef */ IntPtr structureAllocator,
     /* CMBlockBufferRef */ IntPtr targetBuffer,
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags,
     /* CMBlockBufferRef* */ out IntPtr newBlockBuffer);
示例#11
0
        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));
        }
示例#12
0
        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);
        }
示例#13
0
        public CMBlockBufferError AppendMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags)
        {
            if (Handle == IntPtr.Zero)
                throw new ObjectDisposedException ("BlockBuffer");
            if (data == null)
                throw new ArgumentNullException (nameof (data));

            var allocator = new CMManagedArrayBlockAllocator (data);
            return AppendMemoryBlock (IntPtr.Zero, (uint) data.Length, allocator, offsetToData, (uint) data.Length, flags);
        }
示例#14
0
        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));
            }
        }
示例#15
0
        public CMBlockBufferError AppendBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags)
        {
            if (Handle == IntPtr.Zero)
                throw new ObjectDisposedException ("BlockBuffer");

            // 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");
            }

            return CMBlockBufferAppendBufferReference (Handle, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags);
        }
示例#16
0
        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);
        }
示例#17
0
        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);
        }
示例#18
0
        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;
        }
示例#19
0
        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);
        }
示例#20
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferAppendBufferReference(
     /* CMBlockBufferRef */ IntPtr buffer,
     /* CMBlockBufferRef */ IntPtr targetBBuf,
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags);
示例#21
0
        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));
            }
        }
示例#22
0
        public CMBlockBufferError AppendBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags)
        {
            if (Handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("BlockBuffer");
            }

            // 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");
                }
            }

            return(CMBlockBufferAppendBufferReference(Handle, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags));
        }
示例#23
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferCreateEmpty(/* CFAllocatorRef */ IntPtr allocator, /* uint32_t */ uint subBlockCapacity, CMBlockBufferFlags flags, /* CMBlockBufferRef* */ out IntPtr output);
示例#24
0
        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);
        }
示例#25
0
        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));
        }
示例#26
0
        public CMBlockBufferError AppendMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags)
        {
            if (Handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("BlockBuffer");
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            var allocator = new CMManagedArrayBlockAllocator(data);

            return(AppendMemoryBlock(IntPtr.Zero, (uint)data.Length, allocator, offsetToData, (uint)data.Length, flags));
        }
示例#27
0
 public CMBlockBufferError AppendMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags)
 {
     if (data is null)
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(data)); }
示例#28
0
 static extern CMBlockBufferError CMBlockBufferAppendBufferReference(
     /* CMBlockBufferRef */ IntPtr buffer,
     /* CMBlockBufferRef */ IntPtr targetBBuf,
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags);
示例#29
0
        public CMBlockBufferError AppendBuffer(CMBlockBuffer?targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags)
        {
            // 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));
                }
            }

            return(CMBlockBufferAppendBufferReference(GetCheckedHandle(), targetBuffer.GetHandle(), offsetToData, dataLength, flags));
        }
示例#30
0
 public CMBlockBufferError AppendMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags)
 {
     if (Handle == IntPtr.Zero)
     {
         throw new ObjectDisposedException("BlockBuffer");
     }
     if (data == null)
         throw new ArgumentNullException(nameof(data)); }
示例#31
0
 static extern CMBlockBufferError CMBlockBufferAppendMemoryBlock(
     /* CMBlockBufferRef */ IntPtr buffer,
     /* 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);
示例#32
0
 static extern CMBlockBufferError CMBlockBufferCreateContiguous(
     /* CFAllocatorRef */ IntPtr structureAllocator,
     /* CMBlockBufferRef */ IntPtr sourceBuffer,
     /* CFAllocatorRef */ IntPtr blockAllocator,
     /* CMBlockBufferCustomBlockSource */ IntPtr customBlockSource, // Can be null
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags,
     /* CMBlockBufferRef* */ out IntPtr newBlockBuffer);
示例#33
0
 static extern CMBlockBufferError CMBlockBufferCreateEmpty(/* CFAllocatorRef */ IntPtr allocator, /* uint32_t */ uint subBlockCapacity, CMBlockBufferFlags flags, /* CMBlockBufferRef* */ out IntPtr output);
示例#34
0
        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));
        }
示例#35
0
		extern static CMBlockBufferError CMBlockBufferCreateEmpty (IntPtr allocator, uint subBlockCapacity, CMBlockBufferFlags flags, out IntPtr output);