<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMBufferValidationCallback",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@T@CMBufferValidationCallback"
  },
  "title" : "CMBufferValidationCallback"
}
-->

# CMBufferValidationCallback

A type alias for a callback that tests whether a buffer is in a valid state to add to a queue.

```
typealias CMBufferValidationCallback = (CMBufferQueue, CMBuffer, UnsafeMutableRawPointer?) -> OSStatus
```

## Discussion

[`CMBufferQueueEnqueue(_:buffer:)`](/documentation/CoreMedia/CMBufferQueueEnqueue(_:buffer:)) will call this function to validate buffers.

Return `noErr` if the buffer is in a valid state to add.

Return a nonzero error code if the buffer should be rejected; [`CMBufferQueueEnqueue(_:buffer:)`](/documentation/CoreMedia/CMBufferQueueEnqueue(_:buffer:)) will return this error to the caller. If you do not have a more descriptive error code, use `kCMBufferQueueError_InvalidBuffer`.

### Callback Parameters

- buf: The buffer about to be added.
- queue: The queue requesting validation.
- validationRefCon: Contextual data.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)