<!--
{
  "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/CMBlockBufferCopyDataBytes(_:atOffset:dataLength:destination:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMBlockBufferCopyDataBytes"
  },
  "title" : "CMBlockBufferCopyDataBytes(_:atOffset:dataLength:destination:)"
}
-->

# CMBlockBufferCopyDataBytes(_:atOffset:dataLength:destination:)

Copies bytes from a block buffer into a provided memory area.

```
func CMBlockBufferCopyDataBytes(_ theSourceBuffer: CMBlockBuffer, atOffset offsetToData: Int, dataLength: Int, destination: UnsafeMutableRawPointer) -> OSStatus
```

## Parameters

`theSourceBuffer`

The buffer from which data will be copied into the destination.

`offsetToData`

Offset within the source `CMBlockBuffer` at which the copy should begin.

`dataLength`

Number of bytes to copy, starting at `offsetToData`, within the source `CMBlockBuffer`. Must not be zero.

`destination`

Memory into which the data should be copied.

## Return Value

Returns `kCMBlockBufferNoErr` if the copy succeeded, returns an error otherwise.

## Discussion

This function is used to copy bytes out of a `CMBlockBuffer` into a provided piece of memory. It deals with the possibility of the desired range of data being noncontiguous. The function assumes that the memory at the destination is sufficient to hold the data. If `dataLength` bytes of data are not available in the `CMBlockBuffer`, an error is returned and the contents of the destination are undefined.

---

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)