Beispiel #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);
		}
Beispiel #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);
Beispiel #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);
Beispiel #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);
Beispiel #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));
        }
Beispiel #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);
Beispiel #8
0
 extern static CMBlockBufferError CMBlockBufferCreateEmpty(IntPtr allocator, uint subBlockCapacity, CMBlockBufferFlags flags, out IntPtr output);
Beispiel #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;
        }
Beispiel #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);
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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));
            }
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #20
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferAppendBufferReference(
     /* CMBlockBufferRef */ IntPtr buffer,
     /* CMBlockBufferRef */ IntPtr targetBBuf,
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags);
Beispiel #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));
            }
        }
Beispiel #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));
        }
Beispiel #23
0
 extern static /* OSStatus */ CMBlockBufferError CMBlockBufferCreateEmpty(/* CFAllocatorRef */ IntPtr allocator, /* uint32_t */ uint subBlockCapacity, CMBlockBufferFlags flags, /* CMBlockBufferRef* */ out IntPtr output);
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #27
0
 public CMBlockBufferError AppendMemoryBlock(byte [] data, nuint offsetToData, CMBlockBufferFlags flags)
 {
     if (data is null)
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(data)); }
Beispiel #28
0
 static extern CMBlockBufferError CMBlockBufferAppendBufferReference(
     /* CMBlockBufferRef */ IntPtr buffer,
     /* CMBlockBufferRef */ IntPtr targetBBuf,
     /* size_t */ nuint offsetToData,
     /* size_t */ nuint dataLength,
     CMBlockBufferFlags flags);
Beispiel #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));
        }
Beispiel #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)); }
Beispiel #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);
Beispiel #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);
Beispiel #33
0
 static extern CMBlockBufferError CMBlockBufferCreateEmpty(/* CFAllocatorRef */ IntPtr allocator, /* uint32_t */ uint subBlockCapacity, CMBlockBufferFlags flags, /* CMBlockBufferRef* */ out IntPtr output);
Beispiel #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));
        }
		extern static CMBlockBufferError CMBlockBufferCreateEmpty (IntPtr allocator, uint subBlockCapacity, CMBlockBufferFlags flags, out IntPtr output);