-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wayland: add support for content-type protocol #10751
wayland: add support for content-type protocol #10751
Conversation
a8e34a3
to
18a4f6f
Compare
edf88d9
to
d3cdae9
Compare
I've now added a commit that adds a new VOCTRL, |
d3cdae9
to
1d3c504
Compare
I changed it to |
33ed98f
to
bf547ef
Compare
mpv's core already keeps track of whether or not it thinks a track is an image. Some VOs (i.e. wayland) would benefit from knowing if what is currently being displayed is an image or not so add a new VOCTRL that signals this anytime we load a new file with a VO. Additionally, let's add a helper enum for signaling the kind of content that is being displayed. There is now MP_CONTENT_NONE (strictly for force window being used on a track with no image/video), MP_CONTENT_IMAGE, and MP_CONTENT_VIDEO. See the next commit for the actual usage of this (with wayland).
bf547ef
to
15527ae
Compare
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.
15527ae
to
17b9232
Compare
I was finally able to test this in git master of sway and the wayland debug logs look good. |
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. For mpv, we of course send video by default but it is certainly common to view images/photos as well. Additionally, maybe the compositor is bugged in some way and one would like to turn this off. In light of that, a new option has also been added (wayland-content-type) that lets users control what content hint to send to the compositor. For completion's sake, game is also allowed here, but in practice there shouldn't ever be a reason to use that.
Supercedes: #10262