diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:24:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 10:24:53 +0400 |
commit | 5a90ea77bc1333efe4e1e54984a080550ed3f707 (patch) | |
tree | 8ba5f94ddcd2c57440197a910305daae5e913554 /source/blender/quicktime | |
parent | 69e6894b15271884623ea6f56ead06db83acbe99 (diff) |
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/quicktime')
-rw-r--r-- | source/blender/quicktime/apple/qtkit_export.m | 12 | ||||
-rw-r--r-- | source/blender/quicktime/apple/quicktime_export.c | 90 | ||||
-rw-r--r-- | source/blender/quicktime/apple/quicktime_import.c | 91 |
3 files changed, 107 insertions, 86 deletions
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 348613e8cd5..b4a89eae89e 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -485,7 +485,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R qtexport->audioFile = NULL; [qtexport->audioFileName release]; qtexport->audioFileName = nil; - } else { + } + else { UInt32 prop,propSize; /* Set up codec properties */ if (rd->qtcodecsettings.audiocodecType == kAudioFormatMPEG4AAC) { /*Lossy compressed format*/ @@ -535,7 +536,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R qtexport->movie = [[QTMovie alloc] initToWritableFile:qtexport->videoTempFileName error:&error]; } - } else + } + else qtexport->movie = [[QTMovie alloc] initToWritableFile:qtexport->filename error:&error]; if(qtexport->movie == nil) { @@ -548,7 +550,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R if (qtexport->videoTempFileName) [qtexport->videoTempFileName release]; qtexport->videoTempFileName = nil; [QTMovie exitQTKitOnThread]; - } else { + } + else { [qtexport->movie retain]; [qtexport->movie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute]; [qtexport->movie setAttribute:@"Made with Blender" forKey:QTMovieCopyrightAttribute]; @@ -661,7 +664,8 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in if (qtexport->audioOutputFormat.mFramesPerPacket) { // this is the common case: format has constant frames per packet qtexport->audioTotalSavedFrames += (audioPacketsConverted * qtexport->audioOutputFormat.mFramesPerPacket); - } else { + } + else { unsigned int i; // if there are variable frames per packet, then we have to do this for each packeet for (i = 0; i < audioPacketsConverted; ++i) diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 0ad20d1e9ab..599268b225a 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -187,7 +187,7 @@ int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue) static void CheckError(OSErr err, char *msg, ReportList *reports) { - if(err != noErr) { + if (err != noErr) { BKE_reportf(reports, RPT_ERROR, "%s: %d", msg, err); } } @@ -207,7 +207,8 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports) // check if current scene already has qtcodec settings, and clear them if (qcd) { free_qtcodecdata(qcd); - } else { + } + else { qcd = rd->qtcodecdata = MEM_callocN(sizeof(QuicktimeCodecData), "QuicktimeCodecData"); } @@ -237,7 +238,8 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports) qcd->cdSize = mySize; GetCodecInfo (&ci, qtdata->gSpatialSettings.codecType, 0); - } else { + } + else { BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed\n"); } @@ -265,7 +267,7 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports) } // restore codecsettings to the quicktime component - if(qcd->cdParms && qcd->cdSize) { + if (qcd->cdParms && qcd->cdSize) { myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle); if (myErr != noErr) { BKE_reportf(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed\n"); @@ -293,7 +295,8 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports) rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality; //Frame duration is already known (qtdata->aDataRateSetting.frameDuration) - } else { + } + else { BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed\n"); } bail: @@ -411,8 +414,8 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame, int rectx, i // the new callback based api for proper encoding, but that's not // really compatible with rendering out frames sequentially gTemporalSettings = qtdata->gTemporalSettings; - if(qtdata->gSpatialSettings.codecType == kH264CodecType) { - if(gTemporalSettings.temporalQuality != codecMinQuality) { + if (qtdata->gSpatialSettings.codecType == kH264CodecType) { + if (gTemporalSettings.temporalQuality != codecMinQuality) { BKE_reportf(reports, RPT_WARNING, "Only minimum quality compression supported for QuickTime H.264.\n"); gTemporalSettings.temporalQuality = codecMinQuality; } @@ -455,7 +458,7 @@ static void QT_DoAddVideoSamplesToMedia (int frame, int *pixels, int rectx, int //parse RGBA bitmap into Quicktime's ARGB GWorld boxsize = rectx * recty; - for( index = 0; index < boxsize; index++) { + for ( index = 0; index < boxsize; index++) { to[0] = from[3]; to[1] = from[0]; to[2] = from[1]; @@ -533,18 +536,19 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R #endif int success= 1; - if(qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport"); + if (qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport"); - if(qtdata) { - if(qtdata->theComponent) CloseComponent(qtdata->theComponent); + if (qtdata) { + if (qtdata->theComponent) CloseComponent(qtdata->theComponent); free_qtcomponentdata(); } qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeCodecDataExt"); - if(rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) { + if (rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) { get_qtcodec_settings(rd, reports); - } else { + } + else { qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType); QT_GetCodecSettingsFromScene(rd, reports); @@ -589,13 +593,14 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R &qtexport->theMovie ); CheckError(err, "CreateMovieFile error", reports); - if(err != noErr) { + if (err != noErr) { BKE_reportf(reports, RPT_ERROR, "Unable to create Quicktime movie: %s", name); success= 0; #ifdef __APPLE__ ExitMoviesOnThread(); #endif - } else { + } + else { //printf("Created QuickTime movie: %s\n", name); QT_CreateMyVideoTrack(rectx, recty, reports); @@ -617,7 +622,7 @@ void end_qt(void) OSErr err = noErr; short resId = movieInDataForkResID; - if(qtexport->theMovie) { + if (qtexport->theMovie) { QT_EndCreateMyVideoTrack(NULL); err = AddMovieResource (qtexport->theMovie, qtexport->resRefNum, &resId, qtexport->qtfilename); @@ -629,7 +634,7 @@ void end_qt(void) err = UpdateMovieResource(qtexport->theMovie, qtexport->resRefNum, resId, qtexport->qtfilename); CheckError(err, "UpdateMovieResource error", NULL); - if(qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum); + if (qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum); DisposeMovie(qtexport->theMovie); @@ -640,7 +645,7 @@ void end_qt(void) ExitMoviesOnThread(); #endif - if(qtexport) { + if (qtexport) { MEM_freeN(qtexport); qtexport = NULL; } @@ -649,8 +654,8 @@ void end_qt(void) void free_qtcomponentdata(void) { - if(qtdata) { - if(qtdata->theComponent) CloseComponent(qtdata->theComponent); + if (qtdata) { + if (qtdata->theComponent) CloseComponent(qtdata->theComponent); MEM_freeN(qtdata); qtdata = NULL; } @@ -665,7 +670,7 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports) err = SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings); CheckError(err, "SCGetInfo fr error", reports); - if( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) && + if ( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) && (qtdata->gTemporalSettings.frameRate == 1571553 || qtdata->gTemporalSettings.frameRate == 1964113 || qtdata->gTemporalSettings.frameRate == 3928227)) @@ -681,16 +686,19 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports) err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings); CheckError( err, "SCSetInfo error", reports ); - if(qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps + if (qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps qtdata->kVideoTimeScale = 24000; qtdata->duration = 1001; - } else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps + } + else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps qtdata->kVideoTimeScale = 30000; qtdata->duration = 1001; - } else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps + } + else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps qtdata->kVideoTimeScale = 60000; qtdata->duration = 1001; - } else { + } + else { qtdata->kVideoTimeScale = (qtdata->gTemporalSettings.frameRate >> 16) * 100; qtdata->duration = 100; } @@ -717,8 +725,8 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports) { OSErr err = noErr; // erase any existing codecsetting - if(qtdata) { - if(qtdata->theComponent) CloseComponent(qtdata->theComponent); + if (qtdata) { + if (qtdata->theComponent) CloseComponent(qtdata->theComponent); free_qtcomponentdata(); } @@ -727,9 +735,10 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports) qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType); // get previous selected codecsetting, from qtatom or detailed settings - if(rd->qtcodecdata && rd->qtcodecdata->cdParms) { + if (rd->qtcodecdata && rd->qtcodecdata->cdParms) { QT_GetCodecSettingsFromScene(rd, reports); - } else { + } + else { SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting); SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings); SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings); @@ -768,8 +777,8 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op) RenderData *rd = &scene->r; // erase any existing codecsetting - if(qtdata) { - if(qtdata->theComponent) CloseComponent(qtdata->theComponent); + if (qtdata) { + if (qtdata->theComponent) CloseComponent(qtdata->theComponent); free_qtcomponentdata(); } @@ -778,9 +787,10 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op) qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType); // get previous selected codecsetting, from qtatom or detailed settings - if(rd->qtcodecdata && rd->qtcodecdata->cdParms) { + if (rd->qtcodecdata && rd->qtcodecdata->cdParms) { QT_GetCodecSettingsFromScene(rd, op->reports); - } else { + } + else { SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting); SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings); SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings); @@ -836,25 +846,28 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op) QT_SaveCodecSettingsToScene(rd, op->reports); // framerate jugglin' - if(qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps + if (qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps qtdata->kVideoTimeScale = 24000; qtdata->duration = 1001; rd->frs_sec = 24; rd->frs_sec_base = 1.001; - } else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps + } + else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps qtdata->kVideoTimeScale = 30000; qtdata->duration = 1001; rd->frs_sec = 30; rd->frs_sec_base = 1.001; - } else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps + } + else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps qtdata->kVideoTimeScale = 60000; qtdata->duration = 1001; rd->frs_sec = 60; rd->frs_sec_base = 1.001; - } else { + } + else { double fps = qtdata->gTemporalSettings.frameRate; qtdata->kVideoTimeScale = 60000; @@ -863,7 +876,8 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op) if ((qtdata->gTemporalSettings.frameRate & 0xffff) == 0) { rd->frs_sec = fps / 65536; rd->frs_sec_base = 1.0; - } else { + } + else { /* we do our very best... */ rd->frs_sec = fps / 65536; rd->frs_sec_base = 1.0; diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index 5ceb80fb4b7..a1f35935877 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -125,7 +125,7 @@ void quicktime_exit(void) { #if defined(_WIN32) || defined(__APPLE__) #ifdef WITH_QUICKTIME - if(G.have_quicktime) { + if (G.have_quicktime) { free_qtcomponentdata(); ExitMovies(); #ifdef _WIN32 @@ -147,22 +147,24 @@ char *get_valid_qtname(char *name) dwRet = GetCurrentDirectory(MAX_PATH, Buffer); - if(name[1] != ':') { + if (name[1] != ':') { char drive[2]; - if(name[0] == '/' || name[0] == '\\') { + if (name[0] == '/' || name[0] == '\\') { drive[0] = Buffer[0]; drive[1] = '\0'; BLI_dynstr_append(ds, drive); BLI_dynstr_append(ds, ":"); BLI_dynstr_append(ds, name); - } else { + } + else { BLI_dynstr_append(ds, Buffer); BLI_dynstr_append(ds, "/"); BLI_dynstr_append(ds, name); } - } else { + } + else { BLI_dynstr_append(ds, name); } @@ -192,7 +194,7 @@ int anim_is_quicktime (const char *name) OSErr err = noErr; // don't let quicktime movie import handle these - if( BLI_testextensie(name, ".swf") || + if ( BLI_testextensie(name, ".swf") || BLI_testextensie(name, ".txt") || BLI_testextensie(name, ".mpg") || BLI_testextensie(name, ".avi") || // wouldnt be appropriate ;) @@ -204,7 +206,7 @@ int anim_is_quicktime (const char *name) BLI_testextensie(name, ".zip") || BLI_testextensie(name, ".mp3")) return 0; - if(QTIME_DEBUG) printf("qt: checking as movie: %s\n", name); + if (QTIME_DEBUG) printf("qt: checking as movie: %s\n", name); #ifdef __APPLE__ sprintf(theFullPath, "%s", name); @@ -257,16 +259,16 @@ void free_anim_quicktime (struct anim *anim) UnlockPixels(anim->qtime->offscreenPixMap); - if(anim->qtime->have_gw) + if (anim->qtime->have_gw) DisposeGWorld( anim->qtime->offscreenGWorld ); - if(anim->qtime->ibuf) + 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); + if (anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex); + if (anim->qtime) MEM_freeN (anim->qtime); anim->qtime = NULL; @@ -305,7 +307,7 @@ static OSErr QT_get_frameIndexes(struct anim *anim) 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++) { + for (i = 1; i < anim->qtime->framecount; i++) { nextTime = 0; GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, startPoint, 0, &nextTime, NULL); startPoint = nextTime; @@ -367,7 +369,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position) from= (unsigned char *)readPos; to= (unsigned char *)changePos; - for( index = 0; index < boxsize; index++, from+=4, to+=4 ) { + for ( index = 0; index < boxsize; index++, from+=4, to+=4 ) { to[3] = from[0]; to[0] = from[1]; to[1] = from[2]; @@ -376,14 +378,14 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position) #endif #ifdef _WIN32 - for( index = 0; index < boxsize; index++, changePos++, readPos++ ) + for ( index = 0; index < boxsize; index++, changePos++, readPos++ ) *( changePos ) = *(readPos ); - if(anim->qtime->depth < 32) { + if (anim->qtime->depth < 32) { //add alpha to ibuf boxsize = anim->x * anim->y * 4; crect = (unsigned char *) rect; - for( index = 0; index < boxsize; index+=4, crect+=4 ) { + for ( index = 0; index < boxsize; index+=4, crect+=4 ) { crect[3] = 0xFF; } } @@ -425,7 +427,7 @@ static short GetFirstVideoTrackPixelDepth(struct anim *anim) SampleDescriptionHandle imageDescH = (SampleDescriptionHandle)NewHandle(sizeof(Handle)); // long trackIndex = 0; /*unused*/ - if(!GetFirstVideoMedia(anim)) + if (!GetFirstVideoMedia(anim)) return -1; if (!anim->qtime->trackIndex || !anim->qtime->theMedia) return -1; // we need both @@ -453,11 +455,11 @@ int startquicktime (struct anim *anim) anim->qtime->have_gw = FALSE; if (anim->qtime == NULL) { - if(QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name); + 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); + if (QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name); #ifdef __APPLE__ sprintf(theFullPath, "%s", anim->name); @@ -476,18 +478,18 @@ int startquicktime (struct anim *anim) err = OpenMovieFile(&theFSSpec, &anim->qtime->movieRefNum, fsRdPerm); if (err == noErr) { - if(QTIME_DEBUG) printf("qt: movie opened\n"); + if (QTIME_DEBUG) printf("qt: movie opened\n"); err = NewMovieFromFile(&anim->qtime->movie, anim->qtime->movieRefNum, &anim->qtime->movieResId, NULL, newMovieActive, NULL); } if (err) { - if(QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name); + if (QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name); if (anim->qtime->movie) { DisposeMovie(anim->qtime->movie); MEM_freeN(anim->qtime); - if(QTIME_DEBUG) printf("qt: can't load %s\n", anim->name); + if (QTIME_DEBUG) printf("qt: can't load %s\n", anim->name); return -1; } } @@ -495,10 +497,10 @@ int startquicktime (struct anim *anim) 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); - if(QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name); + if (QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name); - if(anim->x == 0 && anim->y == 0) { - if(QTIME_DEBUG) printf("qt: error, no dimensions\n"); + if (anim->x == 0 && anim->y == 0) { + if (QTIME_DEBUG) printf("qt: error, no dimensions\n"); free_anim_quicktime(anim); return -1; } @@ -521,7 +523,7 @@ int startquicktime (struct anim *anim) anim->x * 4); #endif /* _WIN32 */ - if(err == noErr) { + if (err == noErr) { anim->qtime->have_gw = TRUE; SetMovieGWorld(anim->qtime->movie, @@ -550,7 +552,7 @@ int startquicktime (struct anim *anim) anim->curposition = 0; - if(QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth, + 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; @@ -575,12 +577,12 @@ int imb_is_a_quicktime (char *name) #endif OSErr err = noErr; - if(!G.have_quicktime) return 0; + if (!G.have_quicktime) return 0; - if(QTIME_DEBUG) printf("qt: checking as image %s\n", name); + if (QTIME_DEBUG) printf("qt: checking as image %s\n", name); // don't let quicktime image import handle these - if( BLI_testextensie(name, ".swf") || + if ( BLI_testextensie(name, ".swf") || BLI_testextensie(name, ".txt") || BLI_testextensie(name, ".mpg") || BLI_testextensie(name, ".wav") || @@ -600,7 +602,7 @@ int imb_is_a_quicktime (char *name) GetGraphicsImporterForFile(&theFSSpec, &theImporter); if (theImporter != NULL) { - if(QTIME_DEBUG) printf("qt: %s valid\n", name); + if (QTIME_DEBUG) printf("qt: %s valid\n", name); CloseComponent(theImporter); return 1; } @@ -643,7 +645,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) if (mem == NULL || !G.have_quicktime) goto bail; - if(QTIME_DEBUG) printf("qt: attempt to load mem as image\n"); + if (QTIME_DEBUG) printf("qt: attempt to load mem as image\n"); dataref= (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord)); (**dataref).data = mem; @@ -657,25 +659,25 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) kDataHCanRead, &dataHandler); if (err != noErr) { - if(QTIME_DEBUG) printf("no datahandler\n"); + if (QTIME_DEBUG) printf("no datahandler\n"); goto bail; } err = GetGraphicsImporterForDataRef((Handle)dataref, PointerDataHandlerSubType, &gImporter); if (err != noErr) { - if(QTIME_DEBUG) printf("no graphimport\n"); + if (QTIME_DEBUG) printf("no graphimport\n"); goto bail; } err = GraphicsImportGetNaturalBounds(gImporter, &myRect); if (err != noErr) { - if(QTIME_DEBUG) printf("no bounds\n"); + if (QTIME_DEBUG) printf("no bounds\n"); goto bail; } err = GraphicsImportGetImageDescription (gImporter, &desc ); if (err != noErr) { - if(QTIME_DEBUG) printf("no imagedescription\n"); + if (QTIME_DEBUG) printf("no imagedescription\n"); goto bail; } @@ -710,9 +712,10 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) #endif if (err != noErr) { - if(QTIME_DEBUG) printf("no newgworld\n"); + if (QTIME_DEBUG) printf("no newgworld\n"); goto bail; - } else { + } + else { have_gw = TRUE; } @@ -740,7 +743,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) from= (unsigned char *)readPos; to= (unsigned char *)changePos; - for( index = 0; index < boxsize; index++, from+=4, to+=4 ) { + for ( index = 0; index < boxsize; index++, from+=4, to+=4 ) { to[3] = from[0]; to[0] = from[1]; to[1] = from[2]; @@ -752,7 +755,7 @@ bail: DisposeHandle((Handle)dataref); UnlockPixels(myPixMap); - if(have_gw) DisposeGWorld(offGWorld); + if (have_gw) DisposeGWorld(offGWorld); #ifdef __APPLE__ if (wbuf) { @@ -764,14 +767,14 @@ bail: if (gImporter != NULL) CloseComponent(gImporter); if (err != noErr) { - if(QTIME_DEBUG) printf("quicktime import unsuccesfull\n"); + if (QTIME_DEBUG) printf("quicktime import unsuccesfull\n"); if (ibuf) { IMB_freeImBuf (ibuf); ibuf = NULL; } } - if(ibuf) { + if (ibuf) { #ifdef _WIN32 // add non transparent alpha layer, so images without alpha show up in the sequence editor @@ -781,8 +784,8 @@ bail: int box = x * y; unsigned char *arect = (unsigned char *) ibuf->rect; - if( depth < 32 && (**desc).cType != kGIFCodecType) { - for(i = 0; i < box; i++, arect+=4) + if ( depth < 32 && (**desc).cType != kGIFCodecType) { + for (i = 0; i < box; i++, arect+=4) arect[3] = 0xFF; } #endif |