diff --git a/iina/Base.lproj/PrefAdvancedViewController.xib b/iina/Base.lproj/PrefAdvancedViewController.xib index 542752e17db..b80470eafdf 100644 --- a/iina/Base.lproj/PrefAdvancedViewController.xib +++ b/iina/Base.lproj/PrefAdvancedViewController.xib @@ -65,13 +65,13 @@ - + - + - + @@ -89,7 +89,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -246,20 +246,6 @@ - @@ -268,7 +254,6 @@ - @@ -276,8 +261,6 @@ - - @@ -286,11 +269,11 @@ - + diff --git a/iina/Base.lproj/PrefCodecViewController.xib b/iina/Base.lproj/PrefCodecViewController.xib index 372a7de95ba..9dbe12697c9 100644 --- a/iina/Base.lproj/PrefCodecViewController.xib +++ b/iina/Base.lproj/PrefCodecViewController.xib @@ -1,8 +1,8 @@ - + - + @@ -27,11 +27,11 @@ - + - + @@ -39,7 +39,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -131,7 +131,7 @@ - + Switch to a matching refresh rate (if there is any) when the player goes fullscreen. This can eliminate stuttering, and, on some external displays, enable frame interpolation. @@ -149,6 +149,43 @@ + + + + + + + + + + + + + + + Load primaries / trc info from mastering display metadata if available. Unchecking this option effectively disables using Display-P3 colorspace. ( Only for HDR mode ) + + + + @@ -157,18 +194,28 @@ + + + + + + + + + + @@ -178,20 +225,20 @@ - + - + - + - + - + @@ -291,7 +338,7 @@ - + @@ -435,7 +482,7 @@ - + diff --git a/iina/Preference.swift b/iina/Preference.swift index 0a02e460d8d..7887a7598f8 100644 --- a/iina/Preference.swift +++ b/iina/Preference.swift @@ -150,6 +150,8 @@ struct Preference { static let hardwareDecoder = Key("hardwareDecoder") static let forceDedicatedGPU = Key("forceDedicatedGPU") static let matchRefreshRate = Key("matchRefreshRate") + static let loadIccProfile = Key("loadIccProfile") + static let useMasteringDisplayMetadata = Key("useMasteringDisplayMetadata") static let audioThreads = Key("audioThreads") static let audioLanguage = Key("audioLanguage") @@ -260,9 +262,6 @@ struct Preference { /** Use mpv's OSD (bool) */ static let useMpvOsd = Key("useMpvOsd") - /** Disable ICC profile (bool) */ - static let disableIccProfile = Key("disableIccProfile") - /** Log to log folder (bool) */ static let enableLogging = Key("enableLogging") static let logLevel = Key("logLevel") @@ -728,6 +727,8 @@ struct Preference { .hardwareDecoder: HardwareDecoderOption.auto.rawValue, .forceDedicatedGPU: false, .matchRefreshRate: false, + .loadIccProfile: true, + .useMasteringDisplayMetadata: true, .audioThreads: 0, .audioLanguage: "", .maxVolume: 100, @@ -787,7 +788,6 @@ struct Preference { .enableAdvancedSettings: false, .useMpvOsd: false, - .disableIccProfile: false, .enableLogging: false, .logLevel: Logger.Level.debug.rawValue, .displayKeyBindingRawValues: false, diff --git a/iina/VideoView.swift b/iina/VideoView.swift index 5943df42309..668eb83fb00 100644 --- a/iina/VideoView.swift +++ b/iina/VideoView.swift @@ -247,7 +247,7 @@ class VideoView: NSView { } func setICCProfile(_ displayId: UInt32) { - if Preference.bool(for: .enableAdvancedSettings), Preference.bool(for: .disableIccProfile) { + if !Preference.bool(for: .loadIccProfile) { player.mpv.setString(MPVOption.GPURendererOptions.iccProfile, "") } else { typealias ProfileData = (uuid: CFUUID, profileUrl: URL?) @@ -308,15 +308,17 @@ extension VideoView { guard var primaries = mpv.getString(MPVProperty.videoParamsPrimaries), var gamma = mpv.getString(MPVProperty.videoParamsGamma) else { return false } - // Because MPV won't check for mastering display metadata, we have to check it ourselves - // TODO: Supports multi-track video source. Maps MPV `player.info.vid` to FFMPEG `streamIndex` - if primaries == "bt.2020" && !player.info.isNetworkResource && player.info.videoTracks.count == 1 { - if let path = mpv.getString(MPVProperty.path), let colorspaceData = FFmpegController.getColorSpaceMetadata(forFile: path) { - if let _primaries = colorspaceData["primaries"] as? String { - primaries = _primaries - } - if let _gamma = colorspaceData["color-trc"] as? String { - gamma = _gamma + if Preference.bool(for: .useMasteringDisplayMetadata) { + // Because MPV won't check for mastering display metadata, we have to check it ourselves + // TODO: Supports multi-track video source. Maps MPV `player.info.vid` to FFMPEG `streamIndex` + if primaries == "bt.2020" && !player.info.isNetworkResource && player.info.videoTracks.count == 1 { + if let path = mpv.getString(MPVProperty.path), let colorspaceData = FFmpegController.getColorSpaceMetadata(forFile: path) { + if let _primaries = colorspaceData["primaries"] as? String { + primaries = _primaries + } + if let _gamma = colorspaceData["color-trc"] as? String { + gamma = _gamma + } } } } diff --git a/iina/zh-Hans.lproj/PrefAdvancedViewController.strings b/iina/zh-Hans.lproj/PrefAdvancedViewController.strings index 4e7e322cd59..43f4f6084cf 100644 --- a/iina/zh-Hans.lproj/PrefAdvancedViewController.strings +++ b/iina/zh-Hans.lproj/PrefAdvancedViewController.strings @@ -28,5 +28,5 @@ /* Class = "NSButtonCell"; title = "Use config directory:"; ObjectID = "ehL-8Y-G8h"; */ "ehL-8Y-G8h.title" = "使用配置目录:"; -/* Class = "NSButtonCell"; title = "Disable ICC profile"; ObjectID = "I3v-gt-EO9"; */ -"I3v-gt-EO9.title" = "禁用ICC色彩特性文件"; +/* Class = "NSButtonCell"; title = "Use mpv's OSD"; ObjectID = "phK-g9-Vbg"; */ +"phK-g9-Vbg.title" = "使用 mpv 的 OSD"; diff --git a/iina/zh-Hans.lproj/PrefCodecViewController.strings b/iina/zh-Hans.lproj/PrefCodecViewController.strings index f285339e4f2..802a3864ac6 100644 --- a/iina/zh-Hans.lproj/PrefCodecViewController.strings +++ b/iina/zh-Hans.lproj/PrefCodecViewController.strings @@ -51,3 +51,12 @@ /* Class = "NSTextFieldCell"; title = "Preferred language:"; ObjectID = "wjt-O6-KbC"; */ "wjt-O6-KbC.title" = "偏好语言:"; + +/* Class = "NSButtonCell"; title = "Match refresh rate in fullscreen"; ObjectID = "OvP-TR-cOd"; */ +"OvP-TR-cOd.title" = "全屏模式时匹配视频刷新率"; + +/* Class = "NSButtonCell"; title = "Load ICC profile"; ObjectID = "3g4-jW-uJd"; */ +"3g4-jW-uJd.title" = "加载ICC色彩特性文件"; + +/* Class = "NSButtonCell"; title = "Use mastering display metadata"; ObjectID = "bQI-md-h8I"; */ +"bQI-md-h8I.title" = "使用母版显示器元数据";