summaryrefslogtreecommitdiffstats
path: root/options/options.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-11-15 15:51:45 -0600
committerDudemanguy <random342@airmail.cc>2022-11-15 23:18:55 +0000
commit6623efb14223f8d4ebb0b2b966b21f5953eb56a9 (patch)
treedcb6d74e90e794bcf1ccb3bea5527ca4c0089ccd /options/options.c
parentbab85944df3ae114a4d411fe7b0f243d4d222222 (diff)
downloadmpv-6623efb14223f8d4ebb0b2b966b21f5953eb56a9.tar.bz2
mpv-6623efb14223f8d4ebb0b2b966b21f5953eb56a9.tar.xz
wayland: add support for content-type protocol
The content-type protocol allows mpv to send compositor a hint about the type of content being displayed on its surface so it could potentially make some sort of optimization. Fundamentally, this is pretty simple but since this requires a very new wayland-protocols version (1.27), we have to mess with the build to add a new define and add a bunch of if's in here. The protocol itself exposes 4 different types of content: none, photo, video, and game. To do that, let's add a new option (wayland-content-type) that lets users control what hint to send to the compossitor. Since the previous commit adds a VOCTRL that notifies us about the content being displayed, we can also add an auto value to this option. As you'd expect, the compositor hint would be set to photo if mpv's core detects an image, video for other things, and it is set to none for the special case of forcing a window when there is not a video track. For completion's sake, game is also allowed as a value for this option, but in practice there shouldn't be a reason to use that.
Diffstat (limited to 'options/options.c')
-rw-r--r--options/options.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/options/options.c b/options/options.c
index ad8bde5fc8..8785d78182 100644
--- a/options/options.c
+++ b/options/options.c
@@ -179,6 +179,10 @@ static const m_option_t mp_vo_opt_list[] = {
{"x11-present", OPT_CHOICE(x11_present,
{"no", 0}, {"auto", 1}, {"yes", 2})},
#endif
+#if HAVE_WAYLAND
+ {"wayland-content-type", OPT_CHOICE(content_type, {"auto", -1}, {"none", 0},
+ {"photo", 1}, {"video", 2}, {"game", 3})},
+#endif
#if HAVE_WIN32_DESKTOP
{"vo-mmcss-profile", OPT_STRING(mmcss_profile)},
#endif
@@ -212,6 +216,7 @@ const struct m_sub_options vo_sub_opts = {
.border = 1,
.fit_border = 1,
.appid = "mpv",
+ .content_type = -1,
.WinID = -1,
.window_scale = 1.0,
.x11_bypass_compositor = 2,