mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
waylandsink: relaxed wl_shell check and added zwp_fullscreen_shell.
Relaxed the wl_shell interface constrains, so application that pass via GstContext the wl_surface can use waylandsink in a compositor without wl_surface and zwp_fullscreen_shell. Added support for zwp_fullscreen_shell. https://bugzilla.gnome.org/show_bug.cgi?id=796772
This commit is contained in:
parent
854baf4fdb
commit
e0535b44d4
5 changed files with 43 additions and 13 deletions
|
@ -4,7 +4,9 @@ BUILT_SOURCES = \
|
||||||
viewporter-protocol.c \
|
viewporter-protocol.c \
|
||||||
viewporter-client-protocol.h \
|
viewporter-client-protocol.h \
|
||||||
linux-dmabuf-unstable-v1-protocol.c \
|
linux-dmabuf-unstable-v1-protocol.c \
|
||||||
linux-dmabuf-unstable-v1-client-protocol.h
|
linux-dmabuf-unstable-v1-client-protocol.h \
|
||||||
|
fullscreen-shell-unstable-v1-protocol.c \
|
||||||
|
fullscreen-shell-unstable-v1-client-protocol.h
|
||||||
|
|
||||||
libgstwaylandsink_la_SOURCES = \
|
libgstwaylandsink_la_SOURCES = \
|
||||||
gstwaylandsink.c \
|
gstwaylandsink.c \
|
||||||
|
@ -17,7 +19,8 @@ libgstwaylandsink_la_SOURCES = \
|
||||||
|
|
||||||
nodist_libgstwaylandsink_la_SOURCES = \
|
nodist_libgstwaylandsink_la_SOURCES = \
|
||||||
viewporter-protocol.c \
|
viewporter-protocol.c \
|
||||||
linux-dmabuf-unstable-v1-protocol.c
|
linux-dmabuf-unstable-v1-protocol.c \
|
||||||
|
fullscreen-shell-unstable-v1-protocol.c
|
||||||
|
|
||||||
libgstwaylandsink_la_CFLAGS = \
|
libgstwaylandsink_la_CFLAGS = \
|
||||||
$(GST_PLUGINS_BAD_CFLAGS) \
|
$(GST_PLUGINS_BAD_CFLAGS) \
|
||||||
|
|
|
@ -14,7 +14,9 @@ if use_wayland
|
||||||
protocol_defs = [
|
protocol_defs = [
|
||||||
['/stable/viewporter/viewporter.xml', 'viewporter-protocol.c', 'viewporter-client-protocol.h'],
|
['/stable/viewporter/viewporter.xml', 'viewporter-protocol.c', 'viewporter-client-protocol.h'],
|
||||||
['/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
['/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
||||||
'linux-dmabuf-unstable-v1-protocol.c', 'linux-dmabuf-unstable-v1-client-protocol.h']
|
'linux-dmabuf-unstable-v1-protocol.c', 'linux-dmabuf-unstable-v1-client-protocol.h'],
|
||||||
|
['/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml',
|
||||||
|
'fullscreen-shell-unstable-v1-protocol.c', 'fullscreen-shell-unstable-v1-client-protocol.h']
|
||||||
]
|
]
|
||||||
protocols_files = []
|
protocols_files = []
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,9 @@ gst_wl_display_finalize (GObject * gobject)
|
||||||
if (self->shell)
|
if (self->shell)
|
||||||
wl_shell_destroy (self->shell);
|
wl_shell_destroy (self->shell);
|
||||||
|
|
||||||
|
if (self->fullscreen_shell)
|
||||||
|
zwp_fullscreen_shell_v1_release (self->fullscreen_shell);
|
||||||
|
|
||||||
if (self->compositor)
|
if (self->compositor)
|
||||||
wl_compositor_destroy (self->compositor);
|
wl_compositor_destroy (self->compositor);
|
||||||
|
|
||||||
|
@ -225,6 +228,9 @@ registry_handle_global (void *data, struct wl_registry *registry,
|
||||||
wl_registry_bind (registry, id, &wl_subcompositor_interface, 1);
|
wl_registry_bind (registry, id, &wl_subcompositor_interface, 1);
|
||||||
} else if (g_strcmp0 (interface, "wl_shell") == 0) {
|
} else if (g_strcmp0 (interface, "wl_shell") == 0) {
|
||||||
self->shell = wl_registry_bind (registry, id, &wl_shell_interface, 1);
|
self->shell = wl_registry_bind (registry, id, &wl_shell_interface, 1);
|
||||||
|
} else if (g_strcmp0 (interface, "zwp_fullscreen_shell_v1") == 0) {
|
||||||
|
self->fullscreen_shell = wl_registry_bind (registry, id,
|
||||||
|
&zwp_fullscreen_shell_v1_interface, 1);
|
||||||
} else if (g_strcmp0 (interface, "wl_shm") == 0) {
|
} else if (g_strcmp0 (interface, "wl_shm") == 0) {
|
||||||
self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1);
|
self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1);
|
||||||
wl_shm_add_listener (self->shm, &shm_listener, self);
|
wl_shm_add_listener (self->shm, &shm_listener, self);
|
||||||
|
@ -336,7 +342,6 @@ gst_wl_display_new_existing (struct wl_display * display,
|
||||||
|
|
||||||
VERIFY_INTERFACE_EXISTS (compositor, "wl_compositor");
|
VERIFY_INTERFACE_EXISTS (compositor, "wl_compositor");
|
||||||
VERIFY_INTERFACE_EXISTS (subcompositor, "wl_subcompositor");
|
VERIFY_INTERFACE_EXISTS (subcompositor, "wl_subcompositor");
|
||||||
VERIFY_INTERFACE_EXISTS (shell, "wl_shell");
|
|
||||||
VERIFY_INTERFACE_EXISTS (shm, "wl_shm");
|
VERIFY_INTERFACE_EXISTS (shm, "wl_shm");
|
||||||
|
|
||||||
#undef VERIFY_INTERFACE_EXISTS
|
#undef VERIFY_INTERFACE_EXISTS
|
||||||
|
@ -353,6 +358,15 @@ gst_wl_display_new_existing (struct wl_display * display,
|
||||||
g_warning ("Could not bind to zwp_linux_dmabuf_v1");
|
g_warning ("Could not bind to zwp_linux_dmabuf_v1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!self->shell && !self->fullscreen_shell) {
|
||||||
|
/* If wl_surface and wl_display are passed via GstContext
|
||||||
|
* wl_shell, zwp_fullscreen_shell are not used.
|
||||||
|
* In this case is correct to continue.
|
||||||
|
*/
|
||||||
|
g_warning ("Could not bind to wl_shell or zwp_fullscreen_shell, video "
|
||||||
|
"display may not work properly.");
|
||||||
|
}
|
||||||
|
|
||||||
self->thread = g_thread_try_new ("GstWlDisplay", gst_wl_display_thread_run,
|
self->thread = g_thread_try_new ("GstWlDisplay", gst_wl_display_thread_run,
|
||||||
self, &err);
|
self, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include "viewporter-client-protocol.h"
|
#include "viewporter-client-protocol.h"
|
||||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||||
|
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ struct _GstWlDisplay
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct wl_subcompositor *subcompositor;
|
struct wl_subcompositor *subcompositor;
|
||||||
struct wl_shell *shell;
|
struct wl_shell *shell;
|
||||||
|
struct zwp_fullscreen_shell_v1 *fullscreen_shell;
|
||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
struct wp_viewporter *viewporter;
|
struct wp_viewporter *viewporter;
|
||||||
struct zwp_linux_dmabuf_v1 *dmabuf;
|
struct zwp_linux_dmabuf_v1 *dmabuf;
|
||||||
|
|
|
@ -172,17 +172,26 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
|
||||||
|
|
||||||
window = gst_wl_window_new_internal (display, render_lock);
|
window = gst_wl_window_new_internal (display, render_lock);
|
||||||
|
|
||||||
/* go toplevel */
|
if (display->shell) {
|
||||||
window->shell_surface = wl_shell_get_shell_surface (display->shell,
|
/* go toplevel */
|
||||||
window->area_surface);
|
window->shell_surface = wl_shell_get_shell_surface (display->shell,
|
||||||
|
window->area_surface);
|
||||||
|
|
||||||
if (window->shell_surface) {
|
if (window->shell_surface) {
|
||||||
wl_shell_surface_add_listener (window->shell_surface,
|
wl_shell_surface_add_listener (window->shell_surface,
|
||||||
&shell_surface_listener, window);
|
&shell_surface_listener, window);
|
||||||
gst_wl_window_ensure_fullscreen (window, fullscreen);
|
gst_wl_window_ensure_fullscreen (window, fullscreen);
|
||||||
|
} else {
|
||||||
|
GST_ERROR ("Unable to get wl_shell_surface");
|
||||||
|
g_object_unref (window);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else if (display->fullscreen_shell) {
|
||||||
|
zwp_fullscreen_shell_v1_present_surface (display->fullscreen_shell,
|
||||||
|
window->area_surface, ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM,
|
||||||
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
GST_ERROR ("Unable to get wl_shell_surface");
|
GST_ERROR ("Unable to use wl_shell or zwp_fullscreen_shell.");
|
||||||
|
|
||||||
g_object_unref (window);
|
g_object_unref (window);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue