[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46394] trunk/blender/source/blender/avi/ intern: style cleanup: avi
Campbell Barton
ideasman42 at gmail.com
Mon May 7 20:30:04 CEST 2012
Revision: 46394
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46394
Author: campbellbarton
Date: 2012-05-07 18:30:04 +0000 (Mon, 07 May 2012)
Log Message:
-----------
style cleanup: avi
Modified Paths:
--------------
trunk/blender/source/blender/avi/intern/avi.c
trunk/blender/source/blender/avi/intern/avirgb.c
trunk/blender/source/blender/avi/intern/codecs.c
trunk/blender/source/blender/avi/intern/endian.c
trunk/blender/source/blender/avi/intern/mjpeg.c
trunk/blender/source/blender/avi/intern/options.c
trunk/blender/source/blender/avi/intern/rgb32.c
Modified: trunk/blender/source/blender/avi/intern/avi.c
===================================================================
--- trunk/blender/source/blender/avi/intern/avi.c 2012-05-07 18:12:31 UTC (rev 46393)
+++ trunk/blender/source/blender/avi/intern/avi.c 2012-05-07 18:30:04 UTC (rev 46394)
@@ -51,7 +51,7 @@
#include "endian.h"
-static int AVI_DEBUG=0;
+static int AVI_DEBUG = 0;
static char DEBUG_FCC[4];
#define DEBUG_PRINT(x) if (AVI_DEBUG) { printf("AVI DEBUG: " x); } (void)0
@@ -64,7 +64,7 @@
/* implemetation */
-unsigned int GET_FCC (FILE *fp)
+unsigned int GET_FCC(FILE *fp)
{
unsigned char tmp[4];
@@ -73,10 +73,10 @@
tmp[2] = getc(fp);
tmp[3] = getc(fp);
- return FCC (tmp);
+ return FCC(tmp);
}
-unsigned int GET_TCC (FILE *fp)
+unsigned int GET_TCC(FILE *fp)
{
char tmp[5];
@@ -85,25 +85,25 @@
tmp[2] = 0;
tmp[3] = 0;
- return FCC (tmp);
+ return FCC(tmp);
}
char *fcc_to_char(unsigned int fcc)
{
- DEBUG_FCC[0]= (fcc)&127;
- DEBUG_FCC[1]= (fcc>>8)&127;
- DEBUG_FCC[2]= (fcc>>16)&127;
- DEBUG_FCC[3]= (fcc>>24)&127;
+ DEBUG_FCC[0] = (fcc) & 127;
+ DEBUG_FCC[1] = (fcc >> 8) & 127;
+ DEBUG_FCC[2] = (fcc >> 16) & 127;
+ DEBUG_FCC[3] = (fcc >> 24) & 127;
return DEBUG_FCC;
}
char *tcc_to_char(unsigned int tcc)
{
- DEBUG_FCC[0]= (tcc)&127;
- DEBUG_FCC[1]= (tcc>>8)&127;
- DEBUG_FCC[2]= 0;
- DEBUG_FCC[3]= 0;
+ DEBUG_FCC[0] = (tcc) & 127;
+ DEBUG_FCC[1] = (tcc >> 8) & 127;
+ DEBUG_FCC[2] = 0;
+ DEBUG_FCC[3] = 0;
return DEBUG_FCC;
}
@@ -115,7 +115,7 @@
if (movie == NULL)
return -AVI_ERROR_OPTION;
- for (cur_stream=0; cur_stream < movie->header->Streams; cur_stream++) {
+ for (cur_stream = 0; cur_stream < movie->header->Streams; cur_stream++) {
if (movie->streams[cur_stream].sh.Type == avist_type) {
if (stream_num == 0)
return cur_stream;
@@ -127,28 +127,28 @@
return -AVI_ERROR_FOUND;
}
-static int fcc_get_stream (int fcc)
+static int fcc_get_stream(int fcc)
{
char fccs[4];
fccs[0] = fcc;
- fccs[1] = fcc>>8;
- fccs[2] = fcc>>16;
- fccs[3] = fcc>>24;
+ fccs[1] = fcc >> 8;
+ fccs[2] = fcc >> 16;
+ fccs[3] = fcc >> 24;
- return 10*(fccs[0]-'0') + (fccs[1]-'0');
+ return 10 * (fccs[0] - '0') + (fccs[1] - '0');
}
-static int fcc_is_data (int fcc)
+static int fcc_is_data(int fcc)
{
char fccs[4];
fccs[0] = fcc;
- fccs[1] = fcc>>8;
- fccs[2] = fcc>>16;
- fccs[3] = fcc>>24;
+ fccs[1] = fcc >> 8;
+ fccs[2] = fcc >> 16;
+ fccs[3] = fcc >> 24;
- if (!isdigit (fccs[0]) || !isdigit (fccs[1]) || (fccs[2] != 'd' && fccs[2] != 'w'))
+ if (!isdigit(fccs[0]) || !isdigit(fccs[1]) || (fccs[2] != 'd' && fccs[2] != 'w'))
return 0;
if (fccs[3] != 'b' && fccs[3] != 'c')
return 0;
@@ -166,34 +166,34 @@
error = in_error;
switch (error) {
- case AVI_ERROR_NONE:
- break;
- case AVI_ERROR_COMPRESSION:
- printf ("AVI ERROR: compressed in an unsupported format\n");
- break;
- case AVI_ERROR_OPEN:
- printf ("AVI ERROR: could not open file\n");
- break;
- case AVI_ERROR_READING:
- printf ("AVI ERROR: could not read from file\n");
- break;
- case AVI_ERROR_WRITING:
- printf ("AVI ERROR: could not write to file\n");
- break;
- case AVI_ERROR_FORMAT:
- printf ("AVI ERROR: file is in an illegal or unrecognized format\n");
- break;
- case AVI_ERROR_ALLOC:
- printf ("AVI ERROR: error encountered while allocating memory\n");
- break;
- case AVI_ERROR_OPTION:
- printf ("AVI ERROR: program made illegal request\n");
- break;
- case AVI_ERROR_FOUND:
- printf ("AVI ERROR: movie did not contain expected item\n");
- break;
- default:
- break;
+ case AVI_ERROR_NONE:
+ break;
+ case AVI_ERROR_COMPRESSION:
+ printf("AVI ERROR: compressed in an unsupported format\n");
+ break;
+ case AVI_ERROR_OPEN:
+ printf("AVI ERROR: could not open file\n");
+ break;
+ case AVI_ERROR_READING:
+ printf("AVI ERROR: could not read from file\n");
+ break;
+ case AVI_ERROR_WRITING:
+ printf("AVI ERROR: could not write to file\n");
+ break;
+ case AVI_ERROR_FORMAT:
+ printf("AVI ERROR: file is in an illegal or unrecognized format\n");
+ break;
+ case AVI_ERROR_ALLOC:
+ printf("AVI ERROR: error encountered while allocating memory\n");
+ break;
+ case AVI_ERROR_OPTION:
+ printf("AVI ERROR: program made illegal request\n");
+ break;
+ case AVI_ERROR_FOUND:
+ printf("AVI ERROR: movie did not contain expected item\n");
+ break;
+ default:
+ break;
}
return in_error;
@@ -201,7 +201,7 @@
#if 0
void AVI_set_debug(int mode)
{
- AVI_DEBUG= mode;
+ AVI_DEBUG = mode;
}
int AVI_is_avi(char *name)
@@ -209,13 +209,13 @@
FILE *fp;
int ret;
- fp = fopen (name, "rb");
+ fp = fopen(name, "rb");
if (fp == NULL)
return 0;
- if (GET_FCC (fp) != FCC("RIFF") ||
- !GET_FCC (fp) ||
- GET_FCC (fp) != FCC("AVI ")) {
+ if (GET_FCC(fp) != FCC("RIFF") ||
+ !GET_FCC(fp) ||
+ GET_FCC(fp) != FCC("AVI ")) {
ret = 0;
}
else {
@@ -230,7 +230,7 @@
int AVI_is_avi(const char *name)
{
int temp, fcca, j;
- AviMovie movie= {NULL};
+ AviMovie movie = {NULL};
AviMainHeader header;
AviBitmapInfoHeader bheader;
int movie_tracks = 0;
@@ -238,26 +238,26 @@
DEBUG_PRINT("opening movie\n");
movie.type = AVI_MOVIE_READ;
- movie.fp = fopen (name, "rb");
+ movie.fp = fopen(name, "rb");
movie.offset_table = NULL;
if (movie.fp == NULL)
return 0;
- if (GET_FCC (movie.fp) != FCC("RIFF") ||
- !(movie.size = GET_FCC (movie.fp))) {
+ if (GET_FCC(movie.fp) != FCC("RIFF") ||
+ !(movie.size = GET_FCC(movie.fp))) {
fclose(movie.fp);
return 0;
}
movie.header = &header;
- if (GET_FCC (movie.fp) != FCC("AVI ") ||
- GET_FCC (movie.fp) != FCC("LIST") ||
- !GET_FCC (movie.fp) ||
- GET_FCC (movie.fp) != FCC("hdrl") ||
- (movie.header->fcc = GET_FCC (movie.fp)) != FCC("avih") ||
- !(movie.header->size = GET_FCC (movie.fp))) {
+ if (GET_FCC(movie.fp) != FCC("AVI ") ||
+ GET_FCC(movie.fp) != FCC("LIST") ||
+ !GET_FCC(movie.fp) ||
+ GET_FCC(movie.fp) != FCC("hdrl") ||
+ (movie.header->fcc = GET_FCC(movie.fp)) != FCC("avih") ||
+ !(movie.header->size = GET_FCC(movie.fp))) {
DEBUG_PRINT("bad initial header info\n");
fclose(movie.fp);
return 0;
@@ -278,7 +278,7 @@
movie.header->Reserved[2] = GET_FCC(movie.fp);
movie.header->Reserved[3] = GET_FCC(movie.fp);
- fseek (movie.fp, movie.header->size-14*4, SEEK_CUR);
+ fseek(movie.fp, movie.header->size - 14 * 4, SEEK_CUR);
if (movie.header->Streams < 1) {
DEBUG_PRINT("streams less than 1\n");
@@ -286,15 +286,16 @@
return 0;
}
- movie.streams = (AviStreamRec *) MEM_callocN (sizeof(AviStreamRec) * movie.header->Streams, "moviestreams");
+ movie.streams = (AviStreamRec *) MEM_callocN(sizeof(AviStreamRec) * movie.header->Streams, "moviestreams");
- for (temp=0; temp < movie.header->Streams; temp++) {
+ for (temp = 0; temp < movie.header->Streams; temp++) {
if (GET_FCC(movie.fp) != FCC("LIST") ||
- !GET_FCC (movie.fp) ||
- GET_FCC (movie.fp) != FCC ("strl") ||
- (movie.streams[temp].sh.fcc = GET_FCC (movie.fp)) != FCC ("strh") ||
- !(movie.streams[temp].sh.size = GET_FCC (movie.fp))) {
+ !GET_FCC(movie.fp) ||
+ GET_FCC(movie.fp) != FCC("strl") ||
+ (movie.streams[temp].sh.fcc = GET_FCC(movie.fp)) != FCC("strh") ||
+ !(movie.streams[temp].sh.size = GET_FCC(movie.fp)))
+ {
DEBUG_PRINT("bad stream header information\n");
MEM_freeN(movie.streams);
@@ -302,20 +303,21 @@
return 0;
}
- movie.streams[temp].sh.Type = GET_FCC (movie.fp);
- movie.streams[temp].sh.Handler = GET_FCC (movie.fp);
+ movie.streams[temp].sh.Type = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Handler = GET_FCC(movie.fp);
fcca = movie.streams[temp].sh.Handler;
if (movie.streams[temp].sh.Type == FCC("vids")) {
- if (fcca == FCC ("DIB ") ||
- fcca == FCC ("RGB ") ||
- fcca == FCC ("rgb ") ||
- fcca == FCC ("RAW ") ||
- fcca == 0) {
+ if (fcca == FCC("DIB ") ||
+ fcca == FCC("RGB ") ||
+ fcca == FCC("rgb ") ||
+ fcca == FCC("RAW ") ||
+ fcca == 0)
+ {
movie.streams[temp].format = AVI_FORMAT_AVI_RGB;
}
- else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+ else if (fcca == FCC("mjpg") || fcca == FCC("MJPG")) {
movie.streams[temp].format = AVI_FORMAT_MJPEG;
}
else {
@@ -326,67 +328,70 @@
movie_tracks++;
}
- movie.streams[temp].sh.Flags = GET_FCC (movie.fp);
- movie.streams[temp].sh.Priority = GET_TCC (movie.fp);
- movie.streams[temp].sh.Language = GET_TCC (movie.fp);
- movie.streams[temp].sh.InitialFrames = GET_FCC (movie.fp);
- movie.streams[temp].sh.Scale = GET_FCC (movie.fp);
- movie.streams[temp].sh.Rate = GET_FCC (movie.fp);
- movie.streams[temp].sh.Start = GET_FCC (movie.fp);
- movie.streams[temp].sh.Length = GET_FCC (movie.fp);
- movie.streams[temp].sh.SuggestedBufferSize = GET_FCC (movie.fp);
- movie.streams[temp].sh.Quality = GET_FCC (movie.fp);
- movie.streams[temp].sh.SampleSize = GET_FCC (movie.fp);
- movie.streams[temp].sh.left = GET_TCC (movie.fp);
- movie.streams[temp].sh.top = GET_TCC (movie.fp);
- movie.streams[temp].sh.right = GET_TCC (movie.fp);
- movie.streams[temp].sh.bottom = GET_TCC (movie.fp);
+ movie.streams[temp].sh.Flags = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Priority = GET_TCC(movie.fp);
+ movie.streams[temp].sh.Language = GET_TCC(movie.fp);
+ movie.streams[temp].sh.InitialFrames = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Scale = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Rate = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Start = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Length = GET_FCC(movie.fp);
+ movie.streams[temp].sh.SuggestedBufferSize = GET_FCC(movie.fp);
+ movie.streams[temp].sh.Quality = GET_FCC(movie.fp);
+ movie.streams[temp].sh.SampleSize = GET_FCC(movie.fp);
+ movie.streams[temp].sh.left = GET_TCC(movie.fp);
+ movie.streams[temp].sh.top = GET_TCC(movie.fp);
+ movie.streams[temp].sh.right = GET_TCC(movie.fp);
+ movie.streams[temp].sh.bottom = GET_TCC(movie.fp);
- fseek (movie.fp, movie.streams[temp].sh.size-14*4, SEEK_CUR);
+ fseek(movie.fp, movie.streams[temp].sh.size - 14 * 4, SEEK_CUR);
- if (GET_FCC (movie.fp) != FCC("strf")) {
+ if (GET_FCC(movie.fp) != FCC("strf")) {
DEBUG_PRINT("no stream format information\n");
MEM_freeN(movie.streams);
fclose(movie.fp);
return 0;
}
- movie.streams[temp].sf_size= GET_FCC(movie.fp);
+ movie.streams[temp].sf_size = GET_FCC(movie.fp);
if (movie.streams[temp].sh.Type == FCC("vids")) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list