/* * void PsychQTExitMovies() - Shutdown handler. * * This routine is called by Screen('CloseAll') and on clear Screen time to * do final cleanup. It deletes all Quicktime textures and releases all Quicktime * movie objects. * */ void PsychQTExitMovies(void) { PsychWindowRecordType **windowRecordArray; int i, numWindows; // Release all Quicktime related OpenGL textures: PsychCreateVolatileWindowRecordPointerList(&numWindows, &windowRecordArray); for(i=0; i<numWindows; i++) { // Delete all Quicktime textures: if ((windowRecordArray[i]->windowType == kPsychTexture) && (windowRecordArray[i]->targetSpecific.QuickTimeGLTexture !=NULL)) { PsychCloseWindow(windowRecordArray[i]); } } PsychDestroyVolatileWindowRecordPointerList(windowRecordArray); // Release all movies: PsychQTDeleteAllMovies(); // Shutdown Quicktime toolbox: We skip this, because according to Apple its not necessary, // and for some reason it reliably hangs Matlab, so one has to force-quit it :-( // Don't do this: ExitMovies(); #if PSYCH_SYSTEM == PSYCH_WINDOWS // Shutdown Quicktime core system: ExitMovies(); // Shutdown Quicktime for Windows compatibility layer: TerminateQTML(); #endif return; }
int CSimplePlayerMFCApp::ExitInstance() { // Exit QuickTime and terminate QTML ExitMovies(); TerminateQTML(); return CWinApp::ExitInstance(); }
// ----------------------------------------------------------------------------------------- // platformWindup() // ----------------------------------------------------------------------------------------- // performs any platform-specific deinitialisation when the program terminates // used to shut down QuickTime // ----------------------------------------------------------------------------------------- void platformWindup(void) { #ifdef QuickTimeInstalled ExitMovies(); #ifdef _WIN32 TerminateQTML(); #endif #endif // QuickTimeInstalled }
//---------------------------------------- void closeQuicktime(){ if (bQuicktimeInitialized == true){ ExitMovies(); #ifdef TARGET_WIN32 TerminateQTML(); #endif bQuicktimeInitialized = false; } }
void wxExitQT() { //Note that ExitMovies() is not necessary, but //the docs are fuzzy on whether or not TerminateQTML is ExitMovies(); #ifndef __WXMAC__ TerminateQTML(); #endif }
//////////////////////////////////////////////////////////////////////////////// // (static) super-uninitialization - called once at application closedown bool LLMediaImplQuickTime::closedown() { ExitMovies(); #ifdef WIN32 TerminateQTML(); #endif return true; }
void qtCanvas::systemExit() { if (qtCanvas::systemInited) { #ifdef _WIN32 TerminateQTML(); #endif qtCanvas::systemInited = false; } }
~QTImportPlugin() { if (mInitialized) { ExitMovies(); #if defined(__WXMSW__) TerminateQTML(); #endif } mInitialized = false; }
virtual ~wxQTTimer() { if(m_pbPlaying) *m_pbPlaying = false; StopMovie(m_movie); DisposeMovie(m_movie); Stop(); //Note that ExitMovies() is not necessary, but //the docs are fuzzy on whether or not TerminateQTML is ExitMovies(); #ifndef __WXMAC__ TerminateQTML(); #endif }
/* WinMain */ int CALLBACK WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { MSG msg; HANDLE hAccel; // Store our module handle ghModule = GetModuleHandle(NULL); // Initialize QuickTime Media Layer InitializeQTML(0); // Initialize QuickTime EnterMovies(); // Initialize the app if (!InitializeApp()) { MessageBox(ghwndMain, "MDI: InitializeApp failure!", "Error", MB_OK); return 0; } // Load our accelerator keys if (!(hAccel = LoadAccelerators (ghModule, MAKEINTRESOURCE(ACCEL_ID)))) MessageBox(ghwndMain, "MDI: Load Accel failure!", "Error", MB_OK); // Parse the command line for drag and drop ParseCmdLinePriv(NULL); // Loop for messages while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator( ghwndMain, hAccel, &msg) && !TranslateMDISysAccel( ghwndClient, &msg) ) { TranslateMessage(&msg); DispatchMessage(&msg); } } // Deinitialize QuickTime ExitMovies(); // Deinitialize QTML TerminateQTML(); return TRUE; }
QTImportPlugin() : ImportPlugin(wxArrayString(WXSIZEOF(exts), exts)), mInitialized(false) { OSErr err = noErr; #if defined(__WXMSW__) err = ::InitializeQTML(0); #endif if (err == noErr) { err = ::EnterMovies(); if (err == noErr) { mInitialized = true; } else { #if defined(__WXMSW__) TerminateQTML(); #endif } } }
int convertMain (int argc, char * const argv[]) { #if TARGET_OS_WIN32 QTLicenseRef aacEncoderLicenseRef = nil; QTLicenseRef amrEncoderLicenseRef = nil; OSErr localerr; #endif int result = 0; CFURLRef inputFileURL = NULL; CFURLRef outputFileURL = NULL; #if TARGET_OS_WIN32 InitializeQTML(0L); { OSErr localerr; const char *licenseDesc = "AAC Encode License Verification"; const char *amrLicenseDesc = "AMR Encode License Verification"; localerr = QTRequestLicensedTechnology("com.apple.quicktimeplayer","com.apple.aacencoder", (void *)licenseDesc,strlen(licenseDesc),&aacEncoderLicenseRef); localerr = QTRequestLicensedTechnology("com.apple.quicktimeplayer","1D07EB75-3D5E-4DA6-B749-D497C92B06D8", (void *)amrLicenseDesc,strlen(amrLicenseDesc),&amrEncoderLicenseRef); } #endif try { OSType format = 0; Float64 sampleRate = 0; AudioFileTypeID outputFileType = kAudioFileCAFType; UInt32 outputBitRate = 0; UInt32 outputBitDepth = 0; ParseArgs (argc, argv, format, sampleRate, outputFileType, inputFileURL, outputFileURL, outputBitDepth, outputBitRate); // printf ("args:%4.4s, sample rate:%.1f, outputFileType: %4.4s\n", (char*)&format, sampleRate, (char*)&outputFileType); CAStreamBasicDescription inputFormat; CAStreamBasicDescription outputFormat; ConstructOutputFormatFromArgs (inputFileURL, outputFileType, format, sampleRate, inputFormat, outputBitDepth, outputFormat); printf ("Source File format:\n\t"); inputFormat.Print(); printf ("Dest File format:\n\t"); outputFormat.Print(); result = ConvertFile (inputFileURL, inputFormat, outputFileURL, outputFileType, outputFormat, outputBitRate); CFStringRef path = CFURLCopyPath(outputFileURL); printf("done: "); fflush(stdout); CFShow(path); if (path) CFRelease(path); } catch (CAXException e) { char buf[256]; fprintf(stderr, "Error in: %s\nException thrown: %s\n", e.mOperation, e.FormatError(buf)); result = 1; } catch (...) { fprintf(stderr, "Unspecified exception\n"); result = 1; } if (inputFileURL) CFRelease(inputFileURL); if (outputFileURL) CFRelease(outputFileURL); #if TARGET_OS_WIN32 TerminateQTML(); if (aacEncoderLicenseRef) { localerr = QTReleaseLicensedTechnology(aacEncoderLicenseRef); aacEncoderLicenseRef = nil; } if(amrEncoderLicenseRef) { localerr = QTReleaseLicensedTechnology(amrEncoderLicenseRef); amrEncoderLicenseRef = nil; } #endif return result; }
void QTCode_QTCleanUp() { /* Clean up */ ExitMovies(); TerminateQTML(); }
int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR theCmdLine, int nCmdShow) { HANDLE myAccel; HWND myWindowFrame; MSG myMsg; WNDCLASSEX myWC; char myFileName[MAX_PATH]; DWORD myLength; OSErr myErr = noErr; ghInst = hInstance; gCmdLine = theCmdLine; if (hPrevInstance == NULL) { LoadString(hInstance, IDS_APPNAME, gAppName, sizeof(gAppName)); // register the frame window class myWC.cbSize = sizeof(WNDCLASSEX); myWC.style = CS_HREDRAW | CS_VREDRAW; myWC.lpfnWndProc = (WNDPROC)QTFrame_FrameWndProc; myWC.cbClsExtra = 0; myWC.cbWndExtra = 0; myWC.hInstance = hInstance; myWC.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON)); myWC.hCursor = LoadCursor(NULL, IDC_ARROW); myWC.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); myWC.lpszMenuName = gAppName; myWC.lpszClassName = gAppName; myWC.hIconSm = LoadImage(hInstance, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 16, 16, 0); if (!RegisterClassEx(&myWC)) { if (!RegisterClass((LPWNDCLASS)&myWC.style)) return(0); } // register the movie child window class myWC.cbSize = sizeof(WNDCLASSEX); myWC.style = 0; myWC.lpfnWndProc = (WNDPROC)QTFrame_MovieWndProc; myWC.cbClsExtra = 0; myWC.cbWndExtra = 0; myWC.hInstance = hInstance; myWC.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CHILDICON)); // to avoid having QuickTime VR "fight" with the system over the cursor, // we set the client area cursor to NULL; this means that for QuickTime // movies, we'll need to change the cursor to an arrow manually; see the // handling of the WM_MOUSEMOVE message in QTFrame_MovieWndProc myWC.hCursor = NULL; myWC.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); myWC.lpszMenuName = NULL; myWC.lpszClassName = gChildName; myWC.hIconSm = LoadImage(hInstance, MAKEINTRESOURCE(IDI_CHILDICON), IMAGE_ICON, 16, 16, 0); if (!RegisterClassEx(&myWC)) { if (!RegisterClass((LPWNDCLASS)&myWC.style)) return(0); } } // load accelerators myAccel = LoadAccelerators(hInstance, gAppName); // initialize QuickTime Media Layer and QuickTime; alert the user and return 0 if unsuccessful myErr = InitializeQTML(0L); if (myErr != noErr) { MessageBox(NULL, "QuickTime is not installed on this computer. Exiting.", gAppName, MB_OK | MB_APPLMODAL); return(0); } myErr = EnterMovies(); if (myErr != noErr) { MessageBox(NULL, "Could not initialize QuickTime. Exiting.", gAppName, MB_OK | MB_APPLMODAL); return(0); } // get the application's resource file, if it exists myLength = GetModuleFileName(NULL, myFileName, MAX_PATH); // NULL means: the current process if (myLength != 0) { NativePathNameToFSSpec(myFileName, &gAppFSSpec, kFullNativePath); gAppResFile = FSpOpenResFile(&gAppFSSpec, fsRdWrPerm); if (gAppResFile != kInvalidFileRefNum) UseResFile(gAppResFile); } // do any application-specific initialization that must occur before the frame window is created QTApp_Init(kInitAppPhase_BeforeCreateFrameWindow); // create the main frame window myWindowFrame = CreateWindow(gAppName, gAppName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ghWnd = myWindowFrame; // make sure we got a frame window if (myWindowFrame == NULL) return(0); // show the window ShowWindow(myWindowFrame, nCmdShow); UpdateWindow(myWindowFrame); // do any application-specific initialization that must occur after the frame window is created QTApp_Init(kInitAppPhase_AfterCreateFrameWindow); // get and process events until the user quits while (GetMessage(&myMsg, NULL, 0, 0)) { if (!TranslateMDISysAccel(ghWndMDIClient, &myMsg)) { if (!TranslateAccelerator(myWindowFrame, myAccel, &myMsg)) { TranslateMessage(&myMsg); DispatchMessage(&myMsg); } } } // close the application's resource file, if it was previously opened if (gAppResFile != kInvalidFileRefNum) CloseResFile(gAppResFile); // terminate the QuickTime Media Layer ExitMovies(); TerminateQTML(); return(myMsg.wParam); // returns the value from PostQuitMessage }
void quicktime_exit() { ExitMovies(); #ifdef WIN32 TerminateQTML(); #endif }
void __stdcall QuickTimeCheckCleanup() { // Shut down our Macintosh Toolbox glue code. TerminateQTML(); }