---
title: "refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)"
framework: MediaExtension
role: symbol
role_heading: Instance Method
platforms: [macOS 14.0+]
path: "mediaextension/mesamplecursor/refinesamplelocation(_:refinementdata:refinementdatalength:refinedlocation:)"
---

# refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)

Produces an exact sample location based on the estimated sample location and refinement data that you specify.

## Declaration

```swift
optional func refineSampleLocation(_ estimatedSampleLocation: AVSampleCursorStorageRange, refinementData: UnsafePointer<UInt8>, refinementDataLength: Int, refinedLocation refinedLocationOut: UnsafeMutablePointer<AVSampleCursorStorageRange>) throws
```

## Parameters

- `estimatedSampleLocation`: The estimated sample location.
- `refinementData`: The refinement data.
- `refinementDataLength`: The length of the refinement data in bytes.
- `refinedLocationOut`: The starting file offset and size of the sample in bytes.

## Discussion

Discussion Use estimatedSampleLocation() to obtain the estimated sample location to pass to this method.

## See Also

### Stepping through samples

- [samplesWithEarlierDTSsMayHaveLaterPTSs(than:)](mediaextension/mesamplecursor/sampleswithearlierdtssmayhavelaterptss(than:).md)
- [samplesWithLaterDTSsMayHaveEarlierPTSs(than:)](mediaextension/mesamplecursor/sampleswithlaterdtssmayhaveearlierptss(than:).md)
- [estimatedSampleLocation()](mediaextension/mesamplecursor/estimatedsamplelocation().md)
- [stepByDecodeTime(_:completionHandler:)](mediaextension/mesamplecursor/stepbydecodetime(_:completionhandler:).md)
- [stepByPresentationTime(_:completionHandler:)](mediaextension/mesamplecursor/stepbypresentationtime(_:completionhandler:).md)
- [stepInDecodeOrder(by:completionHandler:)](mediaextension/mesamplecursor/stepindecodeorder(by:completionhandler:).md)
- [stepInPresentationOrder(by:completionHandler:)](mediaextension/mesamplecursor/stepinpresentationorder(by:completionhandler:).md)
