From: Matthew Waters Date: Fri, 31 Oct 2014 01:52:50 +0000 (+1100) Subject: glimagesink: resize the viewport correctly on a caps change X-Git-Tag: 1.16.2~955^2~1225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fa95fe809de2919ed65d911d7304b7aa6b1bfb9;p=platform%2Fupstream%2Fgst-plugins-base.git glimagesink: resize the viewport correctly on a caps change with force-aspect-ratio=true, if the width or height changed, the viewport wasn't being updated to respect the new video width and height until a resize occured. --- diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 7d38a53..7367f29 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -806,6 +806,7 @@ gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) glimage_sink->upload = gst_gl_upload_new (glimage_sink->context); gst_gl_upload_set_format (glimage_sink->upload, &vinfo); + glimage_sink->caps_change = TRUE; return TRUE; } @@ -1102,6 +1103,9 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height) g_signal_emit (gl_sink, gst_glimage_sink_signals[CLIENT_RESHAPE_SIGNAL], 0, gl_sink->context, width, height, &do_reshape); + gl_sink->window_width = width; + gl_sink->window_height = height; + /* default reshape */ if (!do_reshape) { if (gl_sink->keep_aspect_ratio) { @@ -1165,6 +1169,14 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink) /* opengl scene */ GST_TRACE ("redrawing texture:%u", gl_sink->redisplay_texture); + if (gl_sink->caps_change) { + GST_GLIMAGE_SINK_UNLOCK (gl_sink); + gst_glimage_sink_on_resize (gl_sink, gl_sink->window_width, + gl_sink->window_height); + GST_GLIMAGE_SINK_LOCK (gl_sink); + gl_sink->caps_change = FALSE; + } + /* make sure that the environnement is clean */ gst_gl_context_clear_shader (gl_sink->context); diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h index c5bc2ec..45d9515 100644 --- a/ext/gl/gstglimagesink.h +++ b/ext/gl/gstglimagesink.h @@ -81,6 +81,10 @@ struct _GstGLImageSink GstBuffer *stored_buffer; GLuint redisplay_texture; + gboolean caps_change; + guint window_width; + guint window_height; + #if GST_GL_HAVE_GLES2 GstGLShader *redisplay_shader; GLint redisplay_attr_position_loc;