Skip to content
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-v1 #10262

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion generated/wayland/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
wl_protocol_dir = wayland['deps'][2].get_variable(pkgconfig: 'pkgdatadir')
wl_protocol_dir = wayland['deps'][2].get_variable(pkgconfig: 'pkgdatadir', internal: 'pkgdatadir')
protocols = [[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'],
[wl_protocol_dir, 'stable/viewporter/viewporter.xml'],
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
[wl_protocol_dir, 'staging/content-type/content-type-v1.xml'],
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml']]
Expand Down
16 changes: 16 additions & 0 deletions video/out/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "win_state.h"

// Generated from wayland-protocols
#include "generated/wayland/content-type-v1.h"
#include "generated/wayland/idle-inhibit-unstable-v1.h"
#include "generated/wayland/linux-dmabuf-unstable-v1.h"
#include "generated/wayland/presentation-time.h"
Expand Down Expand Up @@ -1145,6 +1146,10 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
wl->idle_inhibit_manager = wl_registry_bind(reg, id, &zwp_idle_inhibit_manager_v1_interface, 1);
}

if (!strcmp(interface, wp_content_type_manager_v1_interface.name) && found++) {
wl->content_type_manager = wl_registry_bind(reg, id, &wp_content_type_manager_v1_interface, 1);
}

if (found > 1)
MP_VERBOSE(wl, "Registered for protocol %s\n", interface);
}
Expand Down Expand Up @@ -1898,6 +1903,11 @@ int vo_wayland_init(struct vo *vo)
zxdg_decoration_manager_v1_interface.name);
}

if (wl->content_type_manager) {
wl->content_type = wp_content_type_manager_v1_get_surface_content_type(wl->content_type_manager, wl->surface);
wp_content_type_v1_set_content_type(wl->content_type, WP_CONTENT_TYPE_V1_CONTENT_TYPE_VIDEO);
}

if (!wl->idle_inhibit_manager)
MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
zwp_idle_inhibit_manager_v1_interface.name);
Expand Down Expand Up @@ -2109,6 +2119,12 @@ void vo_wayland_uninit(struct vo *vo)
if (wl->xdg_decoration_manager)
zxdg_decoration_manager_v1_destroy(wl->xdg_decoration_manager);

if (wl->content_type_manager)
wp_content_type_manager_v1_destroy(wl->content_type_manager);

if (wl->content_type)
wp_content_type_v1_destroy(wl->content_type);

if (wl->xdg_toplevel)
xdg_toplevel_destroy(wl->xdg_toplevel);

Expand Down
4 changes: 4 additions & 0 deletions video/out/wayland_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ struct vo_wayland_state {
struct wp_viewport *viewport;
struct wp_viewport *video_viewport;

/* content-type */
struct wp_content_type_manager_v1 *content_type_manager;
struct wp_content_type_v1 *content_type;

/* Input */
struct wl_keyboard *keyboard;
struct wl_pointer *pointer;
Expand Down