<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaExtension",
  "identifier" : "/documentation/MediaExtension/MESampleCursor/refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MediaExtension"
    ],
    "preciseIdentifier" : "c:objc(pl)MESampleCursor(im)refineSampleLocation:refinementData:refinementDataLength:refinedLocation:error:"
  },
  "title" : "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.

```
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

Use [`estimatedSampleLocation()`](/documentation/MediaExtension/MESampleCursor/estimatedSampleLocation()) to obtain the estimated sample location to pass to this method.

---

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)