---
title: "CMBlockBufferGetDataLength(_:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmblockbuffergetdatalength(_:)"
---

# CMBlockBufferGetDataLength(_:)

Returns the total length of data that’s accessible by a block buffer.

## Declaration

```swift
func CMBlockBufferGetDataLength(_ theBuffer: CMBlockBuffer) -> Int
```

## Parameters

- `theBuffer`: CMBlockBuffer to examine.

## Return Value

Return Value Returns the total data length available via this CMBlockBuffer, or zero if it is empty, NULL if invalid.

## Discussion

Discussion Obtains the total data length reachable via a CMBlockBuffer. This total is the sum of the dataLengths of the CMBlockBuffer's memoryBlocks and buffer references. Note that the dataLengths are the portions of those constituents that this CMBlockBuffer subscribes to. This CMBlockBuffer presents a contiguous range of offsets from zero to its totalDataLength as returned by this routine.

## See Also

### Inspecting a Block Buffer

- [CMBlockBufferGetDataPointer(_:atOffset:lengthAtOffsetOut:totalLengthOut:dataPointerOut:)](coremedia/cmblockbuffergetdatapointer(_:atoffset:lengthatoffsetout:totallengthout:datapointerout:).md)
- [CMBlockBufferIsRangeContiguous(_:atOffset:length:)](coremedia/cmblockbufferisrangecontiguous(_:atoffset:length:).md)
- [CMBlockBufferIsEmpty(_:)](coremedia/cmblockbufferisempty(_:).md)
