2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2003-04-28 02:15:46 +00:00
|
|
|
*
|
|
|
|
|
* quicktime_import.c
|
|
|
|
|
*
|
|
|
|
|
* Code to use Quicktime to load images/movies as texture.
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2003-04-28 02:15:46 +00:00
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2003-04-28 02:15:46 +00:00
|
|
|
*
|
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-04-28 02:15:46 +00:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is written by Rob Haarsma (phase)
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Stefan Gartner (sgefant)
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2003-04-28 02:15:46 +00:00
|
|
|
*/
|
2011-02-27 20:01:38 +00:00
|
|
|
|
|
|
|
|
/** \file blender/quicktime/apple/quicktime_import.c
|
|
|
|
|
* \ingroup quicktime
|
|
|
|
|
*/
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#ifdef WITH_QUICKTIME
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
OS X Makefiles:
* added some new variables (mostly the same as with scons):
- USE_COCOA: use Cocoa for ghost (defaults to true)
- MACOSX_ARCHITECTURE: can be ppc, ppc64, i386, x86_64. By default this is the host architecture
(ppc for PowerPC Macs, i386 for Intel Macs). In theory this allows to cross compile blender for
a different architecture, though cross compilation only works on Intel Macs, because makesdna
and makesrna are built for the target architecture.
For a 64 bit build, set MACOSX_ARCHITECTURE to x86_64 (Intel) or ppc64 (PowerPC).
- MACOSX_MIN_VERS: minimum OS X version to run blender on (10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_DEPLOYMENT_TARGET: needed by the linker to create an Application targeted for a specific
OS version (defaults to 10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_SDK: path to a specific SDK. currently not used
- USE_QTKIT: use QTKit instead of QuickTime (defaults to true for 64 bit builds, as using QTKit
is mandatory in that case))
* use the same compiler flags as scons
* default compiler now is gcc-4.0 when building for 10.4 and gcc-4.2 when building for 10.5
* extract $(LCGDIR)/release/python_$(MACOSX_ARCHITECTURE).zip to Application bundle. This might
break building on 10.4, to fix that, rename $(LCGDIR)/release/python.zip
When compiling blender, only MACOSX_ARCHITECTURE might be of interest, as it allows doing 64 bit
builds (or 32 bit PowerPC builds on Intel). All other variables are then set to reasonable defaults.
For current users of the Makefile system, this commit shouldn't change much.
2010-01-03 20:35:13 +00:00
|
|
|
#ifndef USE_QTKIT
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2010-09-20 15:12:53 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "IMB_anim.h"
|
|
|
|
|
#include "BLO_sys_types.h"
|
2003-09-09 21:26:34 +00:00
|
|
|
#include "BKE_global.h"
|
2004-12-10 01:28:28 +00:00
|
|
|
#include "BLI_dynstr.h"
|
2012-02-05 09:29:53 +00:00
|
|
|
#include "BLI_path_util.h"
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2003-05-02 13:36:56 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
|
#include <QuickTime/Movies.h>
|
|
|
|
|
#include <QuickTime/QuickTimeComponents.h>
|
|
|
|
|
#endif
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2003-05-02 13:36:56 +00:00
|
|
|
#include <Movies.h>
|
2003-04-28 02:15:46 +00:00
|
|
|
#include <QTML.h>
|
2003-05-02 13:36:56 +00:00
|
|
|
#include <TextUtils.h>
|
2003-04-28 02:15:46 +00:00
|
|
|
#include <QuickTimeComponents.h>
|
2010-10-19 18:59:15 +00:00
|
|
|
#include <QTLoadLibraryUtils.h>
|
2003-05-02 13:36:56 +00:00
|
|
|
#endif /* _WIN32 */
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2004-12-10 13:39:05 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "quicktime_import.h"
|
2004-04-09 14:09:56 +00:00
|
|
|
#include "quicktime_export.h"
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
#define RECT_WIDTH(r) (r.right-r.left)
|
|
|
|
|
#define RECT_HEIGHT(r) (r.bottom-r.top)
|
|
|
|
|
|
2004-12-10 13:39:05 +00:00
|
|
|
#define QTIME_DEBUG 0
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-11-18 09:49:42 +00:00
|
|
|
typedef struct _QuicktimeMovie {
|
|
|
|
|
|
|
|
|
|
GWorldPtr offscreenGWorld;
|
|
|
|
|
PixMapHandle offscreenPixMap;
|
|
|
|
|
Movie movie;
|
|
|
|
|
Rect movieBounds;
|
|
|
|
|
short movieRefNum;
|
|
|
|
|
short movieResId;
|
|
|
|
|
int movWidth, movHeight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int framecount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImBuf *ibuf;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TimeValue *frameIndex;
|
|
|
|
|
Media theMedia;
|
|
|
|
|
Track theTrack;
|
|
|
|
|
long trackIndex;
|
|
|
|
|
short depth;
|
|
|
|
|
|
|
|
|
|
int have_gw; //ugly
|
|
|
|
|
} QuicktimeMovie;
|
|
|
|
|
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2003-09-18 11:41:50 +00:00
|
|
|
void quicktime_init(void)
|
2003-09-09 21:26:34 +00:00
|
|
|
{
|
2010-09-20 15:12:53 +00:00
|
|
|
OSErr nerr;
|
2010-09-21 02:45:00 +00:00
|
|
|
#ifdef _WIN32
|
2010-09-20 15:12:53 +00:00
|
|
|
QTLoadLibrary("QTCF.dll");
|
|
|
|
|
nerr = InitializeQTML(0);
|
|
|
|
|
if (nerr != noErr) {
|
2003-09-18 11:41:50 +00:00
|
|
|
G.have_quicktime = FALSE;
|
2010-09-20 15:12:53 +00:00
|
|
|
}
|
2003-09-18 11:41:50 +00:00
|
|
|
else
|
|
|
|
|
G.have_quicktime = TRUE;
|
2003-09-09 21:26:34 +00:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
2003-09-18 11:41:50 +00:00
|
|
|
/* Initialize QuickTime */
|
2003-09-09 21:26:34 +00:00
|
|
|
#if defined(_WIN32) || defined (__APPLE__)
|
2010-09-20 15:12:53 +00:00
|
|
|
nerr = EnterMovies();
|
|
|
|
|
if (nerr != noErr)
|
2003-09-18 11:41:50 +00:00
|
|
|
G.have_quicktime = FALSE;
|
|
|
|
|
else
|
2003-09-09 21:26:34 +00:00
|
|
|
#endif /* _WIN32 || __APPLE__ */
|
|
|
|
|
#ifdef __linux__
|
2003-09-18 11:41:50 +00:00
|
|
|
/* inititalize quicktime codec registry */
|
|
|
|
|
lqt_registry_init();
|
2003-09-09 21:26:34 +00:00
|
|
|
#endif
|
2003-09-18 11:41:50 +00:00
|
|
|
G.have_quicktime = TRUE;
|
2003-09-09 21:26:34 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-18 11:41:50 +00:00
|
|
|
|
|
|
|
|
void quicktime_exit(void)
|
|
|
|
|
{
|
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
|
|
|
|
#ifdef WITH_QUICKTIME
|
|
|
|
|
if(G.have_quicktime) {
|
2005-01-11 10:58:58 +00:00
|
|
|
free_qtcomponentdata();
|
2003-09-18 11:41:50 +00:00
|
|
|
ExitMovies();
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
TerminateQTML();
|
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
}
|
|
|
|
|
#endif /* WITH_QUICKTIME */
|
|
|
|
|
#endif /* _WIN32 || __APPLE__ */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-12-10 01:28:28 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
char *get_valid_qtname(char *name)
|
|
|
|
|
{
|
|
|
|
|
TCHAR Buffer[MAX_PATH];
|
|
|
|
|
DWORD dwRet;
|
|
|
|
|
char *qtname;
|
|
|
|
|
DynStr *ds= BLI_dynstr_new();
|
|
|
|
|
|
|
|
|
|
dwRet = GetCurrentDirectory(MAX_PATH, Buffer);
|
|
|
|
|
|
|
|
|
|
if(name[1] != ':') {
|
|
|
|
|
char drive[2];
|
|
|
|
|
|
2004-12-10 13:24:56 +00:00
|
|
|
if(name[0] == '/' || name[0] == '\\') {
|
2004-12-10 12:55:53 +00:00
|
|
|
drive[0] = Buffer[0];
|
|
|
|
|
drive[1] = '\0';
|
|
|
|
|
|
|
|
|
|
BLI_dynstr_append(ds, drive);
|
|
|
|
|
BLI_dynstr_append(ds, ":");
|
|
|
|
|
BLI_dynstr_append(ds, name);
|
2004-12-10 13:24:56 +00:00
|
|
|
} else {
|
|
|
|
|
BLI_dynstr_append(ds, Buffer);
|
|
|
|
|
BLI_dynstr_append(ds, "/");
|
|
|
|
|
BLI_dynstr_append(ds, name);
|
2004-12-10 12:55:53 +00:00
|
|
|
}
|
2004-12-10 01:28:28 +00:00
|
|
|
} else {
|
|
|
|
|
BLI_dynstr_append(ds, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qtname= BLI_dynstr_get_cstring(ds);
|
|
|
|
|
BLI_dynstr_free(ds);
|
|
|
|
|
|
|
|
|
|
return qtname;
|
|
|
|
|
}
|
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
|
|
|
2010-11-19 02:14:18 +00:00
|
|
|
int anim_is_quicktime (const char *name)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
|
|
|
|
FSSpec theFSSpec;
|
|
|
|
|
char theFullPath[255];
|
|
|
|
|
|
|
|
|
|
Boolean isMovieFile = false;
|
|
|
|
|
AliasHandle myAlias = NULL;
|
|
|
|
|
Component myImporter = NULL;
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
FInfo myFinderInfo;
|
|
|
|
|
FSRef myRef;
|
2004-01-08 16:28:45 +00:00
|
|
|
#else
|
2004-12-10 01:28:28 +00:00
|
|
|
char *qtname;
|
2004-01-08 16:28:45 +00:00
|
|
|
Str255 dst;
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
OSErr err = noErr;
|
|
|
|
|
|
|
|
|
|
// dont let quicktime movie import handle these
|
|
|
|
|
if( BLI_testextensie(name, ".swf") ||
|
|
|
|
|
BLI_testextensie(name, ".txt") ||
|
|
|
|
|
BLI_testextensie(name, ".mpg") ||
|
|
|
|
|
BLI_testextensie(name, ".avi") || // wouldnt be appropriate ;)
|
2003-08-05 12:44:34 +00:00
|
|
|
BLI_testextensie(name, ".tga") ||
|
|
|
|
|
BLI_testextensie(name, ".png") ||
|
2009-02-17 04:11:20 +00:00
|
|
|
BLI_testextensie(name, ".bmp") ||
|
2003-08-05 12:44:34 +00:00
|
|
|
BLI_testextensie(name, ".jpg") ||
|
2003-04-28 02:15:46 +00:00
|
|
|
BLI_testextensie(name, ".wav") ||
|
|
|
|
|
BLI_testextensie(name, ".zip") ||
|
|
|
|
|
BLI_testextensie(name, ".mp3")) return 0;
|
|
|
|
|
|
2004-12-10 13:24:56 +00:00
|
|
|
if(QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2004-12-10 01:28:28 +00:00
|
|
|
sprintf(theFullPath, "%s", name);
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
err = FSPathMakeRef(theFullPath, &myRef, 0);
|
|
|
|
|
err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
|
|
|
|
|
#else
|
2004-12-10 01:28:28 +00:00
|
|
|
qtname = get_valid_qtname(name);
|
|
|
|
|
sprintf(theFullPath, "%s", qtname);
|
|
|
|
|
MEM_freeN(qtname);
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
CopyCStringToPascal(theFullPath, dst);
|
|
|
|
|
err = FSMakeFSSpec(0, 0L, dst, &theFSSpec);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
// see whether the file type is MovieFileType; to do this, get the Finder information
|
|
|
|
|
err = FSpGetFInfo(&theFSSpec, &myFinderInfo);
|
|
|
|
|
if (err == noErr) {
|
|
|
|
|
if (myFinderInfo.fdType == kQTFileTypeMovie) {
|
|
|
|
|
return(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* on mac os x this results in using quicktime for other formats as well
|
|
|
|
|
* not sure whether this is intended
|
|
|
|
|
*/
|
|
|
|
|
// if it isn't a movie file, see whether the file can be imported as a movie
|
|
|
|
|
err = QTNewAlias(&theFSSpec, &myAlias, true);
|
|
|
|
|
if (err == noErr) {
|
|
|
|
|
if (myAlias != NULL) {
|
|
|
|
|
err = GetMovieImporterForDataRef(rAliasType, (Handle)myAlias, kGetMovieImporterDontConsiderGraphicsImporters, &myImporter);
|
|
|
|
|
DisposeHandle((Handle)myAlias);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((err == noErr) && (myImporter != NULL)) { // this file is a movie file
|
|
|
|
|
isMovieFile = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(isMovieFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
void free_anim_quicktime (struct anim *anim)
|
|
|
|
|
{
|
2003-04-28 02:15:46 +00:00
|
|
|
if (anim == NULL) return;
|
|
|
|
|
if (anim->qtime == NULL) return;
|
|
|
|
|
|
|
|
|
|
UnlockPixels(anim->qtime->offscreenPixMap);
|
|
|
|
|
|
|
|
|
|
if(anim->qtime->have_gw)
|
|
|
|
|
DisposeGWorld( anim->qtime->offscreenGWorld );
|
|
|
|
|
if(anim->qtime->ibuf)
|
|
|
|
|
IMB_freeImBuf(anim->qtime->ibuf);
|
|
|
|
|
|
|
|
|
|
DisposeMovie( anim->qtime->movie );
|
|
|
|
|
CloseMovieFile( anim->qtime->movieRefNum );
|
|
|
|
|
|
|
|
|
|
if(anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex);
|
|
|
|
|
if(anim->qtime) MEM_freeN (anim->qtime);
|
|
|
|
|
|
|
|
|
|
anim->qtime = NULL;
|
|
|
|
|
|
|
|
|
|
anim->duration = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
static OSErr QT_get_frameIndexes(struct anim *anim)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
OSErr anErr = noErr;
|
|
|
|
|
OSType media = VideoMediaType;
|
|
|
|
|
TimeValue nextTime = 0;
|
|
|
|
|
TimeValue startPoint;
|
|
|
|
|
TimeValue tmpstartPoint;
|
2007-09-02 17:25:03 +00:00
|
|
|
long sampleCount = 0;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
startPoint = -1;
|
|
|
|
|
|
|
|
|
|
GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample+nextTimeEdgeOK, (TimeValue)1, &media, 0,
|
|
|
|
|
1, &startPoint, NULL);
|
|
|
|
|
|
|
|
|
|
tmpstartPoint = startPoint;
|
|
|
|
|
|
|
|
|
|
anim->qtime->framecount = 0;
|
|
|
|
|
|
2007-09-02 17:25:03 +00:00
|
|
|
sampleCount = GetMediaSampleCount(anim->qtime->theMedia);
|
|
|
|
|
anErr = GetMoviesError();
|
|
|
|
|
if (anErr != noErr) return anErr;
|
|
|
|
|
|
|
|
|
|
anim->qtime->framecount = sampleCount;
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
anim->qtime->frameIndex = (TimeValue *) MEM_callocN(sizeof(TimeValue) * anim->qtime->framecount, "qtframeindex");
|
|
|
|
|
|
|
|
|
|
//rewind
|
|
|
|
|
GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, (TimeValue)1, 0, &tmpstartPoint, NULL);
|
|
|
|
|
|
|
|
|
|
anim->qtime->frameIndex[0] = startPoint;
|
|
|
|
|
for(i = 1; i < anim->qtime->framecount; i++) {
|
|
|
|
|
nextTime = 0;
|
|
|
|
|
GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, startPoint, 0, &nextTime, NULL);
|
|
|
|
|
startPoint = nextTime;
|
|
|
|
|
anim->qtime->frameIndex[i] = nextTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
anErr = GetMoviesError();
|
|
|
|
|
return anErr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImBuf * qtime_fetchibuf (struct anim *anim, int position)
|
|
|
|
|
{
|
|
|
|
|
PixMapHandle myPixMap = NULL;
|
|
|
|
|
Ptr myPtr;
|
|
|
|
|
|
|
|
|
|
register int index;
|
|
|
|
|
register int boxsize;
|
|
|
|
|
|
|
|
|
|
register uint32_t *readPos;
|
|
|
|
|
register uint32_t *changePos;
|
|
|
|
|
|
|
|
|
|
ImBuf *ibuf = NULL;
|
|
|
|
|
unsigned int *rect;
|
2010-09-20 15:12:53 +00:00
|
|
|
#ifdef __APPLE__
|
2006-08-28 09:30:33 +00:00
|
|
|
unsigned char *from, *to;
|
2010-09-20 15:12:53 +00:00
|
|
|
#endif
|
2004-01-08 16:28:45 +00:00
|
|
|
#ifdef _WIN32
|
2003-04-28 02:15:46 +00:00
|
|
|
unsigned char *crect;
|
2004-01-08 16:28:45 +00:00
|
|
|
#endif
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
if (anim == NULL) {
|
|
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-17 18:56:36 +00:00
|
|
|
ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect);
|
2003-04-28 02:15:46 +00:00
|
|
|
rect = ibuf->rect;
|
|
|
|
|
|
|
|
|
|
SetMovieTimeValue(anim->qtime->movie, anim->qtime->frameIndex[position]);
|
|
|
|
|
UpdateMovie(anim->qtime->movie);
|
|
|
|
|
MoviesTask(anim->qtime->movie, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
myPixMap = GetGWorldPixMap(anim->qtime->offscreenGWorld);
|
|
|
|
|
myPtr = GetPixBaseAddr(myPixMap);
|
|
|
|
|
|
|
|
|
|
if (myPtr == NULL) {
|
|
|
|
|
printf ("Error reading frame from Quicktime");
|
|
|
|
|
IMB_freeImBuf (ibuf);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boxsize = anim->x * anim->y;
|
|
|
|
|
readPos = (uint32_t *) myPtr;
|
|
|
|
|
changePos = (uint32_t *) rect; //textureIMBuf *THE* data pointerrr
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2006-08-28 09:30:33 +00:00
|
|
|
// Swap alpha byte to the end, so ARGB become RGBA;
|
|
|
|
|
from= (unsigned char *)readPos;
|
|
|
|
|
to= (unsigned char *)changePos;
|
|
|
|
|
|
|
|
|
|
for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
|
|
|
|
|
to[3] = from[0];
|
|
|
|
|
to[0] = from[1];
|
|
|
|
|
to[1] = from[2];
|
|
|
|
|
to[2] = from[3];
|
|
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
for( index = 0; index < boxsize; index++, changePos++, readPos++ )
|
|
|
|
|
*( changePos ) = *(readPos );
|
|
|
|
|
|
|
|
|
|
if(anim->qtime->depth < 32) {
|
|
|
|
|
//add alpha to ibuf
|
|
|
|
|
boxsize = anim->x * anim->y * 4;
|
|
|
|
|
crect = (unsigned char *) rect;
|
2011-11-11 13:09:14 +00:00
|
|
|
for( index = 0; index < boxsize; index+=4, crect+=4 ) {
|
|
|
|
|
crect[3] = 0xFF;
|
|
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-09-20 15:12:53 +00:00
|
|
|
ibuf->profile = IB_PROFILE_SRGB;
|
2010-01-26 02:49:30 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
IMB_flipy(ibuf);
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// following two functions only here to get movie pixeldepth
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
static int GetFirstVideoMedia(struct anim *anim)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
|
|
|
|
long numTracks;
|
|
|
|
|
OSType mediaType;
|
|
|
|
|
|
|
|
|
|
numTracks = GetMovieTrackCount(anim->qtime->movie);
|
|
|
|
|
|
|
|
|
|
for (anim->qtime->trackIndex=1; anim->qtime->trackIndex<=numTracks; (anim->qtime->trackIndex)++) {
|
|
|
|
|
anim->qtime->theTrack = GetMovieIndTrack(anim->qtime->movie, anim->qtime->trackIndex);
|
|
|
|
|
|
|
|
|
|
if (anim->qtime->theTrack)
|
|
|
|
|
anim->qtime->theMedia = GetTrackMedia(anim->qtime->theTrack);
|
|
|
|
|
|
|
|
|
|
if (anim->qtime->theMedia)
|
|
|
|
|
GetMediaHandlerDescription(anim->qtime->theMedia,&mediaType, nil, nil);
|
2004-01-08 16:28:45 +00:00
|
|
|
if (mediaType == VideoMediaType) return 1;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
anim->qtime->trackIndex = 0; // trackIndex can't be 0
|
|
|
|
|
return 0; // went through all tracks and no video
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
static short GetFirstVideoTrackPixelDepth(struct anim *anim)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
|
|
|
|
SampleDescriptionHandle imageDescH = (SampleDescriptionHandle)NewHandle(sizeof(Handle));
|
2005-03-09 19:45:59 +00:00
|
|
|
// long trackIndex = 0; /*unused*/
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
if(!GetFirstVideoMedia(anim))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!anim->qtime->trackIndex || !anim->qtime->theMedia) return -1; // we need both
|
|
|
|
|
GetMediaSampleDescription(anim->qtime->theMedia, anim->qtime->trackIndex, imageDescH);
|
|
|
|
|
|
|
|
|
|
return (*(ImageDescriptionHandle)imageDescH)->depth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int startquicktime (struct anim *anim)
|
|
|
|
|
{
|
|
|
|
|
FSSpec theFSSpec;
|
|
|
|
|
|
|
|
|
|
OSErr err = noErr;
|
|
|
|
|
char theFullPath[255];
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
FSRef myRef;
|
2004-01-08 16:28:45 +00:00
|
|
|
#else
|
2004-12-10 01:28:28 +00:00
|
|
|
char *qtname;
|
2004-01-08 16:28:45 +00:00
|
|
|
Str255 dst;
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
2007-09-02 17:25:03 +00:00
|
|
|
short depth = 0;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
anim->qtime = MEM_callocN (sizeof(QuicktimeMovie),"animqt");
|
|
|
|
|
anim->qtime->have_gw = FALSE;
|
|
|
|
|
|
|
|
|
|
if (anim->qtime == NULL) {
|
|
|
|
|
if(QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name);
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2004-12-10 01:28:28 +00:00
|
|
|
sprintf(theFullPath, "%s", anim->name);
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
err = FSPathMakeRef(theFullPath, &myRef, 0);
|
|
|
|
|
err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
|
|
|
|
|
#else
|
2004-12-10 01:28:28 +00:00
|
|
|
qtname = get_valid_qtname(anim->name);
|
|
|
|
|
sprintf(theFullPath, "%s", qtname);
|
|
|
|
|
MEM_freeN(qtname);
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
CopyCStringToPascal(theFullPath, dst);
|
|
|
|
|
FSMakeFSSpec(0, 0L, dst, &theFSSpec);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
err = OpenMovieFile(&theFSSpec, &anim->qtime->movieRefNum, fsRdPerm);
|
|
|
|
|
|
|
|
|
|
if (err == noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: movie opened\n");
|
|
|
|
|
err = NewMovieFromFile(&anim->qtime->movie,
|
|
|
|
|
anim->qtime->movieRefNum,
|
|
|
|
|
&anim->qtime->movieResId, NULL, newMovieActive, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (err) {
|
2004-01-08 16:28:45 +00:00
|
|
|
if(QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
|
2003-04-28 02:15:46 +00:00
|
|
|
if (anim->qtime->movie) {
|
|
|
|
|
DisposeMovie(anim->qtime->movie);
|
|
|
|
|
MEM_freeN(anim->qtime);
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetMovieBox(anim->qtime->movie, &anim->qtime->movieBounds);
|
|
|
|
|
anim->x = anim->qtime->movWidth = RECT_WIDTH(anim->qtime->movieBounds);
|
|
|
|
|
anim->y = anim->qtime->movHeight = RECT_HEIGHT(anim->qtime->movieBounds);
|
2004-01-08 16:28:45 +00:00
|
|
|
if(QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
if(anim->x == 0 && anim->y == 0) {
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: error, no dimensions\n");
|
|
|
|
|
free_anim_quicktime(anim);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-17 18:56:36 +00:00
|
|
|
anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld,
|
|
|
|
|
k32RGBAPixelFormat,
|
|
|
|
|
&anim->qtime->movieBounds,
|
|
|
|
|
NULL, NULL, 0,
|
|
|
|
|
(unsigned char *)anim->qtime->ibuf->rect,
|
|
|
|
|
anim->x * 4);
|
|
|
|
|
#else
|
|
|
|
|
err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld,
|
|
|
|
|
k32ARGBPixelFormat,
|
|
|
|
|
&anim->qtime->movieBounds,
|
|
|
|
|
NULL, NULL, 0,
|
|
|
|
|
(unsigned char *)anim->qtime->ibuf->rect,
|
|
|
|
|
anim->x * 4);
|
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
|
|
if(err == noErr) {
|
|
|
|
|
anim->qtime->have_gw = TRUE;
|
|
|
|
|
|
|
|
|
|
SetMovieGWorld(anim->qtime->movie,
|
2011-11-11 13:09:14 +00:00
|
|
|
anim->qtime->offscreenGWorld,
|
|
|
|
|
GetGWorldDevice(anim->qtime->offscreenGWorld));
|
2004-12-19 13:45:03 +00:00
|
|
|
SetMoviePlayHints(anim->qtime->movie, hintsHighQuality, hintsHighQuality);
|
2007-09-02 17:25:03 +00:00
|
|
|
|
|
|
|
|
// sets Media and Track!
|
|
|
|
|
depth = GetFirstVideoTrackPixelDepth(anim);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
QT_get_frameIndexes(anim);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
anim->qtime->offscreenPixMap = GetGWorldPixMap(anim->qtime->offscreenGWorld);
|
|
|
|
|
LockPixels(anim->qtime->offscreenPixMap);
|
|
|
|
|
|
|
|
|
|
//fill blender's anim struct
|
2007-09-02 17:25:03 +00:00
|
|
|
anim->qtime->depth = depth;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
anim->duration = anim->qtime->framecount;
|
|
|
|
|
anim->params = 0;
|
|
|
|
|
|
|
|
|
|
anim->interlacing = 0;
|
|
|
|
|
anim->orientation = 0;
|
|
|
|
|
anim->framesize = anim->x * anim->y * 4;
|
|
|
|
|
|
|
|
|
|
anim->curposition = 0;
|
|
|
|
|
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth,
|
|
|
|
|
anim->qtime->movHeight, anim->qtime->depth, anim->qtime->framecount);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int imb_is_a_quicktime (char *name)
|
|
|
|
|
{
|
|
|
|
|
GraphicsImportComponent theImporter = NULL;
|
|
|
|
|
|
|
|
|
|
FSSpec theFSSpec;
|
2005-03-09 19:45:59 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
Str255 dst; /*unused*/
|
|
|
|
|
#endif
|
2003-04-28 02:15:46 +00:00
|
|
|
char theFullPath[255];
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
// Boolean isMovieFile = false; /*unused*/
|
|
|
|
|
// AliasHandle myAlias = NULL; /*unused*/
|
|
|
|
|
// Component myImporter = NULL; /*unused*/
|
2003-04-28 02:15:46 +00:00
|
|
|
#ifdef __APPLE__
|
2005-03-09 19:45:59 +00:00
|
|
|
// FInfo myFinderInfo; /*unused*/
|
2003-04-28 02:15:46 +00:00
|
|
|
FSRef myRef;
|
|
|
|
|
#endif
|
|
|
|
|
OSErr err = noErr;
|
|
|
|
|
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
if(!G.have_quicktime) return 0;
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
if(QTIME_DEBUG) printf("qt: checking as image %s\n", name);
|
|
|
|
|
|
|
|
|
|
// dont let quicktime image import handle these
|
|
|
|
|
if( BLI_testextensie(name, ".swf") ||
|
|
|
|
|
BLI_testextensie(name, ".txt") ||
|
|
|
|
|
BLI_testextensie(name, ".mpg") ||
|
|
|
|
|
BLI_testextensie(name, ".wav") ||
|
|
|
|
|
BLI_testextensie(name, ".mov") || // not as image, doesn't work
|
|
|
|
|
BLI_testextensie(name, ".avi") ||
|
|
|
|
|
BLI_testextensie(name, ".mp3")) return 0;
|
|
|
|
|
|
|
|
|
|
sprintf(theFullPath, "%s", name);
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
err = FSPathMakeRef(theFullPath, &myRef, 0);
|
|
|
|
|
err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
|
|
|
|
|
#else
|
|
|
|
|
CopyCStringToPascal(theFullPath, dst);
|
|
|
|
|
err = FSMakeFSSpec(0, 0L, dst, &theFSSpec);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
GetGraphicsImporterForFile(&theFSSpec, &theImporter);
|
|
|
|
|
|
|
|
|
|
if (theImporter != NULL) {
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: %s valid\n", name);
|
|
|
|
|
CloseComponent(theImporter);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
|
|
|
|
|
{
|
|
|
|
|
Rect myRect;
|
|
|
|
|
OSErr err = noErr;
|
|
|
|
|
GraphicsImportComponent gImporter = NULL;
|
|
|
|
|
|
|
|
|
|
ImageDescriptionHandle desc;
|
|
|
|
|
|
|
|
|
|
ComponentInstance dataHandler;
|
2010-11-09 03:52:27 +00:00
|
|
|
PointerDataRef dataref;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
int x, y, depth;
|
|
|
|
|
int have_gw = FALSE;
|
|
|
|
|
ImBuf *ibuf = NULL;
|
2005-03-09 19:45:59 +00:00
|
|
|
// ImBuf *imbuf = NULL; /*unused*/
|
2003-04-28 02:15:46 +00:00
|
|
|
GWorldPtr offGWorld;
|
|
|
|
|
PixMapHandle myPixMap = NULL;
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
Ptr myPtr;
|
|
|
|
|
|
|
|
|
|
register int index;
|
|
|
|
|
register int boxsize;
|
|
|
|
|
|
|
|
|
|
register uint32_t *readPos;
|
|
|
|
|
register uint32_t *changePos;
|
|
|
|
|
|
|
|
|
|
ImBuf *wbuf = NULL;
|
|
|
|
|
unsigned int *rect;
|
2006-08-28 09:30:33 +00:00
|
|
|
unsigned char *from, *to;
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
2010-11-09 03:52:27 +00:00
|
|
|
if (mem == NULL || !G.have_quicktime)
|
2003-04-28 02:15:46 +00:00
|
|
|
goto bail;
|
|
|
|
|
|
|
|
|
|
if(QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
|
|
|
|
|
|
2010-11-09 03:52:27 +00:00
|
|
|
dataref= (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord));
|
2003-04-28 02:15:46 +00:00
|
|
|
(**dataref).data = mem;
|
|
|
|
|
(**dataref).dataLength = size;
|
|
|
|
|
|
2003-05-09 12:45:59 +00:00
|
|
|
err = OpenADataHandler((Handle)dataref,
|
2003-04-28 02:15:46 +00:00
|
|
|
PointerDataHandlerSubType,
|
|
|
|
|
nil,
|
|
|
|
|
(OSType)0,
|
|
|
|
|
nil,
|
|
|
|
|
kDataHCanRead,
|
|
|
|
|
&dataHandler);
|
|
|
|
|
if (err != noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("no datahandler\n");
|
|
|
|
|
goto bail;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-09 12:45:59 +00:00
|
|
|
err = GetGraphicsImporterForDataRef((Handle)dataref, PointerDataHandlerSubType, &gImporter);
|
2003-04-28 02:15:46 +00:00
|
|
|
if (err != noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("no graphimport\n");
|
|
|
|
|
goto bail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = GraphicsImportGetNaturalBounds(gImporter, &myRect);
|
|
|
|
|
if (err != noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("no bounds\n");
|
|
|
|
|
goto bail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = GraphicsImportGetImageDescription (gImporter, &desc );
|
|
|
|
|
if (err != noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("no imagedescription\n");
|
|
|
|
|
goto bail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x = RECT_WIDTH(myRect);
|
|
|
|
|
y = RECT_HEIGHT(myRect);
|
|
|
|
|
depth = (**desc).depth;
|
|
|
|
|
|
|
|
|
|
if (flags & IB_test) {
|
2010-10-17 18:56:36 +00:00
|
|
|
ibuf = IMB_allocImBuf(x, y, depth, 0);
|
2003-04-28 02:15:46 +00:00
|
|
|
ibuf->ftype = QUICKTIME;
|
|
|
|
|
DisposeHandle((Handle)dataref);
|
|
|
|
|
if (gImporter != NULL) CloseComponent(gImporter);
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2010-10-17 18:56:36 +00:00
|
|
|
ibuf = IMB_allocImBuf (x, y, 32, IB_rect);
|
|
|
|
|
wbuf = IMB_allocImBuf (x, y, 32, IB_rect);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
err = NewGWorldFromPtr(&offGWorld,
|
|
|
|
|
k32ARGBPixelFormat,
|
|
|
|
|
&myRect, NULL, NULL, 0,
|
|
|
|
|
(unsigned char *)wbuf->rect, x * 4);
|
|
|
|
|
#else
|
|
|
|
|
|
2010-10-17 18:56:36 +00:00
|
|
|
ibuf = IMB_allocImBuf (x, y, 32, IB_rect);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
err = NewGWorldFromPtr(&offGWorld,
|
|
|
|
|
k32RGBAPixelFormat,
|
|
|
|
|
&myRect, NULL, NULL, 0,
|
|
|
|
|
(unsigned char *)ibuf->rect, x * 4);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (err != noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("no newgworld\n");
|
|
|
|
|
goto bail;
|
|
|
|
|
} else {
|
|
|
|
|
have_gw = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphicsImportSetGWorld(gImporter, offGWorld, NULL);
|
|
|
|
|
GraphicsImportDraw(gImporter);
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
rect = ibuf->rect;
|
|
|
|
|
|
|
|
|
|
myPixMap = GetGWorldPixMap(offGWorld);
|
|
|
|
|
LockPixels(myPixMap);
|
|
|
|
|
myPtr = GetPixBaseAddr(myPixMap);
|
|
|
|
|
|
|
|
|
|
if (myPtr == NULL) {
|
|
|
|
|
printf ("Error reading frame from Quicktime");
|
|
|
|
|
IMB_freeImBuf (ibuf);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boxsize = x * y;
|
|
|
|
|
readPos = (uint32_t *) myPtr;
|
|
|
|
|
changePos = (uint32_t *) rect;
|
|
|
|
|
|
2006-08-28 09:30:33 +00:00
|
|
|
// Swap alpha byte to the end, so ARGB become RGBA;
|
|
|
|
|
from= (unsigned char *)readPos;
|
|
|
|
|
to= (unsigned char *)changePos;
|
|
|
|
|
|
|
|
|
|
for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
|
|
|
|
|
to[3] = from[0];
|
|
|
|
|
to[0] = from[1];
|
|
|
|
|
to[1] = from[2];
|
|
|
|
|
to[2] = from[3];
|
|
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
bail:
|
|
|
|
|
|
|
|
|
|
DisposeHandle((Handle)dataref);
|
|
|
|
|
UnlockPixels(myPixMap);
|
|
|
|
|
if(have_gw) DisposeGWorld(offGWorld);
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
if (wbuf) {
|
|
|
|
|
IMB_freeImBuf (wbuf);
|
|
|
|
|
wbuf = NULL;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (gImporter != NULL) CloseComponent(gImporter);
|
|
|
|
|
|
|
|
|
|
if (err != noErr) {
|
|
|
|
|
if(QTIME_DEBUG) printf("quicktime import unsuccesfull\n");
|
|
|
|
|
if (ibuf) {
|
|
|
|
|
IMB_freeImBuf (ibuf);
|
|
|
|
|
ibuf = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(ibuf) {
|
2004-04-09 14:09:56 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#ifdef _WIN32
|
2004-04-09 14:09:56 +00:00
|
|
|
// add non transparent alpha layer, so images without alpha show up in the sequence editor
|
|
|
|
|
// exception for GIF images since these can be transparent without being 32 bit
|
|
|
|
|
// (might also be nescessary for OSX)
|
2003-04-28 02:15:46 +00:00
|
|
|
int i;
|
|
|
|
|
int box = x * y;
|
|
|
|
|
unsigned char *arect = (unsigned char *) ibuf->rect;
|
|
|
|
|
|
2004-04-09 14:09:56 +00:00
|
|
|
if( depth < 32 && (**desc).cType != kGIFCodecType) {
|
2003-04-28 02:15:46 +00:00
|
|
|
for(i = 0; i < box; i++, arect+=4)
|
2011-11-11 13:09:14 +00:00
|
|
|
arect[3] = 0xFF;
|
2004-04-09 14:09:56 +00:00
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
2004-04-09 14:09:56 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
IMB_flipy(ibuf);
|
|
|
|
|
ibuf->ftype = QUICKTIME;
|
|
|
|
|
}
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
|
OS X Makefiles:
* added some new variables (mostly the same as with scons):
- USE_COCOA: use Cocoa for ghost (defaults to true)
- MACOSX_ARCHITECTURE: can be ppc, ppc64, i386, x86_64. By default this is the host architecture
(ppc for PowerPC Macs, i386 for Intel Macs). In theory this allows to cross compile blender for
a different architecture, though cross compilation only works on Intel Macs, because makesdna
and makesrna are built for the target architecture.
For a 64 bit build, set MACOSX_ARCHITECTURE to x86_64 (Intel) or ppc64 (PowerPC).
- MACOSX_MIN_VERS: minimum OS X version to run blender on (10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_DEPLOYMENT_TARGET: needed by the linker to create an Application targeted for a specific
OS version (defaults to 10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_SDK: path to a specific SDK. currently not used
- USE_QTKIT: use QTKit instead of QuickTime (defaults to true for 64 bit builds, as using QTKit
is mandatory in that case))
* use the same compiler flags as scons
* default compiler now is gcc-4.0 when building for 10.4 and gcc-4.2 when building for 10.5
* extract $(LCGDIR)/release/python_$(MACOSX_ARCHITECTURE).zip to Application bundle. This might
break building on 10.4, to fix that, rename $(LCGDIR)/release/python.zip
When compiling blender, only MACOSX_ARCHITECTURE might be of interest, as it allows doing 64 bit
builds (or 32 bit PowerPC builds on Intel). All other variables are then set to reasonable defaults.
For current users of the Makefile system, this commit shouldn't change much.
2010-01-03 20:35:13 +00:00
|
|
|
#endif /* USE_QTKIT */
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif /* _WIN32 || __APPLE__ */
|
|
|
|
|
|
|
|
|
|
#endif /* WITH_QUICKTIME */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
|
|
struct ImageDescription {
|
2011-11-11 13:09:14 +00:00
|
|
|
long idSize;
|
|
|
|
|
CodecType cType;
|
|
|
|
|
long resvd1;
|
|
|
|
|
short resvd2;
|
|
|
|
|
short dataRefIndex;
|
|
|
|
|
short version;
|
|
|
|
|
short revisionLevel;
|
|
|
|
|
long vendor;
|
|
|
|
|
CodecQ temporalQuality;
|
|
|
|
|
CodecQ spatialQuality;
|
|
|
|
|
short width;
|
|
|
|
|
short height;
|
|
|
|
|
Fixed hRes;
|
|
|
|
|
Fixed vRes;
|
|
|
|
|
long dataSize;
|
|
|
|
|
short frameCount;
|
|
|
|
|
Str31 name;
|
|
|
|
|
short depth;
|
|
|
|
|
short clutID;
|
2003-04-28 02:15:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // 0
|