From: <jpg...@us...> - 2007-08-13 22:42:47
|
Revision: 1081 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1081&view=rev Author: jpgrayson Date: 2007-08-13 15:42:45 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Remove unused SSUtility.[ch] code. Tidy whitespace in vdigGrab.[ch]. Modified Paths: -------------- trunk/lib/Makefile.am trunk/lib/videoLib/macosx/vdigGrab.c trunk/lib/videoLib/macosx/vdigGrab.h Removed Paths: ------------- trunk/lib/videoLib/macosx/SSUtility.c trunk/lib/videoLib/macosx/SSUtility.h Modified: trunk/lib/Makefile.am =================================================================== --- trunk/lib/Makefile.am 2007-08-13 22:41:29 UTC (rev 1080) +++ trunk/lib/Makefile.am 2007-08-13 22:42:45 UTC (rev 1081) @@ -165,8 +165,6 @@ SRCS_MACOSX= \ portmixer/px_mac_core/px_mac_core.c \ unixfuncs.c \ - videoLib/macosx/SSUtility.c \ - videoLib/macosx/SSUtility.h \ videoLib/macosx/macgrab.c \ videoLib/macosx/vdigGrab.c \ videoLib/macosx/vdigGrab.h Deleted: trunk/lib/videoLib/macosx/SSUtility.c =================================================================== --- trunk/lib/videoLib/macosx/SSUtility.c 2007-08-13 22:41:29 UTC (rev 1080) +++ trunk/lib/videoLib/macosx/SSUtility.c 2007-08-13 22:42:45 UTC (rev 1081) @@ -1,273 +0,0 @@ -/* - * SSUtility.c - * seeSaw - * - * Created by Daniel Heckenberg. - * Copyright (c) 2004 Daniel Heckenberg. All rights reserved. - * (danielh.seeSaw<at>cse<dot>unsw<dot>edu<dot>au) - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the right to use, copy, modify, merge, publish, communicate, sublicence, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * TO THE EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED - * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <math.h> - -#include "SSUtility.h" - -void -printError(const char* format, ...) -{ - va_list arglist; - fprintf(stderr, "seeSaw: "); - va_start( arglist, format ); - vfprintf( stderr, format, arglist ); - va_end( arglist ); -} - -long inline -min (long l1, long l2) -{ - return (l1 < l2) ? l1 : l2; -} - -int inline -ceilpow2i(int i) -{ - return 1 << (int) ceil(log2(i)); -} - -float inline -ceilpow2f(float f) -{ - return (float) (1L << (long) ceil(log2(f))); -} - -#pragma mark ---- Window Management data ---- - -#define HASHTABLE_SIZE 16 - -typedef struct tagIDPair -{ - int ID; - void* pData; - struct tagIDPair* pNext; -} IDPair; - -typedef struct tagHashTable -{ - int size; - IDPair** ppEntries; -} HashTable; - -static HashTable* gpHT = NULL; - -#pragma mark ---- Hash table forward declarations ---- - -/* Forward declaration of Hash table functions */ -HashTable* -hashNew(int size); - -void -hashDelete(HashTable* pHT); - -int -hashInsert(HashTable* pHT, int ID, void* pData); - -void* -hashRemove(HashTable* pHT, int ID); - -void* -hashRecall(HashTable* pHT, int ID); - -#pragma mark ---- Window Management functions ---- - -static HashTable* -getHT(void) -{ - if (!gpHT) - { - gpHT = hashNew(HASHTABLE_SIZE); - } - return gpHT; -} - -void* -getDataForID(int ID) -{ - void* pData; - if ((pData = hashRecall(getHT(), ID))) - return pData; - else - { - printError("getDataForID: ID not found\n"); - return NULL; - } -} - -void* -addDataforID(int ID, void* pData) -{ - if ((hashInsert(getHT(), ID, pData))) - { - return pData; - } else - { - printError("addDataforID: no more windows available\n"); - return NULL; - } -} - -void -removeDataforID(int ID) -{ - if (!hashRemove(getHT(), ID)) - { - printError("removeDataforID: ID not found\n"); - } -} - -#pragma mark ---- Hash table functions ---- - -int hashFunction(HashTable* pHT, int ID) -{ - return ID % pHT->size; -} - -HashTable* hashNew(int size) -{ - int i; - HashTable* pHT; - - pHT = (HashTable*) malloc(sizeof(HashTable)); - if (pHT) - { - if ((pHT->ppEntries = (IDPair**)malloc(sizeof(IDPair*)*size))) - { - pHT->size = size; - for (i = 0; i < size; ++i) - { - pHT->ppEntries[i] = NULL; - } - } else - { - free(pHT); - pHT = NULL; - } - } - return pHT; -} - -void -hashDelete(HashTable* pHT) -{ - int h; - IDPair* pEntry = NULL; - IDPair* pEntryNext = NULL; - - for (h = 0; h < pHT->size; ++h) - { - for (pEntry = pHT->ppEntries[h]; pEntry; ) - { - pEntryNext = pEntry->pNext; - free(pEntry); - pEntry = pEntryNext; - } - } -} - -IDPair* -hashLocate(HashTable* pHT, int ID, int createFlag) -{ - int h; - IDPair* pEntry = NULL; - - h = hashFunction(pHT, ID); - for (pEntry = pHT->ppEntries[h]; pEntry; pEntry=pEntry->pNext) - { - if ((pEntry->ID) == ID) - return pEntry; - } - if (createFlag) - { - pEntry = (IDPair*) malloc(sizeof(IDPair)); - pEntry->ID = ID; - pEntry->pData = NULL; - pEntry->pNext = pHT->ppEntries[h]; - pHT->ppEntries[h] = pEntry; - } - return pEntry; -} - -void* -hashRemove(HashTable* pHT, int ID) -{ - int h; - IDPair* pEntry = NULL; - IDPair* pLastEntry = NULL; - void* pData = NULL; - - h = hashFunction(pHT, ID); - for (pEntry = pHT->ppEntries[h]; pEntry; pLastEntry=pEntry, pEntry=pEntry->pNext) - { - if ((pEntry->ID) == ID) - { - if (pEntry == pHT->ppEntries[h]) - { - pHT->ppEntries[h] = pEntry->pNext; - } else if (pLastEntry) - { - pLastEntry->pNext = pEntry->pNext; - } - pData = pEntry->pData; - free(pEntry); - break; - } - } - return pData; -} - -int -hashInsert(HashTable* pHT, int ID, void* pData) -{ - IDPair* pEntry = NULL; - - // Fail on duplicate ID - if (hashLocate(pHT, ID, 0)) - return 0; - - pEntry = hashLocate(pHT, ID, 1); - pEntry->pData = pData; - return 1; -} - -void* -hashRecall(HashTable* pHT, int ID) -{ - IDPair* pEntry = NULL; - - if((pEntry = hashLocate(pHT, ID, 0))) - { - return pEntry->pData; - } - - return NULL; -} Deleted: trunk/lib/videoLib/macosx/SSUtility.h =================================================================== --- trunk/lib/videoLib/macosx/SSUtility.h 2007-08-13 22:41:29 UTC (rev 1080) +++ trunk/lib/videoLib/macosx/SSUtility.h 2007-08-13 22:42:45 UTC (rev 1081) @@ -1,55 +0,0 @@ -/* - * SSUtility.h - * seeSaw - * - * Created by Daniel Heckenberg. - * Copyright (c) 2004 Daniel Heckenberg. All rights reserved. - * (danielh.seeSaw<at>cse<dot>unsw<dot>edu<dot>au) - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the right to use, copy, modify, merge, publish, communicate, sublicence, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * TO THE EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED - * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef SSUTILITY_H -#define SSUTILITY_H - -void -printError(const char* format, ...); - -long inline -min (long l1, long l2); - -int inline -ceilpow2i(int i); - -float inline -ceilpow2f(float f); - -#pragma mark ---- Window Management functions ---- - -void* -getDataForID(int ID); - -void* -addDataforID(int ID, void* pData); - -void -removeDataforID(int ID); - -#endif //SSUTILITY_H \ No newline at end of file Modified: trunk/lib/videoLib/macosx/vdigGrab.c =================================================================== --- trunk/lib/videoLib/macosx/vdigGrab.c 2007-08-13 22:41:29 UTC (rev 1080) +++ trunk/lib/videoLib/macosx/vdigGrab.c 2007-08-13 22:42:45 UTC (rev 1081) @@ -26,11 +26,8 @@ * */ -#include "SSUtility.h" #include "vdigGrab.h" -#pragma mark ---- VdigGrab data ---- - struct tagVdigGrab { // State @@ -60,13 +57,11 @@ Fixed cpFrameRate; }; -#pragma mark ---- Forward declarations ---- - Boolean MySGModalFilterProc ( - DialogPtr theDialog, - const EventRecord *theEvent, - short *itemHit, - long refCon ); + DialogPtr theDialog, + const EventRecord *theEvent, + short *itemHit, + long refCon ); SeqGrabComponent MakeSequenceGrabber(WindowRef pWindow); @@ -80,8 +75,6 @@ OSErr vdgGetSettings(VdigGrab* pVdg); -#pragma mark ---- VdigGrab functions ---- - VdigGrab* vdgNew() { @@ -122,14 +115,16 @@ { OSErr err; - // Use the SG Dialog to allow the user to select device and compression settings - /* if (err = RequestSGSettings( pVdg->seqGrab, - pVdg->sgchanVideo)) + // Use the SG Dialog to allow the user to select device and + // compression settings +#if 0 + if (err = RequestSGSettings( pVdg->seqGrab, + pVdg->sgchanVideo)) { printError("RequestSGSettings err=%d\n", err); goto endFunc; } - */ +#endif if ((err = vdgGetSettings(pVdg))) { printError("vdgGetSettings err=%d\n", err); @@ -230,8 +225,8 @@ /* // Apple's SoftVDig doesn't seem to like these calls - if (err = VDCaptureStateChanging( pVdg->vdCompInst, - vdFlagCaptureLowLatency | vdFlagCaptureSetSettingsBegin)) + if (err = VDCaptureStateChanging(pVdg->vdCompInst, + vdFlagCaptureLowLatency | vdFlagCaptureSetSettingsBegin)) { printError("VDCaptureStateChanging err=%d\n", err); // goto endFunc; @@ -329,7 +324,7 @@ goto endFunc; } - if ((err = VDCompressOneFrameAsync( pVdg->vdCompInst ))) + if ((err = VDCompressOneFrameAsync( pVdg->vdCompInst ))) { printError("VDCompressOneFrameAsync err=%d\n", err); goto endFunc; @@ -349,9 +344,9 @@ OSErr vdgGetDataRate( VdigGrab* pVdg, - long* pMilliSecPerFrame, - Fixed* pFramesPerSecond, - long* pBytesPerSecond) + long* pMilliSecPerFrame, + Fixed* pFramesPerSecond, + long* pBytesPerSecond) { OSErr err; @@ -370,7 +365,7 @@ OSErr vdgGetImageDescription( VdigGrab* pVdg, - ImageDescriptionHandle vdImageDesc ) + ImageDescriptionHandle vdImageDesc ) { OSErr err; @@ -401,29 +396,51 @@ (*pVdg->vdImageDesc)->cType = FOUR_CHAR_CODE('yuvu'); // kYUVUPixelFormat // make a scaling matrix for the sequence -// sourceRect.right = (*pVdg->vdImageDesc)->width; -// sourceRect.bottom = (*pVdg->vdImageDesc)->height; -// RectMatrix(&scaleMatrix, &sourceRect, &pMungData->bounds); + //sourceRect.right = (*pVdg->vdImageDesc)->width; + //sourceRect.bottom = (*pVdg->vdImageDesc)->height; + //RectMatrix(&scaleMatrix, &sourceRect, &pMungData->bounds); - // begin the process of decompressing a sequence of frames - // this is a set-up call and is only called once for the sequence - the ICM will interrogate different codecs - // and construct a suitable decompression chain, as this is a time consuming process we don't want to do this - // once per frame (eg. by using DecompressImage) - // for more information see Ice Floe #8 http://developer.apple.com/quicktime/icefloe/dispatch008.html - // the destination is specified as the GWorld - if ((err = DecompressSequenceBeginS(&pVdg->dstImageSeq, // pointer to field to receive unique ID for sequence - pVdg->vdImageDesc, // handle to image description structure + // begin the process of decompressing a sequence of frames + // this is a set-up call and is only called once for the sequence + // - the ICM will interrogate different codecs and construct a + // suitable decompression chain, as this is a time consuming + // process we don't want to do this once per frame (eg. by using + // DecompressImage) for more information see Ice Floe #8 + // http://developer.apple.com/quicktime/icefloe/dispatch008.html + // the destination is specified as the GWorld + if ((err = DecompressSequenceBeginS( + // pointer to field to receive unique + // ID for sequence + &pVdg->dstImageSeq, + // handle to image description structure + pVdg->vdImageDesc, 0, 0, - dstPort, //GetWindowPort(pMungData->pWindow), // port for the DESTINATION image - NULL, // graphics device handle, if port is set, set to NULL - NULL, //&sourceRect, // source rectangle defining the portion of the image to decompress - NULL, //&scaleMatrix, // transformation matrix - srcCopy, // transfer mode specifier - (RgnHandle)NULL, // clipping region in dest. coordinate system to use as a mask + // port for the DESTINATION image + //GetWindowPort(pMungData->pWindow), + dstPort, + // graphics device handle, if port is + // set, set to NULL + NULL, + // source rectangle defining the + // portion of the image to decompress + //&sourceRect, + NULL, + // transformation matrix + //&scaleMatrix, + NULL, + // transfer mode specifier + srcCopy, + // clipping region in dest. coordinate + // system to use as a mask + (RgnHandle)NULL, 0, // flags - codecHighQuality, //codecNormalQuality, // accuracy in decompression - bestSpeedCodec))) //anyCodec); //bestSpeedCodec); // compressor identifier or special identifiers ie. bestSpeedCodec + // accuracy in decompression + codecHighQuality, + // compressor identifier or special + // identifiers ie. bestSpeedCodec + bestSpeedCodec))) + //anyCodec); //bestSpeedCodec); { printError("DecompressSequenceBeginS err=%d\n", err); goto endFunc; @@ -434,9 +451,9 @@ } OSErr -vdgDecompressionSequenceWhen( VdigGrab* pVdg, - Ptr theData, - long dataSize) +vdgDecompressionSequenceWhen(VdigGrab* pVdg, + Ptr theData, + long dataSize) { OSErr err; CodecFlags ignore = 0; @@ -665,8 +682,6 @@ free(pVdg); } -#pragma mark ---- Vdig utility functions ---- - OSErr vdgGetSettings(VdigGrab* pVdg) { @@ -691,8 +706,8 @@ } // Get the selected vdig from the SG - if (!(pVdg->vdCompInst = SGGetVideoDigitizerComponent(pVdg->sgchanVideo))) - { + if (!(pVdg->vdCompInst = SGGetVideoDigitizerComponent(pVdg->sgchanVideo))) + { printError("SGGetVideoDigitizerComponent error\n"); goto endFunc; } @@ -770,8 +785,8 @@ goto endFunc; } -// err = SGSetChannelBounds(*sgchanVideo, rect); - // set usage for new video channel to avoid playthrough + //err = SGSetChannelBounds(*sgchanVideo, rect); + // set usage for new video channel to avoid playthrough // note we don't set seqGrabPlayDuringRecord if ((err = SGSetChannelUsage(*psgchanVideo, flags | seqGrabRecord))) { @@ -791,12 +806,11 @@ } OSErr -RequestSGSettings( SeqGrabComponent seqGrab, - SGChannel sgchanVideo ) +RequestSGSettings( SeqGrabComponent seqGrab, SGChannel sgchanVideo ) { OSErr err; - SGModalFilterUPP MySGModalFilterUPP; + SGModalFilterUPP MySGModalFilterUPP; if (!(MySGModalFilterUPP = NewSGModalFilterUPP (MySGModalFilterProc))) { printError("NewSGModalFilterUPP error\n"); @@ -805,9 +819,11 @@ } // let the user configure and choose the device and settings - // "Due to a bug in all versions QuickTime 6.x for the function call "SGSettingsDialog()" - // when used with the "seqGrabSettingsPreviewOnly" parameter, all third party panels will - // be excluded." from http://www.outcastsoft.com/ASCDFG1394.html 15/03/04 + // "Due to a bug in all versions QuickTime 6.x for the function call + // "SGSettingsDialog()" when used with the + // "seqGrabSettingsPreviewOnly" parameter, all third party panels + // will be excluded." + // from http://www.outcastsoft.com/ASCDFG1394.html 15/03/04 //if (err = SGSettingsDialog(seqGrab, sgchanVideo, 0, NULL, seqGrabSettingsPreviewOnly, MySGModalFilterUPP, 0)) if ((err = SGSettingsDialog(seqGrab, sgchanVideo, 0, NULL, 0, MySGModalFilterUPP, 0))) @@ -828,18 +844,18 @@ // From QT sample code // Declaration of a typical application-defined function Boolean MySGModalFilterProc ( - DialogPtr theDialog, - const EventRecord *theEvent, - short *itemHit, - long refCon ) + DialogPtr theDialog, + const EventRecord *theEvent, + short *itemHit, + long refCon ) { // Ordinarily, if we had multiple windows we cared about, we'd handle // updating them in here, but since we don't, we'll just clear out // any update events meant for us - Boolean handled = false; + Boolean handled = false; if ((theEvent->what == updateEvt) && - ((WindowPtr) theEvent->message == (WindowPtr) refCon)) + ((WindowPtr) theEvent->message == (WindowPtr) refCon)) { BeginUpdate ((WindowPtr) refCon); EndUpdate ((WindowPtr) refCon); @@ -848,12 +864,10 @@ return (handled); } -#pragma mark ---- Public utility functions ---- - OSErr -createOffscreenGWorld( GWorldPtr* pGWorldPtr, - OSType pixelFormat, - Rect* pBounds) +createOffscreenGWorld(GWorldPtr* pGWorldPtr, + OSType pixelFormat, + Rect* pBounds) { OSErr err; CGrafPtr theOldPort; @@ -871,8 +885,8 @@ goto endFunc; } - // lock the pixmap and make sure it's locked because - // we can't decompress into an unlocked PixMap + // lock the pixmap and make sure it's locked because + // we can't decompress into an unlocked PixMap if (!LockPixels(GetGWorldPixMap(*pGWorldPtr))) printError("createOffscreenGWorld: Can't lock pixels!\n"); @@ -894,5 +908,3 @@ DisposeGWorld(gworld); } - - Modified: trunk/lib/videoLib/macosx/vdigGrab.h =================================================================== --- trunk/lib/videoLib/macosx/vdigGrab.h 2007-08-13 22:41:29 UTC (rev 1080) +++ trunk/lib/videoLib/macosx/vdigGrab.h 2007-08-13 22:42:45 UTC (rev 1081) @@ -32,12 +32,8 @@ #include <Carbon/Carbon.h> #include <QuickTime/QuickTime.h> -#pragma mark ---- VdigGrab data ---- - typedef struct tagVdigGrab VdigGrab; -#pragma mark ---- VdigGrab functions ---- - VdigGrab* vdgNew(); @@ -109,8 +105,6 @@ void vdgDelete(VdigGrab* pVdg); -#pragma mark ---- Utility functions ---- - OSErr createOffscreenGWorld( GWorldPtr* pGWorldPtr, OSType pixelFormat, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |