---
title: "CMBufferQueueCreate(allocator:capacity:callbacks:queueOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmbufferqueuecreate(allocator:capacity:callbacks:queueout:)"
---

# CMBufferQueueCreate(allocator:capacity:callbacks:queueOut:)

Creates a buffer queue with callbacks to inspect buffers.

## Declaration

```swift
func CMBufferQueueCreate(allocator: CFAllocator?, capacity: CMItemCount, callbacks: UnsafePointer<CMBufferCallbacks>, queueOut: UnsafeMutablePointer<CMBufferQueue?>) -> OSStatus
```

## Parameters

- `allocator`: The allocator to use for allocating the CMBufferQueue object. Pass kCFAllocatorDefault to use the default allocator.
- `capacity`: Maximum number of buffers in the queue. Pass 0 to create a queue that will grow as needed.
- `callbacks`: Callbacks the queue should use to interrogate the buffer objects. This struct is copied internally, so the client can pass a pointer to a temporary struct on the stack.
- `queueOut`: On Output, the newly created CMBufferQueue.

## Return Value

Return Value A result code.

## Discussion

Discussion On return, the caller owns the returned CMBufferQueue, and must release it when done with it.

## See Also

### Creating a Queue

- [CMBufferQueueCreateWithHandlers(_:_:_:_:)](coremedia/cmbufferqueuecreatewithhandlers(_:_:_:_:).md)
- [CMBufferCallbacks](coremedia/cmbuffercallbacks.md)
