summaryrefslogtreecommitdiffstats
path: root/osdep/mac
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-04-28 19:21:01 +0200
committerder richter <der.richter@gmx.de>2024-05-05 19:02:50 +0200
commit8a61929eb8e62097cf8ef0764dba233000fd1e5f (patch)
tree6d32a34e7ce5d2cb0c4b02b830823e2d3c093d44 /osdep/mac
parentcb75ecf19f28cfa00ecd348da13bca2550e85963 (diff)
downloadmpv-8a61929eb8e62097cf8ef0764dba233000fd1e5f.tar.bz2
mpv-8a61929eb8e62097cf8ef0764dba233000fd1e5f.tar.xz
cocoa-cb: add support for macOS color space transformation (EDR/HDR)
by default utilises the color space of the screen on which the window is located. if a specific value is defined, it will instead be utilised. depending on the chosen color space the macOS EDR (HDR) support is activated and that OS's transformation (tone mapping) is used. Fixes #7341
Diffstat (limited to 'osdep/mac')
-rw-r--r--osdep/mac/app_bridge.h19
-rw-r--r--osdep/mac/app_bridge.m19
-rw-r--r--osdep/mac/meson.build8
3 files changed, 45 insertions, 1 deletions
diff --git a/osdep/mac/app_bridge.h b/osdep/mac/app_bridge.h
index db03c8ebad..cc77c2f4dd 100644
--- a/osdep/mac/app_bridge.h
+++ b/osdep/mac/app_bridge.h
@@ -35,6 +35,24 @@ enum {
RENDER_TIMER_PRECISE,
};
+enum {
+ MAC_CSP_AUTO = -1,
+ MAC_CSP_DISPLAY_P3,
+ MAC_CSP_DISPLAY_P3_HLG,
+ MAC_CSP_DISPLAY_P3_PQ,
+ MAC_CSP_DISPLAY_P3_LINEAR,
+ MAC_CSP_DCI_P3,
+ MAC_CSP_BT_2020,
+ MAC_CSP_BT_2020_LINEAR,
+ MAC_CSP_BT_2100_HLG,
+ MAC_CSP_BT_2100_PQ,
+ MAC_CSP_BT_709,
+ MAC_CSP_SRGB,
+ MAC_CSP_SRGB_LINEAR,
+ MAC_CSP_RGB_LINEAR,
+ MAC_CSP_ADOBE,
+};
+
struct macos_opts {
int macos_title_bar_appearance;
int macos_title_bar_material;
@@ -46,6 +64,7 @@ struct macos_opts {
int macos_render_timer;
int cocoa_cb_sw_renderer;
bool cocoa_cb_10bit_context;
+ int cocoa_cb_output_csp;
};
void cocoa_init_media_keys(void);
diff --git a/osdep/mac/app_bridge.m b/osdep/mac/app_bridge.m
index bf39efe603..c61ba3b6cb 100644
--- a/osdep/mac/app_bridge.m
+++ b/osdep/mac/app_bridge.m
@@ -55,6 +55,22 @@ const struct m_sub_options macos_conf = {
{"cocoa-cb-sw-renderer", OPT_CHOICE(cocoa_cb_sw_renderer,
{"auto", -1}, {"no", 0}, {"yes", 1})},
{"cocoa-cb-10bit-context", OPT_BOOL(cocoa_cb_10bit_context)},
+ {"cocoa-cb-output-csp", OPT_CHOICE(cocoa_cb_output_csp,
+ {"auto", MAC_CSP_AUTO},
+ {"display-p3", MAC_CSP_DISPLAY_P3},
+ {"display-p3-hlg", MAC_CSP_DISPLAY_P3_HLG},
+ {"display-p3-pq", MAC_CSP_DISPLAY_P3_PQ},
+ {"display-p3-linear", MAC_CSP_DISPLAY_P3_LINEAR},
+ {"dci-p3", MAC_CSP_DCI_P3},
+ {"bt.2020", MAC_CSP_BT_2020},
+ {"bt.2020-linear", MAC_CSP_BT_2020_LINEAR},
+ {"bt.2100-hlg", MAC_CSP_BT_2100_HLG},
+ {"bt.2100-pq", MAC_CSP_BT_2100_PQ},
+ {"bt.709", MAC_CSP_BT_709},
+ {"srgb", MAC_CSP_SRGB},
+ {"srgb-linear", MAC_CSP_SRGB_LINEAR},
+ {"rgb-linear", MAC_CSP_RGB_LINEAR},
+ {"adobe", MAC_CSP_ADOBE})},
{0}
},
.size = sizeof(struct macos_opts),
@@ -63,7 +79,8 @@ const struct m_sub_options macos_conf = {
.macos_fs_animation_duration = -1,
.macos_render_timer = RENDER_TIMER_CALLBACK,
.cocoa_cb_sw_renderer = -1,
- .cocoa_cb_10bit_context = true
+ .cocoa_cb_10bit_context = true,
+ .cocoa_cb_output_csp = MAC_CSP_AUTO,
},
};
diff --git a/osdep/mac/meson.build b/osdep/mac/meson.build
index 8ddbdbaddf..4358173c17 100644
--- a/osdep/mac/meson.build
+++ b/osdep/mac/meson.build
@@ -19,6 +19,14 @@ if get_option('optimization') != '0'
swift_flags += '-O'
endif
+if macos_11_features.allowed()
+ swift_flags += ['-D', 'HAVE_MACOS_11_FEATURES']
+endif
+
+if macos_12_features.allowed()
+ swift_flags += ['-D', 'HAVE_MACOS_12_FEATURES']
+endif
+
if macos_cocoa_cb.allowed()
swift_flags += ['-D', 'HAVE_MACOS_COCOA_CB']
endif