From 0ae9af34a06ec2299cb75d323dd9c19d170ab272 Mon Sep 17 00:00:00 2001 From: Kent Mein Date: Wed, 23 Mar 2005 18:33:52 +0000 Subject: a fix for: https://projects.blender.org/tracker/index.php?func=detail&aid=1173&group_id=9&atid=126 blender now does a little more homework to figure out what type of avi file is being loaded. Kent --- source/blender/avi/intern/avi.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index f2e99d4929d..a02308dde27 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -46,10 +46,6 @@ #include "endian.h" -#ifdef HAVE_CONFIG_H -#include -#endif - static int AVI_DEBUG=0; static char DEBUG_FCC[4]; @@ -215,7 +211,7 @@ int AVI_is_avi (char *name) { } AviError AVI_open_movie (char *name, AviMovie *movie) { - int temp, fcca, size; + int temp, fcca, size, j; DEBUG("opening movie\n"); @@ -326,7 +322,8 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { movie->streams[temp].sf_size= GET_FCC(movie->fp); if (movie->streams[temp].sh.Type == FCC("vids")) { - if (movie->streams[temp].sf_size == sizeof(AviBitmapInfoHeader)-8) { + j = movie->streams[temp].sf_size - (sizeof(AviBitmapInfoHeader) - 8); + if (j >= 0) { AviBitmapInfoHeader *bi; movie->streams[temp].sf= MEM_mallocN(sizeof(AviBitmapInfoHeader), "streamformat"); @@ -350,18 +347,23 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { fcca = bi->Compression; - if (fcca == FCC ("DIB ") || - fcca == FCC ("RGB ") || - fcca == FCC ("rgb ") || - fcca == FCC ("RAW ") || - fcca == FCC ("mjpg") || - fcca == FCC ("MJPG") || - fcca == 0) { - } else { - return AVI_ERROR_COMPRESSION; + if ( movie->streams[temp].format == + AVI_FORMAT_AVI_RGB) { + if (fcca == FCC ("DIB ") || + fcca == FCC ("RGB ") || + fcca == FCC ("rgb ") || + fcca == FCC ("RAW ") || + fcca == 0 ) { + } else if ( fcca == FCC ("mjpg") || + fcca == FCC ("MJPG")) { + movie->streams[temp].format = AVI_FORMAT_MJPEG; + } else { + return AVI_ERROR_COMPRESSION; + } } - } else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR); + } + if (j > 0) fseek (movie->fp, j, SEEK_CUR); } else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR); /* Walk to the next LIST */ -- cgit v1.2.3