From 3a3577f826854c0004d374d623aa193a04a18986 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 12 Jul 2018 12:48:39 +1000 Subject: [PATCH] glvideomixer: fix default placement when different sized output i.e. when expanding from 320x240 to 800x600, the resulting frame should appear in the top left corner, not the middle. https://bugzilla.gnome.org/show_bug.cgi?id=794401 --- ext/gl/gstglvideomixer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index fe7915ce7b..ae2397117c 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -461,8 +461,7 @@ static void gst_gl_video_mixer_child_proxy_init (gpointer g_iface, #define gst_gl_video_mixer_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLVideoMixer, gst_gl_video_mixer, GST_TYPE_GL_MIXER, G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY, - gst_gl_video_mixer_child_proxy_init); - DEBUG_INIT); + gst_gl_video_mixer_child_proxy_init); DEBUG_INIT); static void gst_gl_video_mixer_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -1556,12 +1555,14 @@ gst_gl_video_mixer_callback (gpointer stuff) pad->m_matrix[0] = w; pad->m_matrix[5] = h; - pad->m_matrix[12] = (gfloat) pad->xpos / (gfloat) out_width; - pad->m_matrix[13] = (gfloat) pad->ypos / (gfloat) out_height; + pad->m_matrix[12] = + 2. * (gfloat) pad->xpos / (gfloat) out_width - (1. - w); + pad->m_matrix[13] = + 2. * (gfloat) pad->ypos / (gfloat) out_height - (1. - h); GST_TRACE ("processing texture:%u dimensions:%ux%u, at %f,%f %fx%f with " - "alpha:%f", in_tex, in_width, in_height, v_vertices[0], v_vertices[1], - v_vertices[5], v_vertices[11], pad->alpha); + "alpha:%f", in_tex, in_width, in_height, pad->m_matrix[12], + pad->m_matrix[13], pad->m_matrix[0], pad->m_matrix[5], pad->alpha); if (!pad->vertex_buffer) gl->GenBuffers (1, &pad->vertex_buffer);