test/testoverlay2.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/test/testoverlay2.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/test/testoverlay2.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -127,10 +127,10 @@
     1.4  
     1.5  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     1.6  static void
     1.7 -quit (int rc)
     1.8 +quit(int rc)
     1.9  {
    1.10 -    SDL_Quit ();
    1.11 -    exit (rc);
    1.12 +    SDL_Quit();
    1.13 +    exit(rc);
    1.14  }
    1.15  
    1.16  /* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */
    1.17 @@ -140,7 +140,7 @@
    1.18  */
    1.19  
    1.20  void
    1.21 -RGBtoYUV (Uint8 * rgb, int *yuv, int monochrome, int luminance)
    1.22 +RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance)
    1.23  {
    1.24      if (monochrome) {
    1.25  #if 1                           /* these are the two formulas that I found on the FourCC site... */
    1.26 @@ -172,15 +172,15 @@
    1.27  }
    1.28  
    1.29  void
    1.30 -ConvertRGBtoYV12 (SDL_Surface * s, SDL_Overlay * o, int monochrome,
    1.31 -                  int luminance)
    1.32 +ConvertRGBtoYV12(SDL_Surface * s, SDL_Overlay * o, int monochrome,
    1.33 +                 int luminance)
    1.34  {
    1.35      int x, y;
    1.36      int yuv[3];
    1.37      Uint8 *p, *op[3];
    1.38  
    1.39 -    SDL_LockSurface (s);
    1.40 -    SDL_LockYUVOverlay (o);
    1.41 +    SDL_LockSurface(s);
    1.42 +    SDL_LockYUVOverlay(o);
    1.43  
    1.44      /* Convert */
    1.45      for (y = 0; y < s->h && y < o->h; y++) {
    1.46 @@ -189,7 +189,7 @@
    1.47          op[1] = o->pixels[1] + o->pitches[1] * (y / 2);
    1.48          op[2] = o->pixels[2] + o->pitches[2] * (y / 2);
    1.49          for (x = 0; x < s->w && x < o->w; x++) {
    1.50 -            RGBtoYUV (p, yuv, monochrome, luminance);
    1.51 +            RGBtoYUV(p, yuv, monochrome, luminance);
    1.52              *(op[0]++) = yuv[0];
    1.53              if (x % 2 == 0 && y % 2 == 0) {
    1.54                  *(op[1]++) = yuv[2];
    1.55 @@ -199,20 +199,20 @@
    1.56          }
    1.57      }
    1.58  
    1.59 -    SDL_UnlockYUVOverlay (o);
    1.60 -    SDL_UnlockSurface (s);
    1.61 +    SDL_UnlockYUVOverlay(o);
    1.62 +    SDL_UnlockSurface(s);
    1.63  }
    1.64  
    1.65  void
    1.66 -ConvertRGBtoIYUV (SDL_Surface * s, SDL_Overlay * o, int monochrome,
    1.67 -                  int luminance)
    1.68 +ConvertRGBtoIYUV(SDL_Surface * s, SDL_Overlay * o, int monochrome,
    1.69 +                 int luminance)
    1.70  {
    1.71      int x, y;
    1.72      int yuv[3];
    1.73      Uint8 *p, *op[3];
    1.74  
    1.75 -    SDL_LockSurface (s);
    1.76 -    SDL_LockYUVOverlay (o);
    1.77 +    SDL_LockSurface(s);
    1.78 +    SDL_LockYUVOverlay(o);
    1.79  
    1.80      /* Convert */
    1.81      for (y = 0; y < s->h && y < o->h; y++) {
    1.82 @@ -221,7 +221,7 @@
    1.83          op[1] = o->pixels[1] + o->pitches[1] * (y / 2);
    1.84          op[2] = o->pixels[2] + o->pitches[2] * (y / 2);
    1.85          for (x = 0; x < s->w && x < o->w; x++) {
    1.86 -            RGBtoYUV (p, yuv, monochrome, luminance);
    1.87 +            RGBtoYUV(p, yuv, monochrome, luminance);
    1.88              *(op[0]++) = yuv[0];
    1.89              if (x % 2 == 0 && y % 2 == 0) {
    1.90                  *(op[1]++) = yuv[1];
    1.91 @@ -231,26 +231,26 @@
    1.92          }
    1.93      }
    1.94  
    1.95 -    SDL_UnlockYUVOverlay (o);
    1.96 -    SDL_UnlockSurface (s);
    1.97 +    SDL_UnlockYUVOverlay(o);
    1.98 +    SDL_UnlockSurface(s);
    1.99  }
   1.100  
   1.101  void
   1.102 -ConvertRGBtoUYVY (SDL_Surface * s, SDL_Overlay * o, int monochrome,
   1.103 -                  int luminance)
   1.104 +ConvertRGBtoUYVY(SDL_Surface * s, SDL_Overlay * o, int monochrome,
   1.105 +                 int luminance)
   1.106  {
   1.107      int x, y;
   1.108      int yuv[3];
   1.109      Uint8 *p, *op;
   1.110  
   1.111 -    SDL_LockSurface (s);
   1.112 -    SDL_LockYUVOverlay (o);
   1.113 +    SDL_LockSurface(s);
   1.114 +    SDL_LockYUVOverlay(o);
   1.115  
   1.116      for (y = 0; y < s->h && y < o->h; y++) {
   1.117          p = ((Uint8 *) s->pixels) + s->pitch * y;
   1.118          op = o->pixels[0] + o->pitches[0] * y;
   1.119          for (x = 0; x < s->w && x < o->w; x++) {
   1.120 -            RGBtoYUV (p, yuv, monochrome, luminance);
   1.121 +            RGBtoYUV(p, yuv, monochrome, luminance);
   1.122              if (x % 2 == 0) {
   1.123                  *(op++) = yuv[1];
   1.124                  *(op++) = yuv[0];
   1.125 @@ -262,26 +262,26 @@
   1.126          }
   1.127      }
   1.128  
   1.129 -    SDL_UnlockYUVOverlay (o);
   1.130 -    SDL_UnlockSurface (s);
   1.131 +    SDL_UnlockYUVOverlay(o);
   1.132 +    SDL_UnlockSurface(s);
   1.133  }
   1.134  
   1.135  void
   1.136 -ConvertRGBtoYVYU (SDL_Surface * s, SDL_Overlay * o, int monochrome,
   1.137 -                  int luminance)
   1.138 +ConvertRGBtoYVYU(SDL_Surface * s, SDL_Overlay * o, int monochrome,
   1.139 +                 int luminance)
   1.140  {
   1.141      int x, y;
   1.142      int yuv[3];
   1.143      Uint8 *p, *op;
   1.144  
   1.145 -    SDL_LockSurface (s);
   1.146 -    SDL_LockYUVOverlay (o);
   1.147 +    SDL_LockSurface(s);
   1.148 +    SDL_LockYUVOverlay(o);
   1.149  
   1.150      for (y = 0; y < s->h && y < o->h; y++) {
   1.151          p = ((Uint8 *) s->pixels) + s->pitch * y;
   1.152          op = o->pixels[0] + o->pitches[0] * y;
   1.153          for (x = 0; x < s->w && x < o->w; x++) {
   1.154 -            RGBtoYUV (p, yuv, monochrome, luminance);
   1.155 +            RGBtoYUV(p, yuv, monochrome, luminance);
   1.156              if (x % 2 == 0) {
   1.157                  *(op++) = yuv[0];
   1.158                  *(op++) = yuv[2];
   1.159 @@ -295,26 +295,26 @@
   1.160          }
   1.161      }
   1.162  
   1.163 -    SDL_UnlockYUVOverlay (o);
   1.164 -    SDL_UnlockSurface (s);
   1.165 +    SDL_UnlockYUVOverlay(o);
   1.166 +    SDL_UnlockSurface(s);
   1.167  }
   1.168  
   1.169  void
   1.170 -ConvertRGBtoYUY2 (SDL_Surface * s, SDL_Overlay * o, int monochrome,
   1.171 -                  int luminance)
   1.172 +ConvertRGBtoYUY2(SDL_Surface * s, SDL_Overlay * o, int monochrome,
   1.173 +                 int luminance)
   1.174  {
   1.175      int x, y;
   1.176      int yuv[3];
   1.177      Uint8 *p, *op;
   1.178  
   1.179 -    SDL_LockSurface (s);
   1.180 -    SDL_LockYUVOverlay (o);
   1.181 +    SDL_LockSurface(s);
   1.182 +    SDL_LockYUVOverlay(o);
   1.183  
   1.184      for (y = 0; y < s->h && y < o->h; y++) {
   1.185          p = ((Uint8 *) s->pixels) + s->pitch * y;
   1.186          op = o->pixels[0] + o->pitches[0] * y;
   1.187          for (x = 0; x < s->w && x < o->w; x++) {
   1.188 -            RGBtoYUV (p, yuv, monochrome, luminance);
   1.189 +            RGBtoYUV(p, yuv, monochrome, luminance);
   1.190              if (x % 2 == 0) {
   1.191                  *(op++) = yuv[0];
   1.192                  *(op++) = yuv[1];
   1.193 @@ -328,31 +328,31 @@
   1.194          }
   1.195      }
   1.196  
   1.197 -    SDL_UnlockYUVOverlay (o);
   1.198 -    SDL_UnlockSurface (s);
   1.199 +    SDL_UnlockYUVOverlay(o);
   1.200 +    SDL_UnlockSurface(s);
   1.201  }
   1.202  
   1.203  static void
   1.204 -PrintUsage (char *argv0)
   1.205 +PrintUsage(char *argv0)
   1.206  {
   1.207 -    fprintf (stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0);
   1.208 -    fprintf (stderr, "\n");
   1.209 -    fprintf (stderr, "Where 'arg' is any of the following options:\n");
   1.210 -    fprintf (stderr, "\n");
   1.211 -    fprintf (stderr, "	-fps <frames per second>\n");
   1.212 -    fprintf (stderr,
   1.213 -             "	-format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
   1.214 -    fprintf (stderr,
   1.215 -             "	-scale <scale factor> (initial scale of the overlay)\n");
   1.216 -    fprintf (stderr, "	-help (shows this help)\n");
   1.217 -    fprintf (stderr, "\n");
   1.218 -    fprintf (stderr,
   1.219 -             "Press ESC to exit, or SPACE to freeze the movie while application running.\n");
   1.220 -    fprintf (stderr, "\n");
   1.221 +    fprintf(stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0);
   1.222 +    fprintf(stderr, "\n");
   1.223 +    fprintf(stderr, "Where 'arg' is any of the following options:\n");
   1.224 +    fprintf(stderr, "\n");
   1.225 +    fprintf(stderr, "	-fps <frames per second>\n");
   1.226 +    fprintf(stderr,
   1.227 +            "	-format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
   1.228 +    fprintf(stderr,
   1.229 +            "	-scale <scale factor> (initial scale of the overlay)\n");
   1.230 +    fprintf(stderr, "	-help (shows this help)\n");
   1.231 +    fprintf(stderr, "\n");
   1.232 +    fprintf(stderr,
   1.233 +            "Press ESC to exit, or SPACE to freeze the movie while application running.\n");
   1.234 +    fprintf(stderr, "\n");
   1.235  }
   1.236  
   1.237  int
   1.238 -main (int argc, char **argv)
   1.239 +main(int argc, char **argv)
   1.240  {
   1.241      Uint8 *RawMooseData;
   1.242      SDL_RWops *handle;
   1.243 @@ -370,131 +370,131 @@
   1.244      int overlay_format = SDL_YUY2_OVERLAY;
   1.245      int scale = 5;
   1.246  
   1.247 -    if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
   1.248 -        fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ());
   1.249 +    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
   1.250 +        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
   1.251          return 3;
   1.252      }
   1.253  
   1.254      while (argc > 1) {
   1.255 -        if (strcmp (argv[1], "-fps") == 0) {
   1.256 +        if (strcmp(argv[1], "-fps") == 0) {
   1.257              if (argv[2]) {
   1.258 -                fps = atoi (argv[2]);
   1.259 +                fps = atoi(argv[2]);
   1.260                  if (fps == 0) {
   1.261 -                    fprintf (stderr,
   1.262 -                             "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
   1.263 -                    quit (10);
   1.264 +                    fprintf(stderr,
   1.265 +                            "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
   1.266 +                    quit(10);
   1.267                  }
   1.268                  if ((fps < 0) || (fps > 1000)) {
   1.269 -                    fprintf (stderr,
   1.270 -                             "The -fps option must be in range from 1 to 1000, default is 12.\n");
   1.271 -                    quit (10);
   1.272 +                    fprintf(stderr,
   1.273 +                            "The -fps option must be in range from 1 to 1000, default is 12.\n");
   1.274 +                    quit(10);
   1.275                  }
   1.276                  argv += 2;
   1.277                  argc -= 2;
   1.278              } else {
   1.279 -                fprintf (stderr,
   1.280 -                         "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
   1.281 -                quit (10);
   1.282 +                fprintf(stderr,
   1.283 +                        "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
   1.284 +                quit(10);
   1.285              }
   1.286 -        } else if (strcmp (argv[1], "-format") == 0) {
   1.287 +        } else if (strcmp(argv[1], "-format") == 0) {
   1.288              if (argv[2]) {
   1.289 -                if (!strcmp (argv[2], "YV12"))
   1.290 +                if (!strcmp(argv[2], "YV12"))
   1.291                      overlay_format = SDL_YV12_OVERLAY;
   1.292 -                else if (!strcmp (argv[2], "IYUV"))
   1.293 +                else if (!strcmp(argv[2], "IYUV"))
   1.294                      overlay_format = SDL_IYUV_OVERLAY;
   1.295 -                else if (!strcmp (argv[2], "YUY2"))
   1.296 +                else if (!strcmp(argv[2], "YUY2"))
   1.297                      overlay_format = SDL_YUY2_OVERLAY;
   1.298 -                else if (!strcmp (argv[2], "UYVY"))
   1.299 +                else if (!strcmp(argv[2], "UYVY"))
   1.300                      overlay_format = SDL_UYVY_OVERLAY;
   1.301 -                else if (!strcmp (argv[2], "YVYU"))
   1.302 +                else if (!strcmp(argv[2], "YVYU"))
   1.303                      overlay_format = SDL_YVYU_OVERLAY;
   1.304                  else {
   1.305 -                    fprintf (stderr,
   1.306 -                             "The -format option %s is not recognized, see help for info.\n",
   1.307 -                             argv[2]);
   1.308 -                    quit (10);
   1.309 +                    fprintf(stderr,
   1.310 +                            "The -format option %s is not recognized, see help for info.\n",
   1.311 +                            argv[2]);
   1.312 +                    quit(10);
   1.313                  }
   1.314                  argv += 2;
   1.315                  argc -= 2;
   1.316              } else {
   1.317 -                fprintf (stderr,
   1.318 -                         "The -format option requires an argument, default is YUY2.\n");
   1.319 -                quit (10);
   1.320 +                fprintf(stderr,
   1.321 +                        "The -format option requires an argument, default is YUY2.\n");
   1.322 +                quit(10);
   1.323              }
   1.324 -        } else if (strcmp (argv[1], "-scale") == 0) {
   1.325 +        } else if (strcmp(argv[1], "-scale") == 0) {
   1.326              if (argv[2]) {
   1.327 -                scale = atoi (argv[2]);
   1.328 +                scale = atoi(argv[2]);
   1.329                  if (scale == 0) {
   1.330 -                    fprintf (stderr,
   1.331 -                             "The -scale option requires an argument [from 1 to 50], default is 5.\n");
   1.332 -                    quit (10);
   1.333 +                    fprintf(stderr,
   1.334 +                            "The -scale option requires an argument [from 1 to 50], default is 5.\n");
   1.335 +                    quit(10);
   1.336                  }
   1.337                  if ((scale < 0) || (scale > 50)) {
   1.338 -                    fprintf (stderr,
   1.339 -                             "The -scale option must be in range from 1 to 50, default is 5.\n");
   1.340 -                    quit (10);
   1.341 +                    fprintf(stderr,
   1.342 +                            "The -scale option must be in range from 1 to 50, default is 5.\n");
   1.343 +                    quit(10);
   1.344                  }
   1.345                  argv += 2;
   1.346                  argc -= 2;
   1.347              } else {
   1.348 -                fprintf (stderr,
   1.349 -                         "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
   1.350 -                quit (10);
   1.351 +                fprintf(stderr,
   1.352 +                        "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
   1.353 +                quit(10);
   1.354              }
   1.355 -        } else if ((strcmp (argv[1], "-help") == 0)
   1.356 -                   || (strcmp (argv[1], "-h") == 0)) {
   1.357 -            PrintUsage (argv[0]);
   1.358 -            quit (0);
   1.359 +        } else if ((strcmp(argv[1], "-help") == 0)
   1.360 +                   || (strcmp(argv[1], "-h") == 0)) {
   1.361 +            PrintUsage(argv[0]);
   1.362 +            quit(0);
   1.363          } else {
   1.364 -            fprintf (stderr, "Unrecognized option: %s.\n", argv[1]);
   1.365 -            quit (10);
   1.366 +            fprintf(stderr, "Unrecognized option: %s.\n", argv[1]);
   1.367 +            quit(10);
   1.368          }
   1.369          break;
   1.370      }
   1.371  
   1.372 -    RawMooseData = (Uint8 *) malloc (MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
   1.373 +    RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
   1.374      if (RawMooseData == NULL) {
   1.375 -        fprintf (stderr, "Can't allocate memory for movie !\n");
   1.376 -        free (RawMooseData);
   1.377 -        quit (1);
   1.378 +        fprintf(stderr, "Can't allocate memory for movie !\n");
   1.379 +        free(RawMooseData);
   1.380 +        quit(1);
   1.381      }
   1.382  
   1.383      /* load the trojan moose images */
   1.384 -    handle = SDL_RWFromFile ("moose.dat", "rb");
   1.385 +    handle = SDL_RWFromFile("moose.dat", "rb");
   1.386      if (handle == NULL) {
   1.387 -        fprintf (stderr, "Can't find the file moose.dat !\n");
   1.388 -        free (RawMooseData);
   1.389 -        quit (2);
   1.390 +        fprintf(stderr, "Can't find the file moose.dat !\n");
   1.391 +        free(RawMooseData);
   1.392 +        quit(2);
   1.393      }
   1.394  
   1.395 -    SDL_RWread (handle, RawMooseData, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT);
   1.396 +    SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT);
   1.397  
   1.398 -    SDL_RWclose (handle);
   1.399 +    SDL_RWclose(handle);
   1.400  
   1.401      /* Set video mode */
   1.402      if ((screen =
   1.403 -         SDL_SetVideoMode (MOOSEPIC_W * scale, MOOSEPIC_H * scale, 0,
   1.404 -                           SDL_RESIZABLE | SDL_SWSURFACE)) == NULL) {
   1.405 -        fprintf (stderr, "Couldn't set video mode: %s\n", SDL_GetError ());
   1.406 -        free (RawMooseData);
   1.407 -        quit (4);
   1.408 +         SDL_SetVideoMode(MOOSEPIC_W * scale, MOOSEPIC_H * scale, 0,
   1.409 +                          SDL_RESIZABLE | SDL_SWSURFACE)) == NULL) {
   1.410 +        fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
   1.411 +        free(RawMooseData);
   1.412 +        quit(4);
   1.413      }
   1.414  
   1.415      /* Set the window manager title bar */
   1.416 -    SDL_WM_SetCaption ("SDL test overlay: running moose", "testoverlay2");
   1.417 +    SDL_WM_SetCaption("SDL test overlay: running moose", "testoverlay2");
   1.418  
   1.419      for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
   1.420          MooseFrame[i] =
   1.421 -            SDL_CreateRGBSurfaceFrom (RawMooseData + i * MOOSEFRAME_SIZE,
   1.422 -                                      MOOSEPIC_W, MOOSEPIC_H, 8, MOOSEPIC_W,
   1.423 -                                      0, 0, 0, 0);
   1.424 +            SDL_CreateRGBSurfaceFrom(RawMooseData + i * MOOSEFRAME_SIZE,
   1.425 +                                     MOOSEPIC_W, MOOSEPIC_H, 8, MOOSEPIC_W,
   1.426 +                                     0, 0, 0, 0);
   1.427          if (MooseFrame[i] == NULL) {
   1.428 -            fprintf (stderr, "Couldn't create SDL_Surfaces:%s\n",
   1.429 -                     SDL_GetError ());
   1.430 -            free (RawMooseData);
   1.431 -            quit (5);
   1.432 +            fprintf(stderr, "Couldn't create SDL_Surfaces:%s\n",
   1.433 +                    SDL_GetError());
   1.434 +            free(RawMooseData);
   1.435 +            quit(5);
   1.436          }
   1.437 -        SDL_SetColors (MooseFrame[i], MooseColors, 0, 84);
   1.438 +        SDL_SetColors(MooseFrame[i], MooseColors, 0, 84);
   1.439  
   1.440          {
   1.441              SDL_Surface *newsurf;
   1.442 @@ -525,37 +525,37 @@
   1.443              format.alpha = 0;
   1.444  
   1.445              newsurf =
   1.446 -                SDL_ConvertSurface (MooseFrame[i], &format, SDL_SWSURFACE);
   1.447 +                SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE);
   1.448              if (!newsurf) {
   1.449 -                fprintf (stderr,
   1.450 -                         "Couldn't convert picture to 32bits RGB: %s\n",
   1.451 -                         SDL_GetError ());
   1.452 -                quit (6);
   1.453 +                fprintf(stderr,
   1.454 +                        "Couldn't convert picture to 32bits RGB: %s\n",
   1.455 +                        SDL_GetError());
   1.456 +                quit(6);
   1.457              }
   1.458 -            SDL_FreeSurface (MooseFrame[i]);
   1.459 +            SDL_FreeSurface(MooseFrame[i]);
   1.460              MooseFrame[i] = newsurf;
   1.461          }
   1.462      }
   1.463  
   1.464 -    free (RawMooseData);
   1.465 +    free(RawMooseData);
   1.466  
   1.467      overlay =
   1.468 -        SDL_CreateYUVOverlay (MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen);
   1.469 +        SDL_CreateYUVOverlay(MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen);
   1.470      if (!overlay) {
   1.471 -        fprintf (stderr, "Couldn't create overlay: %s\n", SDL_GetError ());
   1.472 -        quit (7);
   1.473 +        fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError());
   1.474 +        quit(7);
   1.475      }
   1.476  
   1.477 -    printf ("Created %dx%dx%d %s %s overlay\n", overlay->w, overlay->h,
   1.478 -            overlay->planes, overlay->hw_overlay ? "hardware" : "software",
   1.479 -            overlay->format == SDL_YV12_OVERLAY ? "YV12" : overlay->format ==
   1.480 -            SDL_IYUV_OVERLAY ? "IYUV" : overlay->format ==
   1.481 -            SDL_YUY2_OVERLAY ? "YUY2" : overlay->format ==
   1.482 -            SDL_UYVY_OVERLAY ? "UYVY" : overlay->format ==
   1.483 -            SDL_YVYU_OVERLAY ? "YVYU" : "Unknown");
   1.484 +    printf("Created %dx%dx%d %s %s overlay\n", overlay->w, overlay->h,
   1.485 +           overlay->planes, overlay->hw_overlay ? "hardware" : "software",
   1.486 +           overlay->format == SDL_YV12_OVERLAY ? "YV12" : overlay->format ==
   1.487 +           SDL_IYUV_OVERLAY ? "IYUV" : overlay->format ==
   1.488 +           SDL_YUY2_OVERLAY ? "YUY2" : overlay->format ==
   1.489 +           SDL_UYVY_OVERLAY ? "UYVY" : overlay->format ==
   1.490 +           SDL_YVYU_OVERLAY ? "YVYU" : "Unknown");
   1.491  
   1.492      for (i = 0; i < overlay->planes; i++) {
   1.493 -        printf ("  plane %d: pitch=%d\n", i, overlay->pitches[i]);
   1.494 +        printf("  plane %d: pitch=%d\n", i, overlay->pitches[i]);
   1.495      }
   1.496  
   1.497      overlayrect.x = 0;
   1.498 @@ -568,18 +568,18 @@
   1.499      fpsdelay = 1000 / fps;
   1.500  
   1.501      /* Ignore key up events, they don't even get filtered */
   1.502 -    SDL_EventState (SDL_KEYUP, SDL_IGNORE);
   1.503 +    SDL_EventState(SDL_KEYUP, SDL_IGNORE);
   1.504  
   1.505 -    lastftick = SDL_GetTicks ();
   1.506 +    lastftick = SDL_GetTicks();
   1.507  
   1.508      /* Loop, waiting for QUIT or RESIZE */
   1.509      while (1) {
   1.510 -        if (SDL_PollEvent (&event)) {
   1.511 +        if (SDL_PollEvent(&event)) {
   1.512              switch (event.type) {
   1.513              case SDL_VIDEORESIZE:
   1.514                  screen =
   1.515 -                    SDL_SetVideoMode (event.resize.w, event.resize.h, 0,
   1.516 -                                      SDL_RESIZABLE | SDL_SWSURFACE);
   1.517 +                    SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
   1.518 +                                     SDL_RESIZABLE | SDL_SWSURFACE);
   1.519                  overlayrect.w = event.resize.w;
   1.520                  overlayrect.h = event.resize.h;
   1.521                  if (paused) {
   1.522 @@ -599,37 +599,37 @@
   1.523                      break;
   1.524                  }
   1.525              case SDL_QUIT:
   1.526 -                SDL_FreeYUVOverlay (overlay);
   1.527 +                SDL_FreeYUVOverlay(overlay);
   1.528                  for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
   1.529 -                    SDL_FreeSurface (MooseFrame[i]);
   1.530 +                    SDL_FreeSurface(MooseFrame[i]);
   1.531                  }
   1.532 -                quit (0);
   1.533 +                quit(0);
   1.534              }
   1.535          }
   1.536  
   1.537          if ((!paused) || (resized)) {
   1.538 -            if (((SDL_GetTicks () - lastftick) > fpsdelay) || (resized)) {
   1.539 -                lastftick = SDL_GetTicks ();
   1.540 +            if (((SDL_GetTicks() - lastftick) > fpsdelay) || (resized)) {
   1.541 +                lastftick = SDL_GetTicks();
   1.542  
   1.543                  switch (overlay_format) {
   1.544                  case SDL_YUY2_OVERLAY:
   1.545 -                    ConvertRGBtoYUY2 (MooseFrame[i], overlay, 0, 100);
   1.546 +                    ConvertRGBtoYUY2(MooseFrame[i], overlay, 0, 100);
   1.547                      break;
   1.548                  case SDL_YV12_OVERLAY:
   1.549 -                    ConvertRGBtoYV12 (MooseFrame[i], overlay, 0, 100);
   1.550 +                    ConvertRGBtoYV12(MooseFrame[i], overlay, 0, 100);
   1.551                      break;
   1.552                  case SDL_UYVY_OVERLAY:
   1.553 -                    ConvertRGBtoUYVY (MooseFrame[i], overlay, 0, 100);
   1.554 +                    ConvertRGBtoUYVY(MooseFrame[i], overlay, 0, 100);
   1.555                      break;
   1.556                  case SDL_YVYU_OVERLAY:
   1.557 -                    ConvertRGBtoYVYU (MooseFrame[i], overlay, 0, 100);
   1.558 +                    ConvertRGBtoYVYU(MooseFrame[i], overlay, 0, 100);
   1.559                      break;
   1.560                  case SDL_IYUV_OVERLAY:
   1.561 -                    ConvertRGBtoIYUV (MooseFrame[i], overlay, 0, 100);
   1.562 +                    ConvertRGBtoIYUV(MooseFrame[i], overlay, 0, 100);
   1.563                      break;
   1.564                  }
   1.565  
   1.566 -                SDL_DisplayYUVOverlay (overlay, &overlayrect);
   1.567 +                SDL_DisplayYUVOverlay(overlay, &overlayrect);
   1.568                  if (!resized) {
   1.569                      i++;
   1.570                      if (i == 10) {
   1.571 @@ -641,9 +641,9 @@
   1.572              }
   1.573          }
   1.574          /* kind of timeslice to OS */
   1.575 -        SDL_Delay (1);
   1.576 +        SDL_Delay(1);
   1.577      }
   1.578  
   1.579 -    SDL_Quit ();
   1.580 +    SDL_Quit();
   1.581      return 0;
   1.582  }