From 665cc2ba21131430fdf86fe9c3847b41181acd47 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 2 Apr 2014 22:43:41 +1100 Subject: [PATCH] gl: fix assignment of temporary variables --- ext/gl/gstglmosaic.c | 94 +++++++++++++++------------------------- ext/gl/gstglvideomixer.c | 28 +++++------- 2 files changed, 45 insertions(+), 77 deletions(-) diff --git a/ext/gl/gstglmosaic.c b/ext/gl/gstglmosaic.c index 040b88c5ac..d5ff754199 100644 --- a/ext/gl/gstglmosaic.c +++ b/ext/gl/gstglmosaic.c @@ -250,7 +250,40 @@ gst_gl_mosaic_callback (gpointer stuff) while (count < mosaic->input_frames->len && count < 6) { GstGLMixerFrameData *frame; - GLfloat *v_vertices; + /* *INDENT-OFF* */ + gfloat v_vertices = { + /* front face */ + 1.0f, 1.0f,-1.0f, 1.0f, 0.0f, + 1.0f,-1.0f,-1.0f, 1.0f, 1.0f, + -1.0f,-1.0f,-1.0f, 0.0f, 1.0f, + -1.0f, 1.0f,-1.0f, 0.0f, 0.0f, + /* right face */ + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, + 1.0f,-1.0f, 1.0f, 0.0f, 0.0f, + 1.0f,-1.0f,-1.0f, 0.0f, 1.0f, + 1.0f, 1.0f,-1.0f, 1.0f, 1.0f, + /* left face */ + -1.0f, 1.0f, 1.0f, 1.0f, 0.0f, + -1.0f, 1.0f,-1.0f, 1.0f, 1.0f, + -1.0f,-1.0f,-1.0f, 0.0f, 1.0f, + -1.0f,-1.0f, 1.0f, 0.0f, 0.0f, + /* top face */ + 1.0f,-1.0f, 1.0f, 1.0f, 0.0f, + -1.0f,-1.0f, 1.0f, 0.0f, 0.0f, + -1.0f,-1.0f,-1.0f, 0.0f, 1.0f, + 1.0f,-1.0f,-1.0f, 1.0f, 1.0f, + /* bottom face */ + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f,-1.0f, 1.0f, 1.0f, + -1.0f, 1.0f,-1.0f, 0.0f, 1.0f, + -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, + /* back face */ + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, + -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, + -1.0f,-1.0f, 1.0f, 0.0f, 1.0f, + 1.0f,-1.0f, 1.0f, 1.0f, 1.0f + }; + /* *INDENT-ON* */ guint in_tex; guint width, height; @@ -268,65 +301,6 @@ gst_gl_mosaic_callback (gpointer stuff) GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, width, height); - /* *INDENT-OFF* */ - v_vertices = (GLfloat[]) { - /* front face */ - 1.0f, 1.0f, -1.0f, - 1.0f, 0.0f, - 1.0f, -1.0f, -1.0f, - 1.0f, 1.0f, - -1.0f, -1.0f, -1.0f, - 0.0f, 1.0f, - -1.0f, 1.0f, -1.0f, - 0.0f, 0.0f, - /* right face */ - 1.0f, 1.0f, 1.0f, - 1.0f, 0.0f, - 1.0f, -1.0f, 1.0f, - 0.0f, 0.0f, - 1.0f, -1.0f, -1.0f, - 0.0f, 1.0f, - 1.0f, 1.0f, -1.0f, - 1.0f, 1.0f, - /* left face */ - -1.0f, 1.0f, 1.0f, - 1.0f, 0.0f, - -1.0f, 1.0f, -1.0f, - 1.0f, 1.0f, - -1.0f, -1.0f, -1.0f, - 0.0f, 1.0f, - -1.0f, -1.0f, 1.0f, - 0.0f, 0.0f, - /* top face */ - 1.0f, -1.0f, 1.0f, - 1.0f, 0.0f, - -1.0f, -1.0f, 1.0f, - 0.0f, 0.0f, - -1.0f, -1.0f, -1.0f, - 0.0f, 1.0f, - 1.0f, -1.0f, -1.0f, - 1.0f, 1.0f, - /* bottom face */ - 1.0f, 1.0f, 1.0f, - 1.0f, 0.0f, - 1.0f, 1.0f, -1.0f, - 1.0f, 1.0f, - -1.0f, 1.0f, -1.0f, - 0.0f, 1.0f, - -1.0f, 1.0f, 1.0f, - 0.0f, 0.0f, - /* back face */ - 1.0f, 1.0f, 1.0f, - 1.0f, 0.0f, - -1.0f, 1.0f, 1.0f, - 0.0f, 0.0f, - -1.0f, -1.0f, 1.0f, - 0.0f, 1.0f, - 1.0f, -1.0f, 1.0f, - 1.0f, 1.0f - }; - /* *INDENT-ON* */ - gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[5 * 4 * count]); diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index d72f83ba7a..1e10bf3be2 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -221,22 +221,30 @@ gst_gl_video_mixer_callback (gpointer stuff) while (count < video_mixer->input_frames->len) { GstGLMixerFrameData *frame; - GLfloat *v_vertices; + /* *INDENT-OFF* */ + gfloat v_vertices = { + /* front face */ + -1.0,-1.0,-1.0f, 0.0f, 0.0f, + 1.0,-1.0,-1.0f, 1.0f, 0.0f, + 1.0, 1.0,-1.0f, 1.0f, 1.0f, + -1.0, 1.0,-1.0f, 0.0f, 1.0f, + }; + /* *INDENT-ON* */ guint in_tex; guint in_width, in_height; gfloat w, h; frame = g_ptr_array_index (video_mixer->input_frames, count); - in_tex = frame->texture; in_width = GST_VIDEO_INFO_WIDTH (&frame->pad->in_info); in_height = GST_VIDEO_INFO_HEIGHT (&frame->pad->in_info); - if (!frame || !in_tex || in_width <= 0 || in_height <= 0) { + if (!frame || !frame->texture || in_width <= 0 || in_height <= 0) { GST_DEBUG ("skipping texture:%u frame:%p width:%u height %u", in_tex, frame, in_width, in_height); count++; continue; } + in_tex = frame->texture; GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, in_width, in_height); @@ -246,20 +254,6 @@ gst_gl_video_mixer_callback (gpointer stuff) GST_TRACE ("processing texture:%u dimensions:%ux%u, %fx%f", in_tex, in_width, in_height, w, h); - /* *INDENT-OFF* */ - v_vertices = (GLfloat[]) { - /* front face */ - -1.0, -1.0, -1.0f, - 0.0f, 0.0f, - 1.0, -1.0, -1.0f, - 1.0f, 0.0f, - 1.0, 1.0, -1.0f, - 1.0f, 1.0f, - -1.0, 1.0, -1.0f, - 0.0f, 1.0f, - }; - /* *INDENT-ON* */ - gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[0]);