mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
gl/wayland: correctly use the set_render_rectangle size first
https://bugzilla.gnome.org/show_bug.cgi?id=789384
This commit is contained in:
parent
08ebb8264d
commit
090bbd0721
2 changed files with 23 additions and 5 deletions
|
@ -306,7 +306,16 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_egl->window.window_width > 0)
|
/*
|
||||||
|
* render_rect is the application requested size so choose that first if
|
||||||
|
* available.
|
||||||
|
* Else choose the already chosen size if set
|
||||||
|
* Else choose the preferred size if set
|
||||||
|
* Else choose a default value
|
||||||
|
*/
|
||||||
|
if (window_egl->window.render_rect.w > 0)
|
||||||
|
width = window_egl->window.render_rect.w;
|
||||||
|
else if (window_egl->window.window_width > 0)
|
||||||
width = window_egl->window.window_width;
|
width = window_egl->window.window_width;
|
||||||
else if (window_egl->window.preferred_width > 0)
|
else if (window_egl->window.preferred_width > 0)
|
||||||
width = window_egl->window.preferred_width;
|
width = window_egl->window.preferred_width;
|
||||||
|
@ -314,7 +323,9 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
|
||||||
width = 320;
|
width = 320;
|
||||||
window_egl->window.window_width = width;
|
window_egl->window.window_width = width;
|
||||||
|
|
||||||
if (window_egl->window.window_height > 0)
|
if (window_egl->window.render_rect.h > 0)
|
||||||
|
height = window_egl->window.render_rect.h;
|
||||||
|
else if (window_egl->window.window_height > 0)
|
||||||
height = window_egl->window.window_height;
|
height = window_egl->window.window_height;
|
||||||
else if (window_egl->window.preferred_height > 0)
|
else if (window_egl->window.preferred_height > 0)
|
||||||
height = window_egl->window.preferred_height;
|
height = window_egl->window.preferred_height;
|
||||||
|
@ -357,6 +368,7 @@ gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
|
||||||
static void
|
static void
|
||||||
gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
|
gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
|
||||||
{
|
{
|
||||||
|
window->window.render_rect.w = window->window.render_rect.h = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
|
@ -569,6 +581,8 @@ _set_render_rectangle (gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
window_resize (render->window_egl, render->rect.w, render->rect.h);
|
window_resize (render->window_egl, render->rect.w, render->rect.h);
|
||||||
|
|
||||||
|
render->window_egl->window.render_rect = render->rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -600,11 +614,14 @@ gst_gl_window_wayland_egl_set_preferred_size (GstGLWindow * window, gint width,
|
||||||
|
|
||||||
window_egl->window.preferred_width = width;
|
window_egl->window.preferred_width = width;
|
||||||
window_egl->window.preferred_height = height;
|
window_egl->window.preferred_height = height;
|
||||||
|
if (window_egl->window.render_rect.w < 0
|
||||||
|
&& window_egl->window.render_rect.h < 0) {
|
||||||
if (window_egl->window.window_height != height
|
if (window_egl->window.window_height != height
|
||||||
|| window_egl->window.window_width != width) {
|
|| window_egl->window.window_width != width) {
|
||||||
window_resize (window_egl, width, height);
|
window_resize (window_egl, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static guintptr
|
static guintptr
|
||||||
gst_gl_window_wayland_egl_get_display (GstGLWindow * window)
|
gst_gl_window_wayland_egl_get_display (GstGLWindow * window)
|
||||||
|
|
|
@ -74,6 +74,7 @@ struct window {
|
||||||
int window_width, window_height;
|
int window_width, window_height;
|
||||||
int preferred_width, preferred_height;
|
int preferred_width, preferred_height;
|
||||||
int window_x, window_y;
|
int window_x, window_y;
|
||||||
|
GstVideoRectangle render_rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstGLWindowWaylandEGL {
|
struct _GstGLWindowWaylandEGL {
|
||||||
|
|
Loading…
Reference in a new issue