From 17b118c12049a80a6d0083798782d78c26a6cf04 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 29 Jan 2018 12:57:56 +0000 Subject: [PATCH] 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 --- ext/gl/gstglimagesink.c | 7 ++----- gst-libs/gst/gl/gstglwindow.c | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 25ade0e11f..39ba1110ce 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -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); - } + 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); diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index 00ccf665e8..0889e6afee 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -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;