mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
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.
This commit is contained in:
parent
b06ca547d6
commit
0fa95fe809
2 changed files with 16 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue