Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/avi/intern/avi.c')
-rw-r--r--source/blender/avi/intern/avi.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 5f0d36e17e2..b23c1f83714 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -1,10 +1,8 @@
-/**
- * avi.c
+/*
+ * $Id$
*
* This is external code.
*
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -48,7 +46,7 @@
static int AVI_DEBUG=0;
static char DEBUG_FCC[4];
-#define DEBUG(x) if(AVI_DEBUG) printf("AVI DEBUG: " x);
+#define DEBUG_PRINT(x) if(AVI_DEBUG) printf("AVI DEBUG: " x);
/* local functions */
char *fcc_to_char (unsigned int fcc);
@@ -211,16 +209,14 @@ int AVI_is_avi (char *name) {
}
*/
-int AVI_is_avi (char *name) {
+int AVI_is_avi (const char *name) {
int temp, fcca, j;
- AviMovie movie;
+ AviMovie movie= {0};
AviMainHeader header;
AviBitmapInfoHeader bheader;
int movie_tracks = 0;
- DEBUG("opening movie\n");
-
- memset(&movie, 0, sizeof(AviMovie));
+ DEBUG_PRINT("opening movie\n");
movie.type = AVI_MOVIE_READ;
movie.fp = fopen (name, "rb");
@@ -243,7 +239,7 @@ int AVI_is_avi (char *name) {
GET_FCC (movie.fp) != FCC("hdrl") ||
(movie.header->fcc = GET_FCC (movie.fp)) != FCC("avih") ||
!(movie.header->size = GET_FCC (movie.fp))) {
- DEBUG("bad initial header info\n");
+ DEBUG_PRINT("bad initial header info\n");
fclose(movie.fp);
return 0;
}
@@ -266,7 +262,7 @@ int AVI_is_avi (char *name) {
fseek (movie.fp, movie.header->size-14*4, SEEK_CUR);
if (movie.header->Streams < 1) {
- DEBUG("streams less than 1\n");
+ DEBUG_PRINT("streams less than 1\n");
fclose(movie.fp);
return 0;
}
@@ -280,7 +276,7 @@ int AVI_is_avi (char *name) {
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("bad stream header information\n");
+ DEBUG_PRINT("bad stream header information\n");
MEM_freeN(movie.streams);
fclose(movie.fp);
@@ -328,7 +324,7 @@ int AVI_is_avi (char *name) {
fseek (movie.fp, movie.streams[temp].sh.size-14*4, SEEK_CUR);
if (GET_FCC (movie.fp) != FCC("strf")) {
- DEBUG("no stream format information\n");
+ DEBUG_PRINT("no stream format information\n");
MEM_freeN(movie.streams);
fclose(movie.fp);
return 0;
@@ -384,7 +380,7 @@ int AVI_is_avi (char *name) {
while (GET_FCC (movie.fp) != FCC("LIST")) {
temp= GET_FCC (movie.fp);
if (temp<0 || ftell(movie.fp) > movie.size) {
- DEBUG("incorrect size in header or error in AVI\n");
+ DEBUG_PRINT("incorrect size in header or error in AVI\n");
MEM_freeN(movie.streams);
fclose(movie.fp);
@@ -404,10 +400,10 @@ int AVI_is_avi (char *name) {
}
-AviError AVI_open_movie (char *name, AviMovie *movie) {
+AviError AVI_open_movie (const char *name, AviMovie *movie) {
int temp, fcca, size, j;
- DEBUG("opening movie\n");
+ DEBUG_PRINT("opening movie\n");
memset(movie, 0, sizeof(AviMovie));
@@ -430,7 +426,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
GET_FCC (movie->fp) != FCC("hdrl") ||
(movie->header->fcc = GET_FCC (movie->fp)) != FCC("avih") ||
!(movie->header->size = GET_FCC (movie->fp))) {
- DEBUG("bad initial header info\n");
+ DEBUG_PRINT("bad initial header info\n");
return AVI_ERROR_FORMAT;
}
@@ -452,7 +448,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
fseek (movie->fp, movie->header->size-14*4, SEEK_CUR);
if (movie->header->Streams < 1) {
- DEBUG("streams less than 1\n");
+ DEBUG_PRINT("streams less than 1\n");
return AVI_ERROR_FORMAT;
}
@@ -465,7 +461,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
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("bad stream header information\n");
+ DEBUG_PRINT("bad stream header information\n");
return AVI_ERROR_FORMAT;
}
@@ -507,7 +503,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
fseek (movie->fp, movie->streams[temp].sh.size-14*4, SEEK_CUR);
if (GET_FCC (movie->fp) != FCC("strf")) {
- DEBUG("no stream format information\n");
+ DEBUG_PRINT("no stream format information\n");
return AVI_ERROR_FORMAT;
}
@@ -560,7 +556,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
while (GET_FCC (movie->fp) != FCC("LIST")) {
temp= GET_FCC (movie->fp);
if (temp<0 || ftell(movie->fp) > movie->size) {
- DEBUG("incorrect size in header or error in AVI\n");
+ DEBUG_PRINT("incorrect size in header or error in AVI\n");
return AVI_ERROR_FORMAT;
}
fseek(movie->fp, temp, SEEK_CUR);
@@ -585,7 +581,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
fseek (movie->fp, size, SEEK_CUR);
}
if (ftell(movie->fp) > movie->size) {
- DEBUG("incorrect size in header or error in AVI\n");
+ DEBUG_PRINT("incorrect size in header or error in AVI\n");
return AVI_ERROR_FORMAT;
}
}
@@ -599,13 +595,13 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
fseek(movie->fp, size-4, SEEK_CUR);
if (GET_FCC(movie->fp) != FCC("idx1")) {
- DEBUG("bad index informatio\n");
+ DEBUG_PRINT("bad index informatio\n");
return AVI_ERROR_FORMAT;
}
movie->index_entries = GET_FCC (movie->fp)/sizeof(AviIndexEntry);
if (movie->index_entries == 0) {
- DEBUG("no index entries\n");
+ DEBUG_PRINT("no index entries\n");
return AVI_ERROR_FORMAT;
}
@@ -631,7 +627,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) {
movie->read_offset= 4;
}
- DEBUG("movie succesfully opened\n");
+ DEBUG_PRINT("movie succesfully opened\n");
return AVI_ERROR_NONE;
}