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
This commit is contained in:
memeka 2017-10-24 17:39:50 +10:30 committed by Matthew Waters
parent 2ace14f613
commit 08ebb8264d
2 changed files with 23 additions and 0 deletions

View file

@ -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)
{

View file

@ -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;
};