Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
HDR: Fix #15
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Feb 21, 2022
1 parent b6df068 commit 79e6eb2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions iina/VideoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class VideoView: NSView {

var pendingRedrawAfterEnteringPIP = false;

lazy var hdrSubsystem = Logger.Subsystem(rawValue: "hdr")

// MARK: - Attributes

override var mouseDownCanMoveWindow: Bool {
Expand Down Expand Up @@ -287,7 +289,7 @@ extension VideoView {
guard mpv.getDouble(MPVProperty.videoParamsSigPeak) > 1.0 else { return false } // SDR content

guard (window?.screen?.maximumPotentialExtendedDynamicRangeColorComponentValue ?? 1.0) > 1.0 else {
Logger.log("HDR: HDR video was found but the display does not support EDR mode");
Logger.log("HDR video was found but the display does not support EDR mode", level: .debug, subsystem: hdrSubsystem);
return false;
}

Expand Down Expand Up @@ -343,13 +345,13 @@ extension VideoView {
}

default:
Logger.log("HDR: Unknown HDR color space information gamma=\(gamma) primaries=\(primaries)");
Logger.log("Unknown HDR color space information gamma=\(gamma) primaries=\(primaries)", level: .debug, subsystem: hdrSubsystem);
return false;
}

if (!player.info.hdrEnabled) { return nil }

Logger.log("HDR: Will activate HDR color space instead of using ICC profile");
Logger.log("Will activate HDR color space instead of using ICC profile", level: .debug, subsystem: hdrSubsystem);

videoLayer.colorspace = CGColorSpace(name: name!)
player.mpv.setString(MPVOption.GPURendererOptions.iccProfile, "")
Expand Down

0 comments on commit 79e6eb2

Please sign in to comment.