gl: fix assignment of temporary variables
authorMatthew Waters <ystreet00@gmail.com>
Wed, 2 Apr 2014 11:43:41 +0000 (22:43 +1100)
committerMatthew Waters <ystreet00@gmail.com>
Wed, 2 Apr 2014 11:43:41 +0000 (22:43 +1100)
ext/gl/gstglmosaic.c
ext/gl/gstglvideomixer.c

index 040b88c..d5ff754 100644 (file)
@@ -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]);
 
index d72f83b..1e10bf3 100644 (file)
@@ -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]);