---
title: "VTFrameSiloCallFunctionForEachSampleBuffer(_:in:refcon:callback:)"
framework: videotoolbox
role: symbol
role_heading: Function
path: "videotoolbox/vtframesilocallfunctionforeachsamplebuffer(_:in:refcon:callback:)"
---

# VTFrameSiloCallFunctionForEachSampleBuffer(_:in:refcon:callback:)

Retrieves sample buffers from a frame silo object.

## Declaration

```swift
func VTFrameSiloCallFunctionForEachSampleBuffer(_ silo: VTFrameSilo, in timeRange: CMTimeRange, refcon: UnsafeMutableRawPointer?, callback: (UnsafeMutableRawPointer?, CMSampleBuffer) -> OSStatus) -> OSStatus
```

## Parameters

- `silo`: The frame silo object.
- `timeRange`: The decode time range of the sample buffers to retrieve. Pass kCMTimeRangeInvalid to retrieve all sample buffers from the VTFrameSilo.
- `refcon`: A reference value.
- `callback`: A function to be called, in decode order, with each sample buffer that was added. To abort iteration early, return a nonzero status. The VTFrameSilo object may write sample buffers and data to the backing file between addition and retrieval; do not expect to get identical object pointers back.

## Return Value

Return Value kVTFrameSiloInvalidTimeRangeErr if any time ranges are non-numeric, overlap, or are not in ascending order. Returns any nonzero status returned by the callback function.

## Discussion

Discussion You call this function to retrieve sample buffers at the end of a multipass compression session.

## See Also

### Configuring Frame Silos

- [VTFrameSiloAddSampleBuffer(_:sampleBuffer:)](videotoolbox/vtframesiloaddsamplebuffer(_:samplebuffer:).md)
- [VTFrameSiloSetTimeRangesForNextPass(_:timeRangeCount:timeRangeArray:)](videotoolbox/vtframesilosettimerangesfornextpass(_:timerangecount:timerangearray:).md)
- [VTFrameSiloCallBlockForEachSampleBuffer(_:in:handler:)](videotoolbox/vtframesilocallblockforeachsamplebuffer(_:in:handler:).md)
