[MPlayer-cvslog] r30195 - in trunk/libvo: matrixview.c matrixview.h vo_matrixview.c

diego subversion at mplayerhq.hu
Mon Jan 4 11:24:11 CET 2010


Author: diego
Date: Mon Jan  4 11:24:10 2010
New Revision: 30195

Log:
prettyprinting cosmetics

Modified:
   trunk/libvo/matrixview.c
   trunk/libvo/matrixview.h
   trunk/libvo/vo_matrixview.c

Modified: trunk/libvo/matrixview.c
==============================================================================
--- trunk/libvo/matrixview.c	Mon Jan  4 10:48:14 2010	(r30194)
+++ trunk/libvo/matrixview.c	Mon Jan  4 11:24:10 2010	(r30195)
@@ -30,12 +30,12 @@
 #include "matrixview.h"
 #include "matrixview_font.h"
 
-static float matrix_contrast = 1.5;
+static float matrix_contrast   = 1.5;
 static float matrix_brightness = 1.0;
 
 // Settings for our light.  Try playing with these (or add more lights).
-static float Light_Ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f };
-static float Light_Diffuse[] = { 1.2f, 1.2f, 1.2f, 1.0f };
+static float Light_Ambient[]  = { 0.1f, 0.1f, 0.1f, 1.0f };
+static float Light_Diffuse[]  = { 1.2f, 1.2f, 1.2f, 1.0f };
 static float Light_Position[] = { 2.0f, 2.0f, 0.0f, 1.0f };
 
 static const uint8_t flare[4][4] = {
@@ -134,7 +134,7 @@ static void draw_text(uint8_t *pic)
 
     for (y = _text_y; y > -_text_y; y--) {
         for (x = -_text_x; x < _text_x; x++) {
-            c = text_light[p] - (text[p] >> 1);
+            c  = text_light[p] - (text[p] >> 1);
             c += pic_fade;
             if (c > 255)
                 c = 255;
@@ -167,7 +167,8 @@ static void draw_text(uint8_t *pic)
                 text_depth[p] /= 1.1;
 
             if (text_light[p] > 128 && text_light[p + text_x] < 10)
-                draw_illuminatedchar(text[p] + 1, x, y, text_depth[p] + bump_pic[p]);
+                draw_illuminatedchar(text[p] + 1, x, y,
+                                     text_depth[p] + bump_pic[p]);
 
             p++;
         }
@@ -182,7 +183,7 @@ static void draw_flares(void)
     for (y = _text_y; y > -_text_y; y--) {
         for (x = -_text_x; x < _text_x; x++) {
             if (text_light[p] > 128 && text_light[p + text_x] < 10)
-                 draw_flare(x, y, text_depth[p] + bump_pic[p]);
+                draw_flare(x, y, text_depth[p] + bump_pic[p]);
             p++;
         }
     }
@@ -249,12 +250,14 @@ static void make_text(void)
 
 static void ourBuildTextures(void)
 {
-    TexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, font_texture);
+    TexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
+               font_texture);
     TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
     BindTexture(GL_TEXTURE_2D, 1);
-    TexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, flare);
+    TexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
+               flare);
     TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
@@ -309,7 +312,8 @@ void matrixview_reshape(int w, int h)
 }
 
 
-void matrixview_draw(int w, int h, double currentTime, float frameTime, uint8_t *data)
+void matrixview_draw(int w, int h, double currentTime, float frameTime,
+                     uint8_t *data)
 {
     Enable(GL_BLEND);
     Enable(GL_TEXTURE_2D);

Modified: trunk/libvo/matrixview.h
==============================================================================
--- trunk/libvo/matrixview.h	Mon Jan  4 10:48:14 2010	(r30194)
+++ trunk/libvo/matrixview.h	Mon Jan  4 11:24:10 2010	(r30195)
@@ -2,9 +2,11 @@
 #define MPLAYER_MATRIXVIEW_H
 
 #include <stdint.h>
+
 void matrixview_init (int w, int h);
 void matrixview_reshape (int w, int h);
-void matrixview_draw (int w, int h, double currentTime, float frameTime, uint8_t *data);
+void matrixview_draw (int w, int h, double currentTime, float frameTime,
+                      uint8_t *data);
 void matrixview_matrix_resize(int w, int h);
 void matrixview_contrast_set(float contrast);
 void matrixview_brightness_set(float brightness);

Modified: trunk/libvo/vo_matrixview.c
==============================================================================
--- trunk/libvo/vo_matrixview.c	Mon Jan  4 10:48:14 2010	(r30194)
+++ trunk/libvo/vo_matrixview.c	Mon Jan  4 11:24:10 2010	(r30195)
@@ -37,8 +37,7 @@
 
 #include "matrixview.h"
 
-static const vo_info_t info =
-{
+static const vo_info_t info = {
     "MatrixView (OpenGL)",
     "matrixview",
     "Pigeon <pigeon at pigeond.net>",
@@ -88,7 +87,8 @@ static void contrast_set(int value)
 {
     float contrast = value * CONTRAST_MULTIPLIER + DEFAULT_CONTRAST;
     eq_contrast = value;
-    if (contrast < 0) contrast = 0;
+    if (contrast < 0)
+         contrast = 0;
     matrixview_contrast_set(contrast);
 }
 
@@ -97,54 +97,56 @@ static void brightness_set(int value)
 {
     float brightness = value * BRIGHTNESS_MULTIPLIER + DEFAULT_BRIGHTNESS;
     eq_brightness = value;
-    if (brightness < 0) brightness = 0;
+    if (brightness < 0)
+        brightness = 0;
     matrixview_brightness_set(brightness);
 }
 
 
-static int
-config(uint32_t width, uint32_t height,
-        uint32_t d_width, uint32_t d_height,
-        uint32_t flags, char *title, uint32_t format)
+static int config(uint32_t width, uint32_t height,
+                  uint32_t d_width, uint32_t d_height,
+                  uint32_t flags, char *title, uint32_t format)
 {
     image_height = height;
-    image_width = width;
+    image_width  = width;
     image_format = format;
 
     int_pause = 0;
 
 #ifdef CONFIG_GL_WIN32
-  if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
-    return -1;
+    if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
+        return -1;
 #endif
 #ifdef CONFIG_GL_X11
-  if (glctx.type == GLTYPE_X11) {
-    XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
-    if (vinfo == NULL)
-    {
-      mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] no GLX support present\n");
-      return -1;
-    }
-    mp_msg(MSGT_VO, MSGL_V, "[matrixview] GLX chose visual with ID 0x%x\n", (int)vinfo->visualid);
+    if (glctx.type == GLTYPE_X11) {
+        XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
+        if (vinfo == NULL) {
+            mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] no GLX support present\n");
+            return -1;
+        }
+        mp_msg(MSGT_VO, MSGL_V, "[matrixview] GLX chose visual with ID 0x%x\n",
+               (int)vinfo->visualid);
 
-    vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags,
-            XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone),
-            "matrixview", title);
-  }
+        vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags,
+                                XCreateColormap(mDisplay, mRootWin,
+                                                vinfo->visual, AllocNone),
+                                "matrixview", title);
+    }
 #endif /* CONFIG_GL_WIN32 */
     if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
         return -1;
 
-    if(sws)
+    if (sws)
         sws_freeContext(sws);
 
-    sws = sws_getContextFromCmdLine(image_width, image_height, image_format, matrix_cols, matrix_rows, IMGFMT_Y8);
+    sws = sws_getContextFromCmdLine(image_width, image_height, image_format,
+                                    matrix_cols, matrix_rows, IMGFMT_Y8);
     if (!sws) {
         mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] Cannot create SwsContext context\n");
         return -1;
     }
 
-    if(!map_image[0])
+    if (!map_image[0])
         map_image[0] = calloc(matrix_cols, matrix_rows);
 
     map_stride[0] = matrix_cols;
@@ -161,11 +163,12 @@ config(uint32_t width, uint32_t height,
 
 static void check_events(void)
 {
-    int e=glctx.check_events();
-    if(e & VO_EVENT_RESIZE) {
+    int e = glctx.check_events();
+    if (e & VO_EVENT_RESIZE) {
         matrixview_reshape(vo_dwidth, vo_dheight);
     }
-    if(e & VO_EVENT_EXPOSE && int_pause) flip_page();
+    if (e & VO_EVENT_EXPOSE && int_pause)
+        flip_page();
 }
 
 
@@ -200,18 +203,18 @@ static int query_format(uint32_t format)
 {
     int caps = VFCAP_CSP_SUPPORTED | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;
 
-    switch(format) {
-        case IMGFMT_YV12:
-        case IMGFMT_BGR32:
-        case IMGFMT_BGR24:
-        case IMGFMT_BGR16:
-        case IMGFMT_BGR15:
-        case IMGFMT_RGB32:
-        case IMGFMT_RGB24:
-        case IMGFMT_ARGB:
-            return caps;
-        default:
-            break;
+    switch (format) {
+    case IMGFMT_YV12:
+    case IMGFMT_BGR32:
+    case IMGFMT_BGR24:
+    case IMGFMT_BGR16:
+    case IMGFMT_BGR15:
+    case IMGFMT_RGB32:
+    case IMGFMT_RGB24:
+    case IMGFMT_ARGB:
+        return caps;
+    default:
+        break;
     }
 
     return 0;
@@ -220,7 +223,8 @@ static int query_format(uint32_t format)
 
 static void uninit(void)
 {
-    if (!vo_config_count) return;
+    if (!vo_config_count)
+        return;
     uninit_mpglcontext(&glctx);
     free(map_image[0]);
     map_image[0] = NULL;
@@ -231,8 +235,8 @@ static void uninit(void)
 
 static const opt_t subopts[] =
 {
-    { "rows",       OPT_ARG_INT, &matrix_rows, int_pos },
-    { "cols",       OPT_ARG_INT, &matrix_cols, int_pos },
+    { "rows", OPT_ARG_INT, &matrix_rows, int_pos },
+    { "cols", OPT_ARG_INT, &matrix_cols, int_pos },
     { NULL }
 };
 
@@ -243,12 +247,13 @@ static int preinit(const char *arg)
 #ifdef CONFIG_GL_WIN32
     gltype = GLTYPE_W32;
 #endif
-    if(!init_mpglcontext(&glctx, gltype)) return -1;
+    if (!init_mpglcontext(&glctx, gltype))
+        return -1;
 
     matrix_rows = DEFAULT_MATRIX_ROWS;
     matrix_cols = DEFAULT_MATRIX_COLS;
 
-    if(subopt_parse(arg, subopts) != 0) {
+    if (subopt_parse(arg, subopts) != 0) {
         mp_msg(MSGT_VO, MSGL_FATAL,
                 "\n-vo matrixview command line help:\n"
                 "Example: mplayer -vo matrixview:cols=320:rows=240\n"
@@ -297,12 +302,9 @@ static int control(uint32_t request, voi
             va_start(va, data);
             value = va_arg(va, int *);
             va_end(va);
-            if (strcasecmp(data, "contrast") == 0)
-            {
+            if (strcasecmp(data, "contrast") == 0) {
                 *value = eq_contrast;
-            }
-            else if (strcasecmp(data, "brightness") == 0)
-            {
+            } else if (strcasecmp(data, "brightness") == 0) {
                 *value = eq_brightness;
             }
         }
@@ -314,12 +316,9 @@ static int control(uint32_t request, voi
             va_start(va, data);
             value = va_arg(va, int);
             va_end(va);
-            if (strcasecmp(data, "contrast") == 0)
-            {
+            if (strcasecmp(data, "contrast") == 0) {
                 contrast_set(value);
-            }
-            else if (strcasecmp(data, "brightness") == 0)
-            {
+            } else if (strcasecmp(data, "brightness") == 0) {
                 brightness_set(value);
             }
         }


More information about the MPlayer-cvslog mailing list