diff options
author | Matthew Waters <matthew@centricular.com> | 2014-10-31 12:52:50 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2014-11-05 20:19:44 +1100 |
commit | 5db9ebd7947ffb850c552dff315dc03d5416bf64 (patch) | |
tree | f5bfcc8a38d66cd0068c7cea36e37ea25aa95889 | |
parent | 01cf9c02c9ec59566382e4c78158a80264cbe573 (diff) | |
download | gstreamer-plugins-bad-5db9ebd7947ffb850c552dff315dc03d5416bf64.tar.gz |
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.
-rw-r--r-- | ext/gl/gstglimagesink.c | 12 | ||||
-rw-r--r-- | ext/gl/gstglimagesink.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 41409a96b..c7e9a7bc3 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -734,6 +734,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; } @@ -1025,6 +1026,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, 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) { @@ -1088,6 +1092,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 efa557be5..25e6a13b7 100644 --- a/ext/gl/gstglimagesink.h +++ b/ext/gl/gstglimagesink.h @@ -78,6 +78,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; |