fix(player): keep HDR/Dolby Vision through zoom on iOS and tvOS

Nonzero mpv video-zoom flips vo_avfoundation into a per-frame Core
Image re-render that destroys HDR/DV passthrough - DV frames render
near-black on tvOS (verified on Apple TV 4K, DV P7->8.1 content:
panel luma mean 0.0 zoomed vs 87-103 unzoomed at locked exposure).

Zoom now scales the AVSampleBufferDisplayLayer itself (a
sublayerTransform on the container is ignored by the video plane)
via the existing Player.setVideoZoom seam, and VideoFilterManager
pins the mpv property to 0 on backends with native zoom. The layer
tree at 100% stays identical to before: clipping engages only while
zoomed, and updateFrame sizes the layer via bounds/position, which
frame= decomposes to anyway.

macOS keeps the property path (gpu-next zooms losslessly in-shader);
Android is untouched.
This commit is contained in:
edde746
2026-08-10 14:17:40 +02:00
parent f2ef15806a
commit a0269c6feb
8 changed files with 106 additions and 7 deletions
@@ -91,6 +91,8 @@ class MpvPlayerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, MpvPluginS
handleSetDisplayCriteria(call: call, result: result)
case "setVisible":
handleSetVisible(call: call, result: result)
case "setVideoZoom":
handleSetVideoZoom(call: call, result: result)
case "isInitialized":
result(playerCore?.isInitialized ?? false)
case "updateFrame":
@@ -451,6 +453,17 @@ class MpvPlayerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, MpvPluginS
}
}
private func handleSetVideoZoom(call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let args = call.arguments as? [String: Any],
let scale = doubleValue(args["scale"])
else {
result(FlutterError(code: "INVALID_ARGS", message: "setVideoZoom requires scale", details: nil))
return
}
playerCore?.setVideoZoom(scale)
result(nil)
}
private func int64Value(_ value: Any?) -> Int64? {
switch value {
case let value as Int64: