---
title: "CMBlockBufferCreateEmpty(allocator:capacity:flags:blockBufferOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmblockbuffercreateempty(allocator:capacity:flags:blockbufferout:)"
---

# CMBlockBufferCreateEmpty(allocator:capacity:flags:blockBufferOut:)

Creates an empty block buffer.

## Declaration

```swift
func CMBlockBufferCreateEmpty(allocator structureAllocator: CFAllocator?, capacity subBlockCapacity: UInt32, flags: CMBlockBufferFlags, blockBufferOut: UnsafeMutablePointer<CMBlockBuffer?>) -> OSStatus
```

## Parameters

- `structureAllocator`: Allocator to use for allocating the CMBlockBuffer object. NULL will cause the default allocator to be used.
- `subBlockCapacity`: Number of sub-blocks the new CMBlockBuffer shall accommodate before expansion occurs. A value of zero means “do the reasonable default”.
- `flags`: Feature and control flags.
- `blockBufferOut`: Receives newly-created empty CMBlockBuffer object with retain count of 1. Must not be NULL.

## Return Value

Return Value Returns kCMBlockBufferNoErr if successful.

## Discussion

Discussion Creates an empty CMBlockBuffer, i.e. one which has no memory block nor reference to a CMBlockBuffer supplying bytes to it. It is ready to be populated using CMBlockBufferAppendMemoryBlock()  and/or CMBlockBufferAppendBufferReference. CMBlockBufferGetDataLength will return zero for an empty CMBlockBuffer and CMBlockBufferGetDataPointer and CMBlockBufferAssureBufferMemory will fail.The memory for the CMBlockBuffer object will be allocated using the given allocator. If NULL is passed for the allocator, the default allocator is used.

## See Also

### Creating a Block Buffer

- [CMBlockBufferCreateWithMemoryBlock(allocator:memoryBlock:blockLength:blockAllocator:customBlockSource:offsetToData:dataLength:flags:blockBufferOut:)](coremedia/cmblockbuffercreatewithmemoryblock(allocator:memoryblock:blocklength:blockallocator:customblocksource:offsettodata:datalength:flags:blockbufferout:).md)
- [CMBlockBufferCreateWithBufferReference(allocator:referenceBuffer:offsetToData:dataLength:flags:blockBufferOut:)](coremedia/cmblockbuffercreatewithbufferreference(allocator:referencebuffer:offsettodata:datalength:flags:blockbufferout:).md)
- [CMBlockBufferCreateContiguous(allocator:sourceBuffer:blockAllocator:customBlockSource:offsetToData:dataLength:flags:blockBufferOut:)](coremedia/cmblockbuffercreatecontiguous(allocator:sourcebuffer:blockallocator:customblocksource:offsettodata:datalength:flags:blockbufferout:).md)
- [CMBlockBufferFlags](coremedia/cmblockbufferflags.md)
- [Block Buffer Flags](coremedia/block-buffer-flags.md)
- [CMBlockBufferCustomBlockSource](coremedia/cmblockbuffercustomblocksource.md)
- [Custom Block Source Version](coremedia/custom-block-source-version.md)
