[artoolkit-commits] artoolkit/lib/SRC/VideoMacOSX video.c,1.3,1.4
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
From: Philip L. <phi...@us...> - 2005-03-04 01:32:23
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoMacOSX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23203 Modified Files: video.c Log Message: Guarantee page-aligned buffers, fix minor timing bug. Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoMacOSX/video.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** video.c 7 Dec 2004 04:46:37 -0000 1.3 --- video.c 4 Mar 2005 01:31:56 -0000 1.4 *************** *** 1059,1064 **** AR2VideoParamT *vid; int keepAlive = 1; ! struct timeval tv; // Seconds and microseconds since Jan 1, 1970. ! struct timespec ts; // Seconds and nanoseconds since Jan 1, 1970. ComponentResult err; int err_i; --- 1059,1064 ---- AR2VideoParamT *vid; int keepAlive = 1; ! struct timeval tv; // Seconds and microseconds since Jan 1, 1970. ! struct timespec ts; // Seconds and nanoseconds since Jan 1, 1970. ComponentResult err; int err_i; *************** *** 1099,1105 **** gettimeofday(&tv, NULL); ! ts.tv_sec = tv.tv_sec; // TODO: Also add overflow from value below. ts.tv_nsec = tv.tv_usec * 1000 + vid->milliSecPerTimer * 1E6; ! #ifndef AR_VIDEO_HAVE_THREADSAFE_QUICKTIME // Get a lock to access QuickTime (for SGIdle()), but only if more than one thread is running. --- 1099,1108 ---- gettimeofday(&tv, NULL); ! ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000 + vid->milliSecPerTimer * 1E6; ! if (ts.tv_nsec >= 1E9) { ! ts.tv_nsec -= 1E9; ! ts.tv_sec += 1; ! } #ifndef AR_VIDEO_HAVE_THREADSAFE_QUICKTIME // Get a lock to access QuickTime (for SGIdle()), but only if more than one thread is running. *************** *** 1470,1478 **** vid->rowBytes = vid->width * bytesPerPixel; vid->bufSize = vid->height * vid->rowBytes; ! arMalloc(vid->bufPixels, ARUint8, vid->bufSize); #ifdef AR_VIDEO_DEBUG_BUFFERCOPY // And another two buffers for OpenGL to read out of. ! arMalloc(vid->bufPixelsCopy1, ARUint8, vid->bufSize); ! arMalloc(vid->bufPixelsCopy2, ARUint8, vid->bufSize); #endif // AR_VIDEO_DEBUG_BUFFERCOPY // Wrap a GWorld around the pixel buffer. --- 1473,1481 ---- vid->rowBytes = vid->width * bytesPerPixel; vid->bufSize = vid->height * vid->rowBytes; ! if (!(vid->bufPixels = (ARUint8 *)valloc(vid->bufSize * sizeof(ARUint8)))) exit (1); #ifdef AR_VIDEO_DEBUG_BUFFERCOPY // And another two buffers for OpenGL to read out of. ! if (!(vid->bufPixelsCopy1 = (ARUint8 *)valloc(vid->bufSize * sizeof(ARUint8)))) exit (1); ! if (!(vid->bufPixelsCopy2 = (ARUint8 *)valloc(vid->bufSize * sizeof(ARUint8)))) exit (1); #endif // AR_VIDEO_DEBUG_BUFFERCOPY // Wrap a GWorld around the pixel buffer. |