static int setupMovie(const char *path) { char *movieVconf; int len; int xsize, ysize; AR_PIXEL_FORMAT pixFormat; // Construct the vconf string. arMalloc(movieVconf, char, 2048); // 2Kb for URL. sprintf(movieVconf, "-device=QUICKTIME -movie=\""); // Make sure we're using the QuickTime video input. len = (int)strlen(movieVconf); strncat(movieVconf + len, path, 2048 - len - 1); len = (int)strlen(movieVconf); strncat(movieVconf + len, "\" -loop -pause", 2048 - len - 1); // Start the movie paused. It will be unpaused in mainLoop(). // Open the movie. gMovieVideo = ar2VideoOpen(movieVconf); free(movieVconf); if (!gMovieVideo) { ARLOGe("setupMovie(): Unable to open movie.\n"); return (FALSE); } // Find the size of the movie. if (ar2VideoGetSize(gMovieVideo, &xsize, &ysize) < 0) return (FALSE); // Get the pixel format of the movie. pixFormat = ar2VideoGetPixelFormat(gMovieVideo); if (pixFormat == AR_PIXEL_FORMAT_INVALID) { ARLOGe("setupMovie(): Movie is using unsupported pixel format.\n"); return (FALSE); } // Set up an ARParam object for the movie input. arParamClear(&gMovieCparam, xsize, ysize, AR_DIST_FUNCTION_VERSION_DEFAULT); // For convenience, we will use gsub_lite to draw the actual pixels. Set it up now. gMovieArglSettings = arglSetupForCurrentContext(&gMovieCparam, pixFormat); arglDistortionCompensationSet(gMovieArglSettings, 0); return (TRUE); }
static void init( void ) { ARParam cparam; ARParamLT *cparamLT; ARGViewport viewport; xsize = 640; ysize = 480; ARLOGi("Image size (x,y) = (%d,%d)\n", xsize, ysize); /* set the initial camera parameters */ arParamClear(&cparam, xsize, ysize, AR_DIST_FUNCTION_VERSION_DEFAULT); ARLOG("*** Camera Parameter ***\n"); arParamDisp( &cparam ); //COVHI10445 ignored as false positive, i.e. cparam->m[3][4] uninitialized. cparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET); arHandle = arCreateHandle(cparamLT); if( arHandle == NULL ) { ARLOGe("Error: arCreateHandle.\n"); exit(0); } arSetPixelFormat( arHandle, PIXEL_FORMAT ); arSetLabelingMode( arHandle, AR_LABELING_BLACK_REGION ); arSetImageProcMode( arHandle, AR_IMAGE_PROC_FRAME_IMAGE ); ar3DHandle = ar3DCreateHandle( &cparam ); if( ar3DHandle == NULL ) { ARLOGe("Error: ar3DCreateHandle.\n"); exit(0); } /* open the graphics window */ viewport.sx = 0; viewport.sy = 0; viewport.xsize = xsize; viewport.ysize = ysize; vp = argCreateViewport( &viewport ); if( vp == NULL ) exit(0); argViewportSetCparam( vp, &cparam ); argViewportSetPixFormat( vp, PIXEL_FORMAT ); argViewportSetDispMode( vp, AR_GL_DISP_MODE_FIT_TO_VIEWPORT ); argViewportSetDispMethod( vp, AR_GL_DISP_METHOD_GL_DRAW_PIXELS ); //argViewportSetDispMethod( vp, AR_GL_DISP_METHOD_TEXTURE_MAPPING_FRAME ); //argViewportSetDispMethod( vp, AR_GL_DISP_METHOD_TEXTURE_MAPPING_FIELD ); argViewportSetDistortionMode( vp, AR_GL_DISTORTION_COMPENSATE_DISABLE ); //argViewportSetDistortionMode( vp, AR_GL_DISTORTION_COMPENSATE_ENABLE ); #if 0 if( argSetFullScreenConfig("1024x768") == 0 ) { ARLOGe("Full screen is not possible.\n"); exit(0); } //argGetWindowSizeFullScreen( &viewport.xsize, &viewport.ysize ); viewport.sx = 0; viewport.sy = 0; viewport.xsize = 1024; viewport.ysize = 768; argViewportSetViewportFullScreen( vpL, &viewport ); viewport.sx = 1024; argViewportSetViewportFullScreen( vpR, &viewport ); #endif }