Added Quicktime support for OSX and Windows.

This code allows you to load Quicktime images and movies as textures
and render animations to Quicktime movies.
Note that the selected output codec is *not* saved in the blendfile.

To enable Quicktime functionality you need the SDK from Apple:
OSX: ftp://ftp.apple.com/developer/Development_Kits/QT6SDK_Mac.hqx
Win: ftp://ftp.apple.com/developer/Development_Kits/QT6SDK_Win.hqx
Add the \QTDevWin\CIncludes and \QTDevWin\Libraries directories
from this SDK to your build environment.

Enable the WITH_QUICKTIME compile flag in the following directories:
bf\blender\source\blender\imbuf
bf\blender\source\blender\src
bf\blender\source\blender\render
bf\blender\source\creator
This commit is contained in:
2003-04-28 02:15:46 +00:00
parent 1ab53ee998
commit 706ccc0401
25 changed files with 2994 additions and 669 deletions

View File

@@ -93,7 +93,6 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef IMB_IMBUF_H
#define IMB_IMBUF_H
@@ -232,19 +231,27 @@ void IMB_close_anim(struct anim * anim);
*
* @attention Defined in anim.c
*/
int ismovie(char *name);
/**
*
* @attention Defined in anim.c
*/
struct ImBuf * IMB_anim_absolute(struct anim * anim, int position);
/**
*
* @attention Defined in anim.c
*/
void IMB_free_anim(struct anim * anim);
void IMB_free_anim_ibuf(struct anim * anim);
/**
*
* @attention Defined in anim.c
*/
int IMB_isanim(char * name);
void IMB_free_anim(struct anim * anim);
/**
*
@@ -320,6 +327,18 @@ short IMB_png_encode(struct ImBuf *ibuf, int file, int flags);
*/
int IMB_ispic(char *name);
/**
*
* @attention Defined in util.c
*/
int IMB_isanim(char * name);
/**
*
* @attention Defined in util.c
*/
int imb_get_anim_type(char * name);
/**
*
* @attention Defined in divers.c
@@ -334,6 +353,14 @@ void IMB_de_interlace(struct ImBuf *ibuf);
*/
void IMB_convert_rgba_to_abgr(int size, unsigned int *rect);
/**
* Change the ordering of the colour bytes pointed to by rect from
* rgba to abgr. size * 4 colour bytes are reordered.
*
* @attention Defined in imageprocess.c
*/
void IMB_convert_bgra_to_rgba(int size, unsigned int *rect);
/**
*
* @attention defined in scaling.c
@@ -468,4 +495,3 @@ void IMB_freezbufImBuf(struct ImBuf * ibuf);
void IMB_rectfill(unsigned int *drect, unsigned int *srect, int x, int value);
#endif

View File

@@ -111,6 +111,15 @@ typedef enum {
#define TGA (1 << 28)
#define JPG (1 << 27)
#define BMP (1 << 26)
#ifdef WITH_QUICKTIME
#define QUICKTIME (1 << 25)
#endif
#ifdef WITH_FREEIMAGE
#define FREEIMAGE (1 << 24)
#endif
#ifdef WITH_IMAGEMAGICK
#define IMAGEMAGICK (1 << 23)
#endif
#define RAWTGA (TGA | 1)

View File

@@ -0,0 +1,182 @@
/**
* allocimbuf.h
*
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef IMB_ANIM_H
#define IMB_ANIM_H
#ifdef _WIN32
#define INC_OLE2
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <memory.h>
#include <commdlg.h>
#ifndef FREE_WINDOWS
#include <vfw.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#undef AVIIF_KEYFRAME // redefined in AVI_avi.h
#undef AVIIF_LIST // redefined in AVI_avi.h
#define FIXCC(fcc) if (fcc == 0) fcc = mmioFOURCC('N', 'o', 'n', 'e'); \
if (fcc == BI_RLE8) fcc = mmioFOURCC('R', 'l', 'e', '8');
#endif
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef _WIN32
#include <dirent.h>
#else
#include <io.h>
#include "BLI_winstuff.h"
#endif
#include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail
BLI_countlist BLI_stringdec */
#include "imbuf.h"
#include "imbuf_patch.h"
#include "AVI_avi.h"
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined(__APPLE__)
#include "quicktime_import.h"
#endif /* _WIN32 || __APPLE__ */
#ifdef linux
#include "quicktime_import_linux.h"
#endif /* linux */
#endif /* WITH_QUICKTIME */
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
#include "IMB_bitplanes.h"
/* actually hard coded endianness */
#define GET_BIG_LONG(x) (((uchar *) (x))[0] << 24 | ((uchar *) (x))[1] << 16 | ((uchar *) (x))[2] << 8 | ((uchar *) (x))[3])
#define GET_LITTLE_LONG(x) (((uchar *) (x))[3] << 24 | ((uchar *) (x))[2] << 16 | ((uchar *) (x))[1] << 8 | ((uchar *) (x))[0])
#define SWAP_L(x) (((x << 24) & 0xff000000) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff))
#define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff))
/* more endianness... should move to a separate file... */
#if defined(__sgi) || defined (__sparc) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
#define GET_ID GET_BIG_LONG
#define LITTLE_LONG SWAP_LONG
#else
#define GET_ID GET_LITTLE_LONG
#define LITTLE_LONG ENDIAN_NOP
#endif
/****/
#define ANIM_NONE (0)
#define ANIM_SEQUENCE (1 << 0)
#define ANIM_DIR (1 << 1)
#define ANIM_ANIM5 (1 << 2)
#define ANIM_TGA (1 << 3)
#define ANIM_MOVIE (1 << 4)
#define ANIM_MDEC (1 << 5)
#define ANIM_AVI (1 << 6)
#define ANIM_QTIME (1 << 7)
#define ANIM5_MMAP 0
#define ANIM5_MALLOC 1
#define ANIM5_SNGBUF 2
#define ANIM5_XOR 4
#define MAXNUMSTREAMS 50
struct anim {
int ib_flags;
int curtype;
int curposition; /* index 0 = 1e, 1 = 2e, enz. */
int duration;
int x, y;
/* voor op nummer */
char name[256];
/* voor sequence */
char first[256];
/* anim5 */
struct ListBase anim5base;
void * anim5mmap;
int anim5len;
struct Anim5Delta *anim5curdlta;
void (*anim5decode)(struct ImBuf *, unsigned char *);
int anim5flags;
/* movie */
void *movie;
void *track;
void *params;
int orientation;
size_t framesize;
int interlacing;
/* data */
struct ImBuf * ibuf1, * ibuf2;
/* avi */
struct _AviMovie *avi;
#if defined(_WIN32) && !defined(FREE_WINDOWS)
/* windows avi */
int avistreams;
int firstvideo;
int pfileopen;
PAVIFILE pfile;
PAVISTREAM pavi[MAXNUMSTREAMS]; // the current streams
PGETFRAME pgf;
#endif
#ifdef WITH_QUICKTIME
/* quicktime */
struct _QuicktimeMovie *qtime;
#endif /* WITH_QUICKTIME */
};
#endif

View File

@@ -0,0 +1,20 @@
/* IMB_anim.h */
#ifndef IMB_ANIM5_H
#define IMB_ANIM5_H
struct anim;
/**
*
* @attention Defined in anim5.c
*/
int nextanim5(struct anim * anim);
int rewindanim5(struct anim * anim);
int startanim5(struct anim * anim);
void free_anim_anim5(struct anim * anim);
struct ImBuf * anim5_fetchibuf(struct anim * anim);
#endif

View File

@@ -39,10 +39,9 @@
#include <mmsystem.h>
#include <memory.h>
#include <commdlg.h>
#include <vfw.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#ifndef FREE_WINDOWS
#include <vfw.h>
#endif
#undef AVIIF_KEYFRAME // redefined in AVI_avi.h
@@ -65,112 +64,32 @@
#include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail
BLI_countlist BLI_stringdec */
#include "DNA_userdef_types.h"
#include "BKE_global.h"
#include "imbuf.h"
#include "imbuf_patch.h"
#include "AVI_avi.h"
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined(__APPLE__)
#include "quicktime_import.h"
#endif /* _WIN32 || __APPLE__ */
#ifdef linux
#include "quicktime_import_linux.h"
#endif /* linux */
#endif /* WITH_QUICKTIME */
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
#include "IMB_bitplanes.h"
#include "IMB_anim.h"
#include "IMB_anim5.h"
/* actually hard coded endianness */
#define GET_BIG_LONG(x) (((uchar *) (x))[0] << 24 | ((uchar *) (x))[1] << 16 | ((uchar *) (x))[2] << 8 | ((uchar *) (x))[3])
#define GET_LITTLE_LONG(x) (((uchar *) (x))[3] << 24 | ((uchar *) (x))[2] << 16 | ((uchar *) (x))[1] << 8 | ((uchar *) (x))[0])
#define SWAP_L(x) (((x << 24) & 0xff000000) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff))
#define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff))
/* more endianness... should move to a separate file... */
#if defined(__sgi) || defined (__sparc) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
#define GET_ID GET_BIG_LONG
#define LITTLE_LONG SWAP_LONG
#else
#define GET_ID GET_LITTLE_LONG
#define LITTLE_LONG ENDIAN_NOP
#endif
/****/
typedef struct Anhd{
unsigned char type, mask;
unsigned short w, h;
unsigned short x, y;
unsigned short abs16, abs, reala6, real;
unsigned char interleave, pad0;
unsigned short bits16, bits;
unsigned char pad[16];
}Anhd;
typedef struct Anim5Delta {
struct Anim5Delta * next, * prev;
void * data;
int type;
}Anim5Delta;
#define ANIM_NONE (0)
#define ANIM_SEQUENCE (1 << 0)
#define ANIM_DIR (1 << 1)
#define ANIM_ANIM5 (1 << 2)
#define ANIM_TGA (1 << 3)
#define ANIM_MOVIE (1 << 4)
#define ANIM_MDEC (1 << 5)
#define ANIM_AVI (1 << 6)
#define ANIM5_MMAP 0
#define ANIM5_MALLOC 1
#define ANIM5_SNGBUF 2
#define ANIM5_XOR 4
#define MAXNUMSTREAMS 50
struct anim {
int ib_flags;
int curtype;
int curposition; /* index 0 = 1e, 1 = 2e, enz. */
int duration;
int x, y;
/* voor op nummer */
char name[256];
/* voor sequence */
char first[256];
/* anim5 */
struct ListBase anim5base;
void * anim5mmap;
int anim5len;
struct Anim5Delta *anim5curdlta;
void (*anim5decode)(struct ImBuf *, unsigned char *);
int anim5flags;
/* movie */
void *movie;
void *track;
void *params;
int orientation;
size_t framesize;
int interlacing;
/* data */
struct ImBuf * ibuf1, * ibuf2;
/* avi */
struct _AviMovie *avi;
#ifdef _WIN32
/* windows avi */
int avistreams;
int firstvideo;
int pfileopen;
PAVIFILE pfile;
PAVISTREAM pavi[MAXNUMSTREAMS]; // the current streams
PGETFRAME pgf;
#endif
};
/****/
#ifdef __sgi
@@ -268,13 +187,13 @@ static void free_anim_movie(struct anim * anim) {
anim->duration = 0;
}
static int ismovie(char *name) {
int ismovie(char *name) {
return (mvIsMovieFile(name) == DM_TRUE);
}
#else
static int ismovie(char *name) {
int ismovie(char *name) {
return 0;
}
@@ -334,87 +253,6 @@ unsigned short numlen, int pic) {
strcat(string,staart);
}
/* om anim5's te kunnen lezen, moet een aantal gegevens bijgehouden worden:
* Een lijst van pointers naar delta's, in geheugen of ge'mmap'ed
*
* Mogelijk kan er ook een 'skiptab' aangelegd worden, om sneller
* sprongen te kunnen maken.
*
* Er moeten niet direct al plaatjes gegenereed worden, dit maakt de
* routines onbruikbaar om snel naar het goede plaatje te springen.
* Een routine voert dus de delta's uit, een andere routine maakt van
* voorgrondplaatje een ibuf;
*/
/*
een aantal functie pointers moet geinporteerd worden, zodat er niet
nog meer library's / objects meegelinkt hoeven te worden.
Dezelfde structuur moet ook gebruikt kunnen worden voor het wegschrijven
van animaties. Hoe geef je dit aan ?
Hoe snel kunnen 10 .dlta's gedecomprimeerd worden
(zonder omzetten naar rect).
1 - zoek naar 1e plaatje, animatie die aan de eisen voldoet
2 - probeer volgende plaatje te vinden:
anim5 - decomprimeer
sequence - teller ophogen
directory - volgende entry
3 - geen succes ? ga naar 1.
*/
/*
1. Initialiseer routine met toegestane reeksen, en eerste naam
- series op naam (.0001)
- directories
- anim5 animaties
- TGA delta's
- iff 24bits delta's (.delta)
2. haal volgende (vorige ?) plaatje op.
3. vrijgeven
*/
/* selectie volgorde is:
1 - anim5()
2 - name
3 - dir
*/
static void free_anim_anim5(struct anim * anim) {
ListBase * animbase;
Anim5Delta * delta, * next;
if (anim == NULL) return;
animbase = &anim->anim5base;
delta = animbase->first;
while (delta) {
next = delta->next;
if (delta->type == ANIM5_MALLOC) free(delta->data);
BLI_remlink(animbase, delta);
free(delta);
delta = next;
}
if (anim->anim5mmap && anim->anim5len) {
MEM_freeN(anim->anim5mmap);
}
anim->anim5mmap = NULL;
anim->anim5len = 0;
anim->anim5curdlta = 0;
anim->duration = 0;
}
static void free_anim_avi (struct anim *anim) {
int i;
@@ -426,7 +264,7 @@ static void free_anim_avi (struct anim *anim) {
MEM_freeN (anim->avi);
anim->avi = NULL;
#ifdef _WIN32
#if defined(_WIN32) && !defined(FREE_WINDOWS)
if (anim->pgf) {
AVIStreamGetFrameClose(anim->pgf);
@@ -448,7 +286,7 @@ static void free_anim_avi (struct anim *anim) {
anim->duration = 0;
}
static void free_anim_ibuf(struct anim * anim) {
void IMB_free_anim_ibuf(struct anim * anim) {
if (anim == NULL) return;
if (anim->ibuf1) IMB_freeImBuf(anim->ibuf1);
@@ -464,11 +302,15 @@ void IMB_free_anim(struct anim * anim) {
return;
}
free_anim_ibuf(anim);
IMB_free_anim_ibuf(anim);
free_anim_anim5(anim);
free_anim_movie(anim);
free_anim_avi(anim);
#ifdef WITH_QUICKTIME
free_anim_quicktime(anim);
#endif
free(anim);
}
@@ -491,420 +333,10 @@ struct anim * IMB_open_anim(char * name, int ib_flags) {
}
static int isavi (char *name) {
return AVI_is_avi (name);
}
static int imb_get_anim_type(char * name) {
int type;
struct stat st;
if (ib_stat(name,&st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (isavi(name)) return (ANIM_AVI);
if (ismovie(name)) return (ANIM_MOVIE);
type = IMB_ispic(name);
if (type == ANIM) return (ANIM_ANIM5);
if (type) return(ANIM_SEQUENCE);
return(0);
}
int IMB_isanim(char * name) {
int type= imb_get_anim_type(name);
return (type && type!=ANIM_SEQUENCE);
}
static void planes_to_rect(struct ImBuf * ibuf, int flags) {
if (ibuf == 0) return;
/* dit komt regelrecht uit de amiga.c */
if (flags & IB_rect && ibuf->rect == 0) {
imb_addrectImBuf(ibuf);
imb_bptolong(ibuf);
IMB_flipy(ibuf);
imb_freeplanesImBuf(ibuf);
if (ibuf->cmap){
if ((flags & IB_cmap) == 0) {
IMB_applycmap(ibuf);
IMB_convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect);
}
} else if (ibuf->depth == 18){
int i,col;
unsigned int *rect;
rect = ibuf->rect;
for(i=ibuf->x * ibuf->y ; i>0 ; i--){
col = *rect;
col = ((col & 0x3f000) << 6) + ((col & 0xfc0) << 4)
+ ((col & 0x3f) << 2);
col += (col & 0xc0c0c0) >> 6;
*rect++ = col;
}
ibuf->depth = 24;
} else if (ibuf->depth <= 8) {
/* geen colormap en geen 24 bits: zwartwit */
uchar *rect;
int size, shift;
if (ibuf->depth < 8){
rect = (uchar *) ibuf->rect;
rect += 3;
shift = 8 - ibuf->depth;
for (size = ibuf->x * ibuf->y; size > 0; size --){
rect[0] <<= shift;
rect += 4;
}
}
rect = (uchar *) ibuf->rect;
for (size = ibuf->x * ibuf->y; size > 0; size --){
rect[1] = rect[2] = rect[3];
rect += 4;
}
ibuf->depth = 8;
}
}
}
static void anim5decode(struct ImBuf * ibuf, uchar * dlta) {
uchar depth;
int skip;
int *ofspoint;
uchar **planes;
/* samenstelling delta:
lijst met ofsets voor delta's per bitplane (ofspoint)
per kolom in delta (point)
aantal handelingen (noops)
code
bijbehorende data
...
...
*/
dlta += 8;
ofspoint = (int *)dlta;
skip = ibuf->skipx * sizeof(int *);
planes = (uchar **)ibuf->planes;
for(depth=ibuf->depth ; depth>0 ; depth--){
if (GET_BIG_LONG(ofspoint)){
uchar *planestart;
uchar *point;
uchar x;
point = dlta + GET_BIG_LONG(ofspoint);
planestart = planes[0];
x = (ibuf->x + 7) >> 3;
do{
uchar noop;
if (noop = *(point++)){
uchar *plane;
uchar code;
plane = planestart;
do{
if ((code = *(point++))==0){
uchar val;
code = *(point++);
val = *(point++);
do {
plane[0] = val;
plane += skip;
} while(--code);
} else if (code & 128){
code &= 0x7f;
do{
plane[0] = *(point++);
plane += skip;
} while(--code);
} else plane += code * skip;
} while(--noop);
}
planestart++;
} while(--x);
}
ofspoint++;
planes++;
}
}
static void anim5xordecode(struct ImBuf * ibuf, uchar * dlta) {
uchar depth;
int skip;
int *ofspoint;
uchar **planes;
/* samenstelling delta:
lijst met ofsets voor delta's per bitplane (ofspoint)
per kolom in delta (point)
aantal handelingen (noops)
code
bijbehorende data
...
...
*/
dlta += 8;
ofspoint = (int *)dlta;
skip = ibuf->skipx * sizeof(int *);
planes = (uchar **)ibuf->planes;
for(depth=ibuf->depth ; depth>0 ; depth--){
if (GET_BIG_LONG(ofspoint)){
uchar *planestart;
uchar *point;
uchar x;
point = dlta + GET_BIG_LONG(ofspoint);
planestart = planes[0];
x = (ibuf->x + 7) >> 3;
do{
uchar noop;
if (noop = *(point++)){
uchar *plane;
uchar code;
plane = planestart;
do{
if ((code = *(point++))==0){
uchar val;
code = *(point++);
val = *(point++);
do{
plane[0] ^= val;
plane += skip;
}while(--code);
} else if (code & 128){
code &= 0x7f;
do{
plane[0] ^= *(point++);
plane += skip;
}while(--code);
} else plane += code * skip;
}while(--noop);
}
planestart++;
}while(--x);
}
ofspoint++;
planes++;
}
}
static int nextanim5(struct anim * anim) {
Anim5Delta * delta;
struct ImBuf * ibuf;
if (anim == 0) return(-1);
delta = anim->anim5curdlta;
if (delta == 0) return (-1);
if (anim->anim5flags & ANIM5_SNGBUF) {
ibuf = anim->ibuf1;
if (ibuf == 0) return (0);
anim->anim5decode(ibuf, delta->data);
} else {
ibuf = anim->ibuf2;
if (ibuf == 0) return (0);
anim->anim5decode(ibuf, delta->data);
anim->ibuf2 = anim->ibuf1;
anim->ibuf1 = ibuf;
}
anim->anim5curdlta = anim->anim5curdlta->next;
anim->curposition++;
return(0);
}
static int rewindanim5(struct anim * anim) {
Anim5Delta * delta;
struct ImBuf * ibuf;
if (anim == 0) return (-1);
free_anim_ibuf(anim);
delta = anim->anim5base.first;
if (delta == 0) return (-1);
ibuf = IMB_loadiffmem(delta->data, IB_planes);
if (ibuf == 0) return(-1);
anim->ibuf1 = ibuf;
if ((anim->anim5flags & ANIM5_SNGBUF) == 0) anim->ibuf2 = IMB_dupImBuf(ibuf);
anim->anim5curdlta = delta->next;
anim->curposition = 0;
return(0);
}
static int startanim5(struct anim * anim) {
int file, buf[20], totlen;
unsigned int len;
short * mem;
ListBase * animbase;
Anim5Delta * delta;
Anhd anhd;
/* Controles */
if (anim == 0) return(-1);
file = open(anim->name,O_BINARY|O_RDONLY);
if (file < 0) return (-1);
if (read(file, buf, 24) != 24) {
close(file);
return(-1);
}
if ((GET_ID(buf) != FORM) || (GET_ID(buf + 2) != ANIM)
|| (GET_ID(buf + 3) != FORM) || (GET_ID(buf + 5) != ILBM)){
printf("No anim5 file %s\n",anim->name);
close(file);
return (-1);
}
/* de hele file wordt in het geheugen gemapped */
totlen = BLI_filesize(file);
if (totlen && file>=0) {
lseek(file, 0L, SEEK_SET);
mem= MEM_mallocN(totlen, "mmap");
if (read(file, mem, totlen) != totlen) {
MEM_freeN(mem);
mem = NULL;
}
} else {
mem = NULL;
}
close (file);
if (!mem) return (-1);
anhd.interleave = 0;
anhd.bits = 0;
anhd.type = 5;
anim->anim5mmap = mem;
anim->anim5len = totlen;
anim->anim5flags = 0;
anim->duration = 0;
animbase = & anim->anim5base;
animbase->first = animbase->last = 0;
/* eerste plaatje inlezen */
mem = mem + 6;
totlen -= 12;
len = GET_BIG_LONG(mem + 2);
len = (len + 8 + 1) & ~1;
delta = NEW(Anim5Delta);
delta->data = mem;
delta->type = ANIM5_MMAP;
BLI_addtail(animbase, delta);
mem += (len >> 1);
totlen -= len;
while (totlen > 0) {
len = GET_BIG_LONG(mem + 2);
len = (len + 8 + 1) & ~1;
switch(GET_ID(mem)){
case FORM:
len = 12;
break;
case ANHD:
memcpy(&anhd, mem + 4, sizeof(Anhd));
break;
case DLTA:
delta = NEW(Anim5Delta);
delta->data = mem;
delta->type = ANIM5_MMAP;
BLI_addtail(animbase, delta);
break;
}
mem += (len >> 1);
totlen -= len;
}
if (anhd.interleave == 1) anim->anim5flags |= ANIM5_SNGBUF;
if (BIG_SHORT(anhd.bits) & 2) anim->anim5decode = anim5xordecode;
else anim->anim5decode = anim5decode;
/* laatste twee delta's wissen */
delta = animbase->last;
if (delta) {
BLI_remlink(animbase, delta);
free(delta);
}
if ((anim->anim5flags & ANIM5_SNGBUF) == 0) {
delta = animbase->last;
if (delta) {
BLI_remlink(animbase, delta);
free(delta);
}
}
anim->duration = BLI_countlist(animbase);
return(rewindanim5(anim));
}
static struct ImBuf * anim5_fetchibuf(struct anim * anim) {
struct ImBuf * ibuf;
if (anim == 0) return (0);
ibuf = IMB_dupImBuf(anim->ibuf1);
planes_to_rect(ibuf, anim->ib_flags);
return(ibuf);
}
static int startavi (struct anim *anim) {
AviError avierror;
#ifdef _WIN32
#if defined(_WIN32) && !defined(FREE_WINDOWS)
HRESULT hr;
int i, firstvideo = -1;
BYTE abFormat[1024];
@@ -922,7 +354,7 @@ static int startavi (struct anim *anim) {
avierror = AVI_open_movie (anim->name, anim->avi);
#ifdef _WIN32
#if defined(_WIN32) && !defined(FREE_WINDOWS)
if (avierror == AVI_ERROR_COMPRESSION) {
AVIFileInit();
hr = AVIFileOpen(&anim->pfile, anim->name, OF_READ, 0L);
@@ -1006,7 +438,7 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
if (anim == NULL) return (NULL);
#ifdef _WIN32
#if defined(_WIN32) && !defined(FREE_WINDOWS)
if (anim->avistreams) {
LPBITMAPINFOHEADER lpbi;
@@ -1014,6 +446,7 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
lpbi = AVIStreamGetFrame(anim->pgf, position + AVIStreamStart(anim->pavi[anim->firstvideo]));
if (lpbi) {
ibuf = IMB_ibImageFromMemory((int *) lpbi, 100, IB_rect);
//Oh brother...
}
}
} else {
@@ -1054,6 +487,9 @@ static struct ImBuf * anim_getnew(struct anim * anim) {
free_anim_anim5(anim);
free_anim_movie(anim);
free_anim_avi(anim);
#ifdef WITH_QUICKTIME
free_anim_quicktime(anim);
#endif
if (anim->curtype != 0) return (0);
anim->curtype = imb_get_anim_type(anim->name);
@@ -1075,9 +511,18 @@ static struct ImBuf * anim_getnew(struct anim * anim) {
ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); /* fake */
break;
case ANIM_AVI:
if (startavi(anim)) return (0);
if (startavi(anim)) {
printf("couldnt start avi\n");
return (0);
}
ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0);
break;
#ifdef WITH_QUICKTIME
case ANIM_QTIME:
if (startquicktime(anim)) return (0);
ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0);
break;
#endif
}
return(ibuf);
@@ -1094,7 +539,9 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) {
if (anim->curtype == 0) {
ibuf = anim_getnew(anim);
if (ibuf == NULL) return (0);
if (ibuf == NULL) {
return (0);
}
IMB_freeImBuf(ibuf); /* ???? */
}
@@ -1134,7 +581,13 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) {
ibuf = avi_fetchibuf(anim, position);
if (ibuf) anim->curposition = position;
break;
}
#ifdef WITH_QUICKTIME
case ANIM_QTIME:
ibuf = qtime_fetchibuf(anim, position);
if (ibuf) anim->curposition = position;
break;
#endif
}
if (ibuf) {
if (anim->ib_flags & IB_ttob) IMB_flipy(ibuf);

View File

@@ -0,0 +1,532 @@
/**
* anim5.c
*
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): phase, code torn apart from anim.c
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail
BLI_countlist BLI_stringdec */
#include "imbuf.h"
#include "imbuf_patch.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_cmap.h"
#include "IMB_allocimbuf.h"
#include "IMB_bitplanes.h"
#include "IMB_amiga.h"
#include "IMB_anim.h"
typedef struct Anhd{
unsigned char type, mask;
unsigned short w, h;
unsigned short x, y;
unsigned short abs16, abs, reala6, real;
unsigned char interleave, pad0;
unsigned short bits16, bits;
unsigned char pad[16];
}Anhd;
typedef struct Anim5Delta {
struct Anim5Delta * next, * prev;
void * data;
int type;
}Anim5Delta;
/* om anim5's te kunnen lezen, moet een aantal gegevens bijgehouden worden:
* Een lijst van pointers naar delta's, in geheugen of ge'mmap'ed
*
* Mogelijk kan er ook een 'skiptab' aangelegd worden, om sneller
* sprongen te kunnen maken.
*
* Er moeten niet direct al plaatjes gegenereed worden, dit maakt de
* routines onbruikbaar om snel naar het goede plaatje te springen.
* Een routine voert dus de delta's uit, een andere routine maakt van
* voorgrondplaatje een ibuf;
*/
/*
een aantal functie pointers moet geinporteerd worden, zodat er niet
nog meer library's / objects meegelinkt hoeven te worden.
Dezelfde structuur moet ook gebruikt kunnen worden voor het wegschrijven
van animaties. Hoe geef je dit aan ?
Hoe snel kunnen 10 .dlta's gedecomprimeerd worden
(zonder omzetten naar rect).
1 - zoek naar 1e plaatje, animatie die aan de eisen voldoet
2 - probeer volgende plaatje te vinden:
anim5 - decomprimeer
sequence - teller ophogen
directory - volgende entry
3 - geen succes ? ga naar 1.
*/
/*
1. Initialiseer routine met toegestane reeksen, en eerste naam
- series op naam (.0001)
- directories
- anim5 animaties
- TGA delta's
- iff 24bits delta's (.delta)
2. haal volgende (vorige ?) plaatje op.
3. vrijgeven
*/
/* selectie volgorde is:
1 - anim5()
2 - name
3 - dir
*/
void free_anim_anim5(struct anim * anim) {
ListBase * animbase;
Anim5Delta * delta, * next;
if (anim == NULL) return;
animbase = &anim->anim5base;
delta = animbase->first;
while (delta) {
next = delta->next;
if (delta->type == ANIM5_MALLOC) free(delta->data);
BLI_remlink(animbase, delta);
free(delta);
delta = next;
}
if (anim->anim5mmap && anim->anim5len) {
MEM_freeN(anim->anim5mmap);
}
anim->anim5mmap = NULL;
anim->anim5len = 0;
anim->anim5curdlta = 0;
anim->duration = 0;
}
static void planes_to_rect(struct ImBuf * ibuf, int flags) {
if (ibuf == 0) return;
/* dit komt regelrecht uit de amiga.c */
if (flags & IB_rect && ibuf->rect == 0) {
imb_addrectImBuf(ibuf);
imb_bptolong(ibuf);
IMB_flipy(ibuf);
imb_freeplanesImBuf(ibuf);
if (ibuf->cmap){
if ((flags & IB_cmap) == 0) {
IMB_applycmap(ibuf);
IMB_convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect);
}
} else if (ibuf->depth == 18){
int i,col;
unsigned int *rect;
rect = ibuf->rect;
for(i=ibuf->x * ibuf->y ; i>0 ; i--){
col = *rect;
col = ((col & 0x3f000) << 6) + ((col & 0xfc0) << 4)
+ ((col & 0x3f) << 2);
col += (col & 0xc0c0c0) >> 6;
*rect++ = col;
}
ibuf->depth = 24;
} else if (ibuf->depth <= 8) {
/* geen colormap en geen 24 bits: zwartwit */
uchar *rect;
int size, shift;
if (ibuf->depth < 8){
rect = (uchar *) ibuf->rect;
rect += 3;
shift = 8 - ibuf->depth;
for (size = ibuf->x * ibuf->y; size > 0; size --){
rect[0] <<= shift;
rect += 4;
}
}
rect = (uchar *) ibuf->rect;
for (size = ibuf->x * ibuf->y; size > 0; size --){
rect[1] = rect[2] = rect[3];
rect += 4;
}
ibuf->depth = 8;
}
}
}
static void anim5decode(struct ImBuf * ibuf, uchar * dlta) {
uchar depth;
int skip;
int *ofspoint;
uchar **planes;
/* samenstelling delta:
lijst met ofsets voor delta's per bitplane (ofspoint)
per kolom in delta (point)
aantal handelingen (noops)
code
bijbehorende data
...
...
*/
dlta += 8;
ofspoint = (int *)dlta;
skip = ibuf->skipx * sizeof(int *);
planes = (uchar **)ibuf->planes;
for(depth=ibuf->depth ; depth>0 ; depth--){
if (GET_BIG_LONG(ofspoint)){
uchar *planestart;
uchar *point;
uchar x;
point = dlta + GET_BIG_LONG(ofspoint);
planestart = planes[0];
x = (ibuf->x + 7) >> 3;
do{
uchar noop;
if (noop = *(point++)){
uchar *plane;
uchar code;
plane = planestart;
do{
if ((code = *(point++))==0){
uchar val;
code = *(point++);
val = *(point++);
do {
plane[0] = val;
plane += skip;
} while(--code);
} else if (code & 128){
code &= 0x7f;
do{
plane[0] = *(point++);
plane += skip;
} while(--code);
} else plane += code * skip;
} while(--noop);
}
planestart++;
} while(--x);
}
ofspoint++;
planes++;
}
}
static void anim5xordecode(struct ImBuf * ibuf, uchar * dlta) {
uchar depth;
int skip;
int *ofspoint;
uchar **planes;
/* samenstelling delta:
lijst met ofsets voor delta's per bitplane (ofspoint)
per kolom in delta (point)
aantal handelingen (noops)
code
bijbehorende data
...
...
*/
dlta += 8;
ofspoint = (int *)dlta;
skip = ibuf->skipx * sizeof(int *);
planes = (uchar **)ibuf->planes;
for(depth=ibuf->depth ; depth>0 ; depth--){
if (GET_BIG_LONG(ofspoint)){
uchar *planestart;
uchar *point;
uchar x;
point = dlta + GET_BIG_LONG(ofspoint);
planestart = planes[0];
x = (ibuf->x + 7) >> 3;
do{
uchar noop;
if (noop = *(point++)){
uchar *plane;
uchar code;
plane = planestart;
do{
if ((code = *(point++))==0){
uchar val;
code = *(point++);
val = *(point++);
do{
plane[0] ^= val;
plane += skip;
}while(--code);
} else if (code & 128){
code &= 0x7f;
do{
plane[0] ^= *(point++);
plane += skip;
}while(--code);
} else plane += code * skip;
}while(--noop);
}
planestart++;
}while(--x);
}
ofspoint++;
planes++;
}
}
int nextanim5(struct anim * anim) {
Anim5Delta * delta;
struct ImBuf * ibuf;
if (anim == 0) return(-1);
delta = anim->anim5curdlta;
if (delta == 0) return (-1);
if (anim->anim5flags & ANIM5_SNGBUF) {
ibuf = anim->ibuf1;
if (ibuf == 0) return (0);
anim->anim5decode(ibuf, delta->data);
} else {
ibuf = anim->ibuf2;
if (ibuf == 0) return (0);
anim->anim5decode(ibuf, delta->data);
anim->ibuf2 = anim->ibuf1;
anim->ibuf1 = ibuf;
}
anim->anim5curdlta = anim->anim5curdlta->next;
anim->curposition++;
return(0);
}
int rewindanim5(struct anim * anim) {
Anim5Delta * delta;
struct ImBuf * ibuf;
if (anim == 0) return (-1);
IMB_free_anim_ibuf(anim);
delta = anim->anim5base.first;
if (delta == 0) return (-1);
ibuf = IMB_loadiffmem(delta->data, IB_planes);
if (ibuf == 0) return(-1);
anim->ibuf1 = ibuf;
if ((anim->anim5flags & ANIM5_SNGBUF) == 0) anim->ibuf2 = IMB_dupImBuf(ibuf);
anim->anim5curdlta = delta->next;
anim->curposition = 0;
return(0);
}
int startanim5(struct anim * anim) {
int file, buf[20], totlen;
unsigned int len;
short * mem;
ListBase * animbase;
Anim5Delta * delta;
Anhd anhd;
/* Controles */
if (anim == 0) return(-1);
file = open(anim->name,O_BINARY|O_RDONLY);
if (file < 0) return (-1);
if (read(file, buf, 24) != 24) {
close(file);
return(-1);
}
if ((GET_ID(buf) != FORM) || (GET_ID(buf + 2) != ANIM)
|| (GET_ID(buf + 3) != FORM) || (GET_ID(buf + 5) != ILBM)){
printf("No anim5 file %s\n",anim->name);
close(file);
return (-1);
}
/* de hele file wordt in het geheugen gemapped */
totlen = BLI_filesize(file);
if (totlen && file>=0) {
lseek(file, 0L, SEEK_SET);
mem= MEM_mallocN(totlen, "mmap");
if (read(file, mem, totlen) != totlen) {
MEM_freeN(mem);
mem = NULL;
}
} else {
mem = NULL;
}
close (file);
if (!mem) return (-1);
anhd.interleave = 0;
anhd.bits = 0;
anhd.type = 5;
anim->anim5mmap = mem;
anim->anim5len = totlen;
anim->anim5flags = 0;
anim->duration = 0;
animbase = & anim->anim5base;
animbase->first = animbase->last = 0;
/* eerste plaatje inlezen */
mem = mem + 6;
totlen -= 12;
len = GET_BIG_LONG(mem + 2);
len = (len + 8 + 1) & ~1;
delta = NEW(Anim5Delta);
delta->data = mem;
delta->type = ANIM5_MMAP;
BLI_addtail(animbase, delta);
mem += (len >> 1);
totlen -= len;
while (totlen > 0) {
len = GET_BIG_LONG(mem + 2);
len = (len + 8 + 1) & ~1;
switch(GET_ID(mem)){
case FORM:
len = 12;
break;
case ANHD:
memcpy(&anhd, mem + 4, sizeof(Anhd));
break;
case DLTA:
delta = NEW(Anim5Delta);
delta->data = mem;
delta->type = ANIM5_MMAP;
BLI_addtail(animbase, delta);
break;
}
mem += (len >> 1);
totlen -= len;
}
if (anhd.interleave == 1) anim->anim5flags |= ANIM5_SNGBUF;
if (BIG_SHORT(anhd.bits) & 2) anim->anim5decode = anim5xordecode;
else anim->anim5decode = anim5decode;
/* laatste twee delta's wissen */
delta = animbase->last;
if (delta) {
BLI_remlink(animbase, delta);
free(delta);
}
if ((anim->anim5flags & ANIM5_SNGBUF) == 0) {
delta = animbase->last;
if (delta) {
BLI_remlink(animbase, delta);
free(delta);
}
}
anim->duration = BLI_countlist(animbase);
return(rewindanim5(anim));
}
struct ImBuf * anim5_fetchibuf(struct anim * anim) {
struct ImBuf * ibuf;
if (anim == 0) return (0);
ibuf = IMB_dupImBuf(anim->ibuf1);
planes_to_rect(ibuf, anim->ib_flags);
return(ibuf);
}

View File

@@ -46,9 +46,16 @@
#include "IMB_hamx.h"
#include "IMB_jpeg.h"
#include "IMB_bmp.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "BKE_global.h"
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined (__APPLE__)
#include "quicktime_import.h"
#elif defined (__linux__)
#include "quicktime_import_linux.h"
#endif
#endif
#ifdef WITH_FREEIMAGE
#include "IMB_freeimage.h"
#endif
/* actually hard coded endianness */
@@ -58,7 +65,7 @@
#define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff))
/* more endianness... should move to a separate file... */
#if defined(__sgi) || defined (__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
#if defined(__sgi) || defined (__sparc) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
#define GET_ID GET_BIG_LONG
#define LITTLE_LONG SWAP_LONG
#else
@@ -104,23 +111,49 @@ ImBuf *IMB_ibImageFromMemory(int *mem, int size, int flags) {
if (GET_ID(mem) == FORM){
if (GET_ID(mem+2) == ILBM){
return (imb_loadamiga(mem, flags));
} else if (GET_ID(mem+5) == ILBM){ /* animations */
} else if (GET_ID(mem+5) == ILBM){ /* animaties */
return (imb_loadamiga(mem+3, flags));
} else if (GET_ID(mem+2) == ANIM){
return (imb_loadanim(mem, flags));
}
}
}
ibuf = imb_png_decode((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
/* let quicktime handle png's, skips error messages ;)
* but only on windows
*/
#ifdef _WIN32
if(G.have_quicktime == FALSE) {
#else
if(1) {
#endif
ibuf = imb_png_decode((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
}
ibuf = imb_bmp_decode((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
ibuf = imb_loadtarga((uchar *)mem, flags);
if (ibuf) return(ibuf);
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined (__APPLE__)
if(G.have_quicktime) {
ibuf = imb_quicktime_decode((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
}
#endif
#endif
#ifdef WITH_FREEIMAGE
ibuf = imb_freeimage_decode((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
#endif
#ifdef WITH_IMAGEMAGICK
ibuf = imb_imagick_decode((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
#endif
if (IB_verbose) fprintf(stderr, "Unknown fileformat\n");
}
@@ -154,7 +187,7 @@ struct ImBuf *IMB_loadiffmem(int *mem, int flags) {
if (GET_ID(mem) == FORM){
if (GET_ID(mem+2) == ILBM){
return (imb_loadamiga(mem, flags));
} else if (GET_ID(mem+5) == ILBM){ /* animations */
} else if (GET_ID(mem+5) == ILBM){ /* animaties */
return (imb_loadamiga(mem+3, flags));
} else if (GET_ID(mem+2) == ANIM){
return (imb_loadanim(mem, flags));

View File

@@ -34,6 +34,9 @@
#include "BLI_blenlib.h"
#include "DNA_userdef_types.h"
#include "BKE_global.h"
#include "imbuf.h"
#include "imbuf_patch.h"
#include "IMB_imbuf_types.h"
@@ -43,9 +46,20 @@
#include "IMB_png.h"
#include "IMB_bmp.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "IMB_anim.h"
#ifdef WITH_QUICKTIME
#include "quicktime_import.h"
#endif
#ifdef WITH_FREEIMAGE
#include "IMB_freeimage.h"
#endif
#ifdef WITH_IMAGEMAGICK
#include "IMB_imagemagick.h"
#endif
#define UTIL_DEBUG 0
/* from misc_util: flip the bytes from x */
#define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1])
@@ -53,11 +67,13 @@
/* this one is only def-ed once, strangely... */
#define GSS(x) (((uchar *)(x))[1] << 8 | ((uchar *)(x))[0])
int IMB_ispic(char *name)
int IMB_ispic_name(char *name)
{
struct stat st;
int fp, buf[10];
int ofs = 0;
if(UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
if (ib_stat(name,&st) == -1) return(0);
if (((st.st_mode) & S_IFMT) == S_IFREG){
@@ -84,11 +100,28 @@ int IMB_ispic(char *name)
/* if ((BIG_LONG(buf[0]) == 0x10000000) && ((BIG_LONG(buf[1]) & 0xf0ffffff) == 0)) return(TIM); */
}
if (imb_is_a_png(buf)) return(PNG);
if (imb_is_a_targa(buf)) return(TGA);
if (imb_is_a_png(buf)) return(PNG);
if (imb_is_a_targa(buf)) return(TGA);
/*
if (imb_is_a_bmp(buf)) return(BMP);
if (imb_is_a_bmp(buf)) return(BMP);
*/
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined(__APPLE__)
if(G.have_quicktime) {
if (imb_is_a_quicktime(name)) return(QUICKTIME);
}
#endif
#endif
#ifdef WITH_FREEIMAGE
if (imb_is_a_freeimage(name)) return(FREEIMAGE);
#endif
#ifdef WITH_IMAGEMAGICK
if (imb_is_imagick(name)) return(IMAGEMAGICK);
#endif
return(FALSE);
}
close(fp);
@@ -96,3 +129,148 @@ int IMB_ispic(char *name)
}
return(FALSE);
}
int IMB_ispic(char *filename)
{
if(U.uiflag & FILTERFILEEXTS) {
if (G.have_quicktime){
if( BLI_testextensie(filename, ".jpg")
|| BLI_testextensie(filename, ".jpeg")
|| BLI_testextensie(filename, ".tga")
|| BLI_testextensie(filename, ".rgb")
|| BLI_testextensie(filename, ".bmp")
|| BLI_testextensie(filename, ".png")
|| BLI_testextensie(filename, ".iff")
|| BLI_testextensie(filename, ".lbm")
|| BLI_testextensie(filename, ".gif")
|| BLI_testextensie(filename, ".psd")
|| BLI_testextensie(filename, ".tif")
|| BLI_testextensie(filename, ".tiff")
|| BLI_testextensie(filename, ".pct")
|| BLI_testextensie(filename, ".pict")
|| BLI_testextensie(filename, ".pntg") //macpaint
|| BLI_testextensie(filename, ".qtif")
#if defined(WITH_FREEIMAGE) || defined (WITH_IMAGEMAGICK) //nasty for now
|| BLI_testextensie(filename, ".jng")
|| BLI_testextensie(filename, ".mng")
|| BLI_testextensie(filename, ".pbm")
|| BLI_testextensie(filename, ".pgm")
|| BLI_testextensie(filename, ".ppm")
|| BLI_testextensie(filename, ".wbmp")
|| BLI_testextensie(filename, ".cut")
|| BLI_testextensie(filename, ".ico")
|| BLI_testextensie(filename, ".koa")
|| BLI_testextensie(filename, ".koala")
|| BLI_testextensie(filename, ".pcd")
|| BLI_testextensie(filename, ".pcx")
|| BLI_testextensie(filename, ".ras")
#endif
|| BLI_testextensie(filename, ".sgi")) {
return IMB_ispic_name(filename);
} else {
return(FALSE);
}
} else { // no quicktime
if( BLI_testextensie(filename, ".jpg")
|| BLI_testextensie(filename, ".jpeg")
|| BLI_testextensie(filename, ".tga")
|| BLI_testextensie(filename, ".rgb")
|| BLI_testextensie(filename, ".bmp")
|| BLI_testextensie(filename, ".png")
|| BLI_testextensie(filename, ".iff")
|| BLI_testextensie(filename, ".lbm")
#if defined(WITH_FREEIMAGE) || defined (WITH_IMAGEMAGICK) //nasty for now
|| BLI_testextensie(filename, ".jng")
|| BLI_testextensie(filename, ".mng")
|| BLI_testextensie(filename, ".pbm")
|| BLI_testextensie(filename, ".pgm")
|| BLI_testextensie(filename, ".ppm")
|| BLI_testextensie(filename, ".wbmp")
|| BLI_testextensie(filename, ".cut")
|| BLI_testextensie(filename, ".ico")
|| BLI_testextensie(filename, ".koa")
|| BLI_testextensie(filename, ".koala")
|| BLI_testextensie(filename, ".pcd")
|| BLI_testextensie(filename, ".pcx")
|| BLI_testextensie(filename, ".ras")
|| BLI_testextensie(filename, ".gif")
|| BLI_testextensie(filename, ".psd")
|| BLI_testextensie(filename, ".tif")
|| BLI_testextensie(filename, ".tiff")
#endif
|| BLI_testextensie(filename, ".sgi")) {
return IMB_ispic_name(filename);
}
else {
return(FALSE);
}
}
} else { // no FILTERFILEEXTS
return IMB_ispic_name(filename);
}
}
static int isavi (char *name) {
return AVI_is_avi (name);
}
#ifdef WITH_QUICKTIME
static int isqtime (char *name) {
return anim_is_quicktime (name);
}
#endif
int imb_get_anim_type(char * name) {
int type;
struct stat st;
if(UTIL_DEBUG) printf("in getanimtype: %s\n", name);
if (ib_stat(name,&st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (isavi(name)) return (ANIM_AVI);
if (ismovie(name)) return (ANIM_MOVIE);
#ifdef WITH_QUICKTIME
if (isqtime(name)) return (ANIM_QTIME);
#endif
type = IMB_ispic(name);
if (type == ANIM) return (ANIM_ANIM5);
if (type) return(ANIM_SEQUENCE);
return(0);
}
int IMB_isanim(char *filename) {
int type;
if(U.uiflag & FILTERFILEEXTS) {
if (G.have_quicktime){
if( BLI_testextensie(filename, ".avi")
|| BLI_testextensie(filename, ".flc")
|| BLI_testextensie(filename, ".mov")
|| BLI_testextensie(filename, ".movie")
|| BLI_testextensie(filename, ".mv")) {
type = imb_get_anim_type(filename);
} else {
return(FALSE);
}
} else { // no quicktime
if( BLI_testextensie(filename, ".avi")
|| BLI_testextensie(filename, ".mv")) {
type = imb_get_anim_type(filename);
}
else {
return(FALSE);
}
}
} else { // no FILTERFILEEXTS
type = imb_get_anim_type(filename);
}
return (type && type!=ANIM_SEQUENCE);
}