CMBlockBufferCreateContiguous(allocator:sourceBuffer:blockAllocator:customBlockSource:offsetToData:dataLength:flags:blockBufferOut:)
Creates a block buffer that contains a contiguous copy of, or reference to, the data specified by the parameters.
Declaration
func CMBlockBufferCreateContiguous(allocator structureAllocator: CFAllocator?, sourceBuffer: CMBlockBuffer, blockAllocator: CFAllocator?, customBlockSource: UnsafePointer<CMBlockBufferCustomBlockSource>?, offsetToData: Int, dataLength: Int, flags: CMBlockBufferFlags, blockBufferOut: UnsafeMutablePointer<CMBlockBuffer?>) -> OSStatusParameters
- structureAllocator:
Allocator to use for allocating the
CMBlockBufferobject.NULLwill cause the default allocator to be used. - sourceBuffer:
CMBlockBufferfrom which data will be copied or referenced. Must not beNULLor empty. - blockAllocator:
Allocator to be used for allocating the memory block if a contiguous copy of the data is to be made. Passing
NULLwill cause the default allocator (as set at the time of the call) to be used. - customBlockSource:
If non-
NULL, it will be used for the allocation and freeing of the memory block (theblockAllocatorparameter is ignored). If provided, and the parameterkCMBlockBufferAlwaysCopyDataFlagis set,customBlockSource’sAllocateBlock()routine must be non-NULL. Allocate will be called once, if successful, when the memory block is allocated. Freeblock will be called once when theCMBlockBufferis disposed. - offsetToData:
Offset within the source
CMBlockBufferat which the newCMBlockBuffershould obtain data. - dataLength:
Number of relevant data bytes, starting at
offsetToData, within the sourceCMBlockBuffer. If zero, the target buffer’s total availabledataLength(starting at offsetToData) will be referenced. - flags:
Feature and control flags.
- blockBufferOut:
Receives newly-created
CMBlockBufferobject with a retain count of 1. Must not beNULL.
Return Value
Returns kCMBlockBufferNoErr if successful.
Discussion
Produces a CMBlockBuffer containing a contiguous copy of or reference to the data specified by the parameters. The resulting new CMBlockBuffer may contain an allocated copy of the data, or may contain a contiguous CMBlockBuffer reference. If the kCMBlockBufferAlwaysCopyDataFlag is set in the flags parameter, the resulting CMBlockBuffer will contain an allocated copy of the data rather than a reference to the SourceBuffer.
See Also
Creating a Block Buffer
CMBlockBufferCreateEmpty(allocator:capacity:flags:blockBufferOut:)CMBlockBufferCreateWithMemoryBlock(allocator:memoryBlock:blockLength:blockAllocator:customBlockSource:offsetToData:dataLength:flags:blockBufferOut:)CMBlockBufferCreateWithBufferReference(allocator:referenceBuffer:offsetToData:dataLength:flags:blockBufferOut:)CMBlockBufferFlagsBlock Buffer FlagsCMBlockBufferCustomBlockSourceCustom Block Source Version