<!--
{
  "availability" : [
    "iOS: 12.2.0 -",
    "iPadOS: 12.2.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.4 -",
    "tvOS: 12.2.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler(_:_:_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler"
  },
  "title" : "CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler(_:_:_:_:_:_:_:)"
}
-->

# CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler(_:_:_:_:_:_:_:)

Creates a sample buffer with an image buffer and a handler to make the data ready for use.

```
func CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler(_ allocator: CFAllocator?, _ imageBuffer: CVImageBuffer, _ dataReady: Bool, _ formatDescription: CMVideoFormatDescription, _ sampleTiming: UnsafePointer<CMSampleTimingInfo>, _ sampleBufferOut: UnsafeMutablePointer<CMSampleBuffer?>, _ makeDataReadyHandler: CMSampleBufferMakeDataReadyHandler?) -> OSStatus
```

## Parameters

`allocator`

The allocator to use to create a sample buffer object. Pass <doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault> to use the default allocator.

`imageBuffer`

An image buffer that contains the media data. Must not be `NULL`.

`dataReady`

A Boolean value that indicates whether the buffer already contains the data.

`formatDescription`

A description of the media data’s format. Must not be `NULL`.

`sampleTiming`

A [`CMSampleTimingInfo`](/documentation/CoreMedia/CMSampleTimingInfo) structure that provides the timing information for the media contained in `imageBuffer`.

`sampleBufferOut`

On return, a new [`CMSampleBuffer`](/documentation/CoreMedia/CMSampleBuffer) object.

`makeDataReadyHandler`

A block for the system to call to make the data ready for use. This argument can be `NULL`.

## Topics

### Handlers

[`CMSampleBufferMakeDataReadyHandler`](/documentation/CoreMedia/CMSampleBufferMakeDataReadyHandler)

A block the system calls to make the sample buffer ready for use.



---

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)