Fix HDR with external displays on macOS Sonoma

Fixes #1079
This commit is contained in:
Cameron Gutman 2023-10-15 15:30:41 -05:00
parent 0ac765bc32
commit eef270de26

View file

@ -301,7 +301,18 @@ public:
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
break;
case COLORSPACE_REC_2020:
// This is necessary to ensure HDR works properly with external displays on macOS Sonoma.
if (frame->color_trc == AVCOL_TRC_SMPTE2084) {
if (@available(macOS 11.0, *)) {
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2100_PQ);
}
else {
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
}
}
else {
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
}
break;
case COLORSPACE_REC_601:
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);