| From 08ebb8264debb3b03d31a3a66ad61c0ac3e23812 Mon Sep 17 00:00:00 2001 |
| From: memeka <mihailescu2m@gmail.com> |
| Date: Tue, 24 Oct 2017 17:39:50 +1030 |
| Subject: [PATCH] gl/wayland: add preferred window size, and set it according |
| to video size |
| |
| The glimagesink wayland backend lacks the implementation of |
| gst_gl_window_wayland_egl_set_preferred_size. Because of this, glimagesink windows on |
| wayland are created with a fixed window size of 320x240. |
| |
| [Matthew Waters]: gst-indent sources |
| |
| https://bugzilla.gnome.org/show_bug.cgi?id=789384 |
| --- |
| .../gst/gl/wayland/gstglwindow_wayland_egl.c | 22 +++++++++++++++++++ |
| .../gst/gl/wayland/gstglwindow_wayland_egl.h | 1 + |
| 2 files changed, 23 insertions(+) |
| |
| diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c |
| index 385281869f..beac6f7ead 100644 |
| --- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c |
| +++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c |
| @@ -57,6 +57,8 @@ static gboolean gst_gl_window_wayland_egl_open (GstGLWindow * window, |
| static guintptr gst_gl_window_wayland_egl_get_display (GstGLWindow * window); |
| static gboolean gst_gl_window_wayland_egl_set_render_rectangle (GstGLWindow * |
| window, gint x, gint y, gint width, gint height); |
| +static void gst_gl_window_wayland_egl_set_preferred_size (GstGLWindow * window, |
| + gint width, gint height); |
| |
| #if 0 |
| static void |
| @@ -306,12 +308,16 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl) |
| |
| if (window_egl->window.window_width > 0) |
| width = window_egl->window.window_width; |
| + else if (window_egl->window.preferred_width > 0) |
| + width = window_egl->window.preferred_width; |
| else |
| width = 320; |
| window_egl->window.window_width = width; |
| |
| if (window_egl->window.window_height > 0) |
| height = window_egl->window.window_height; |
| + else if (window_egl->window.preferred_height > 0) |
| + height = window_egl->window.preferred_height; |
| else |
| height = 240; |
| window_egl->window.window_height = height; |
| @@ -344,6 +350,8 @@ gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass) |
| GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_display); |
| window_class->set_render_rectangle = |
| GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_set_render_rectangle); |
| + window_class->set_preferred_size = |
| + GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_set_preferred_size); |
| } |
| |
| static void |
| @@ -584,6 +592,20 @@ gst_gl_window_wayland_egl_set_render_rectangle (GstGLWindow * window, |
| return TRUE; |
| } |
| |
| +static void |
| +gst_gl_window_wayland_egl_set_preferred_size (GstGLWindow * window, gint width, |
| + gint height) |
| +{ |
| + GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window); |
| + |
| + window_egl->window.preferred_width = width; |
| + window_egl->window.preferred_height = height; |
| + if (window_egl->window.window_height != height |
| + || window_egl->window.window_width != width) { |
| + window_resize (window_egl, width, height); |
| + } |
| +} |
| + |
| static guintptr |
| gst_gl_window_wayland_egl_get_display (GstGLWindow * window) |
| { |
| diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h |
| index 07c7ad1b95..09858e8298 100644 |
| --- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h |
| +++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h |
| @@ -72,6 +72,7 @@ struct window { |
| struct wl_callback *callback; |
| int fullscreen, configured; |
| int window_width, window_height; |
| + int preferred_width, preferred_height; |
| int window_x, window_y; |
| }; |
| |
| -- |
| 2.26.2 |