glimagesink: Allow resetting render rectangle

As documented, passing -1 to x and/or y should reset the render
rectangle to the window/display size.

https://bugzilla.gnome.org/show_bug.cgi?id=792798
This commit is contained in:
Nicolas Dufresne 2018-01-29 12:57:56 +00:00
parent 3b317ea6c2
commit 17b118c120
2 changed files with 9 additions and 5 deletions

View file

@ -993,11 +993,8 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
g_signal_connect (window, "mouse-event",
G_CALLBACK (gst_glimage_sink_mouse_event_cb), gl_sink);
if (gl_sink->x >= 0 && gl_sink->y >= 0 && gl_sink->width > 0 &&
gl_sink->height > 0) {
gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y,
gl_sink->width, gl_sink->height);
}
if (other_context)
gst_object_unref (other_context);

View file

@ -907,6 +907,13 @@ gst_gl_window_set_render_rectangle (GstGLWindow * window, gint x, gint y,
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
window_class = GST_GL_WINDOW_GET_CLASS (window);
/* When x/y is smaller then reset the render rectangle */
if (x < 0 || y < 0) {
x = y = 0;
width = window->priv->surface_width;
height = window->priv->surface_height;
}
if (x < 0 || y < 0 || width <= 0 || height <= 0)
return FALSE;