//////////////////////////////////////////////////////////////////////////////// // private bool LLMediaImplQuickTime::unload() { if ( mMovieHandle ) { StopMovie( mMovieHandle ); if ( mMovieController ) { MCMovieChanged( mMovieController, mMovieHandle ); }; }; if ( mMovieController ) { MCSetActionFilterWithRefCon( mMovieController, NULL, (long)this ); DisposeMovieController( mMovieController ); mMovieController = NULL; }; if ( mMovieHandle ) { SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, nil, ( long )this ); DisposeMovie ( mMovieHandle ); mMovieHandle = NULL; }; if ( mGWorldHandle ) { DisposeGWorld( mGWorldHandle ); mGWorldHandle = NULL; }; return true; }
static int quicktimedrv_close(screenshot_t *screenshot) { OSStatus theError; finish_video(); if (audio_codec != -1) { soundmovie_stop(); finish_audio(); } //Write movie theError = AddMovieToStorage(movie, dataHandler); if (theError) { log_debug("quicktime: error adding movie to storage!"); } //Close movie file if (dataHandler) { CloseMovieStorage(dataHandler); } if (movie) { DisposeMovie(movie); } movie = NULL; dataHandler = NULL; return 0; }
// // MusicEvents // Called in the event loop to keep track of MIDI music // void MIDI_Update (void) { if (midiTrack) { // pOx - adjust volume if changed if (old_volume != bgmvolume.value) MIDI_SetVolume (&bgmvolume); // Let QuickTime get some time MoviesTask (midiTrack, 0); // If this song is looping, restart it if (IsMovieDone (midiTrack)) { if (bLooped) { GoToBeginningOfMovie (midiTrack); StartMovie (midiTrack); } else { DisposeMovie (midiTrack); midiTrack = NULL; } } } }
PicHandle QTEffects_GetPosterPictFromFirstVideoTrackInMovieFile (FSSpec *theSpec) { PicHandle myPict = NULL; Movie myMovie = NULL; Track myTrack = NULL; short myRefNum = 0; OSErr myErr = noErr; myErr = OpenMovieFile(theSpec, &myRefNum, fsRdPerm); BailError(myErr); myErr = NewMovieFromFile(&myMovie, myRefNum, NULL, NULL, 0, NULL); BailError(myErr); SetMoviePlayHints(myMovie, hintsHighQuality, hintsHighQuality); myErr = CloseMovieFile(myRefNum); BailError(myErr); myErr = QTEffects_GetFirstVideoTrackInMovie(myMovie, &myTrack); BailNil(myTrack); myPict = GetTrackPict(myTrack, GetMoviePosterTime(myMovie)); bail: if (myMovie != NULL) DisposeMovie(myMovie); return(myPict); }
void end_qt(void) { OSErr err = noErr; short resId = movieInDataForkResID; if(qtexport->theMovie) { QT_EndCreateMyVideoTrack(NULL); err = AddMovieResource (qtexport->theMovie, qtexport->resRefNum, &resId, qtexport->qtfilename); CheckError(err, "AddMovieResource error", NULL); err = QT_AddUserDataTextToMovie(qtexport->theMovie, "Made with Blender", kUserDataTextInformation); CheckError(err, "AddUserDataTextToMovie error", NULL); err = UpdateMovieResource(qtexport->theMovie, qtexport->resRefNum, resId, qtexport->qtfilename); CheckError(err, "UpdateMovieResource error", NULL); if(qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum); DisposeMovie(qtexport->theMovie); //printf("Finished QuickTime movie.\n"); } #ifdef __APPLE__ ExitMoviesOnThread(); #endif if(qtexport) { MEM_freeN(qtexport); qtexport = NULL; } }
void ofxQtAudioRecorder::closeMovie(){ short movieResId = movieInDataForkResID; AddMovieResource(movie, movieResRefNum, &movieResId, NULL); OSErr err = GetMoviesError(); if(err != noErr){ printf("error adding movie resource\n"); return; } if(movieResRefNum != 0) { CloseMovieFile(movieResRefNum); } if(movie != NULL) { DisposeMovie(movie); } if(soundDesc != NULL) { DisposeHandle((Handle)soundDesc); soundDesc = NULL; } movie = NULL; movieResRefNum = 0; audioMedia = NULL; audioTrack = NULL; printf("closed movie file\n"); }
//--------------------------------------------------------------------------- void ofVideoPlayer::closeMovie(){ //-------------------------------------- #ifdef OF_VIDEO_PLAYER_QUICKTIME //-------------------------------------- if (bLoaded == true){ DisposeMovie (moviePtr); DisposeMovieDrawingCompleteUPP(myDrawCompleteProc); moviePtr = NULL; } //-------------------------------------- #else //-------------------------------------- gstUtils.close(); //-------------------------------------- #endif //-------------------------------------- bLoaded = false; }
//--------------------------------------------------------------------------- void ofVideoPlayer::closeMovie(){ //-------------------------------------- #ifdef OF_VIDEO_PLAYER_QUICKTIME //-------------------------------------- if (bLoaded == true){ DisposeMovie (moviePtr); #ifdef TARGET_WIN32 DisposeMovieDrawingCompleteUPP (myDrawCompleteProc); #endif moviePtr = NULL; } //-------------------------------------- #else //-------------------------------------- fobsDecoder->close(); //-------------------------------------- #endif //-------------------------------------- bLoaded = false; }
virtual ~QTImportFileHandle() { if (mMovie) { DisposeMovie(mMovie); mMovie = NULL; } }
/** * Starts playing a new song. * * @param filename Path to a MIDI file. */ void MusicDriver_QtMidi::PlaySong(const MusicSongInfo &song) { if (!_quicktime_started) return; std::string filename = MidiFile::GetSMFFile(song); if (filename.empty()) return; DEBUG(driver, 2, "qtmidi: trying to play '%s'", filename.c_str()); switch (_quicktime_state) { case QT_STATE_PLAY: StopSong(); DEBUG(driver, 3, "qtmidi: previous tune stopped"); FALLTHROUGH; case QT_STATE_STOP: DisposeMovie(_quicktime_movie); DEBUG(driver, 3, "qtmidi: previous tune disposed"); _quicktime_state = QT_STATE_IDLE; FALLTHROUGH; case QT_STATE_IDLE: LoadMovieForMIDIFile(filename.c_str(), &_quicktime_movie); SetMovieVolume(_quicktime_movie, VOLUME); StartMovie(_quicktime_movie); _quicktime_state = QT_STATE_PLAY; } DEBUG(driver, 3, "qtmidi: playing '%s'", filename.c_str()); }
~impl() { if (image_desc) DisposeHandle((Handle)image_desc); if (handle) DisposeHandle(handle); if (gworld) DisposeGWorld(gworld); if (buffer) delete[] buffer; if (movie) DisposeMovie( movie ); }
//--------------------------------------------------------------------------- void ofQuickTimePlayer::closeMovie(){ //-------------------------------------- #ifdef OF_VIDEO_PLAYER_QUICKTIME //-------------------------------------- if (bLoaded == true){ DisposeMovie (moviePtr); DisposeMovieDrawingCompleteUPP(myDrawCompleteProc); moviePtr = NULL; width = height = 0; } //-------------------------------------- #endif //-------------------------------------- clearMemory(); bLoaded = false; }
void MacOpMultimediaPlayer::Stop(UINT32 id) { if (movie) { DisposeMovie(movie); } movie = NULL; }
MacOpMultimediaPlayer::~MacOpMultimediaPlayer() { ExitMovies(); if(movie) { DisposeMovie(movie); } }
void MacOpMultimediaPlayer::StopAll() { if (movie) { DisposeMovie(movie); } movie = NULL; }
static void QT_Destroy(QTSplitter *This) { IPin *connected = NULL; ULONG pinref; TRACE("Destroying\n"); EnterCriticalSection(&This->csReceive); /* Don't need to clean up output pins, disconnecting input pin will do that */ IPin_ConnectedTo(&This->pInputPin.pin.IPin_iface, &connected); if (connected) { IPin_Disconnect(connected); IPin_Release(connected); } pinref = IPin_Release(&This->pInputPin.pin.IPin_iface); if (pinref) { ERR("pinref should be null, is %u, destroying anyway\n", pinref); assert((LONG)pinref > 0); while (pinref) pinref = IPin_Release(&This->pInputPin.pin.IPin_iface); } if (This->pQTMovie) { DisposeMovie(This->pQTMovie); This->pQTMovie = NULL; } if (This->vContext) QTVisualContextRelease(This->vContext); if (This->aSession) MovieAudioExtractionEnd(This->aSession); ExitMoviesOnThread(); LeaveCriticalSection(&This->csReceive); if (This->loaderThread) { WaitForSingleObject(This->loaderThread, INFINITE); CloseHandle(This->loaderThread); } if (This->splitterThread) { SetEvent(This->runEvent); WaitForSingleObject(This->splitterThread, INFINITE); CloseHandle(This->splitterThread); } CloseHandle(This->runEvent); This->csReceive.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->csReceive); BaseFilter_Destroy(&This->filter); CoTaskMemFree(This); }
TLevelWriter3gp::~TLevelWriter3gp() { #if 0 if (m_pixmap) UnlockPixels(m_pixmap); if (m_compressedData) DisposeHandle(m_compressedData); if (m_gworld) DisposeGWorld(m_gworld); #endif QDErr err; if (m_videoMedia) if ((err = EndMediaEdits(m_videoMedia)) != noErr) { } // throw TImageException(getFilePath(), "can't end edit media"); if (m_videoTrack) if ((err = InsertMediaIntoTrack(m_videoTrack, 0, 0, GetMediaDuration(m_videoMedia), fixed1))) { } // throw TImageException(getFilePath(), "can't insert media into track"); short resId = movieInDataForkResID; if (m_movie) { FSSpec fspec; long myFlags = 0L; OSErr myErr = noErr; //UCHAR myCancelled = FALSE; const char *pStr = toString(m_path.getWideString()).c_str(); getFSSpecFromPosixPath(pStr, &fspec, true); myFlags = createMovieFileDeleteCurFile; // | //movieFileSpecValid | movieToFileOnlyExport; myErr = ConvertMovieToFile( m_movie, // the movie to convert NULL, // all tracks in the movie &fspec, // the output file '3gpp', // the output file type FOUR_CHAR_CODE('TVOD'), // the output file creator smSystemScript, // the script &resId, // no resource ID to be returned myFlags, // export flags m_myExporter); // no specific exp } DisposeHandle(m_hMovieData); DisposeHandle(m_dataRef); if (m_hSoundMovieData) DisposeHandle(m_hSoundMovieData); if (m_refNum) CloseMovieFile(m_refNum); DisposeMovie(m_movie); }
void wxOSXQuickTimeSoundData::DoStop() { if( m_movie ) { StopMovie(m_movie); DisposeMovie(m_movie); m_movie = NULL; wxSound::SoundStopped(this); wxExitQT(); } }
TLevelReader3gp::~TLevelReader3gp() { StopMovie(m_movie); if (m_refNum) CloseMovieFile(m_refNum); if (m_movie) DisposeMovie(m_movie); //ExitMovies(); //TerminateQTML(); }
void MIDI_Stop(void) { if (!bMidiInited) //Just to be safe return; if (midiTrack) { StopMovie (midiTrack); DisposeMovie (midiTrack); midiTrack = NULL; bPaused = false; } }
OSErr QTDR_PlayMovieFromRAM (Movie theMovie) { WindowPtr myWindow = NULL; Rect myBounds = {50, 50, 100, 100}; Rect myRect; StringPtr myTitle = QTUtils_ConvertCToPascalString(kWindowTitle); OSErr myErr = memFullErr; myWindow = NewCWindow(NULL, &myBounds, myTitle, false, 0, (WindowPtr)-1, false, 0); if (myWindow == NULL) goto bail; myErr = noErr; MacSetPort((GrafPtr)GetWindowPort(myWindow)); GetMovieBox(theMovie, &myRect); MacOffsetRect(&myRect, -myRect.left, -myRect.top); SetMovieBox(theMovie, &myRect); if (!EmptyRect(&myRect)) SizeWindow(myWindow, myRect.right, myRect.bottom, false); else SizeWindow(myWindow, 200, 0, false); MacShowWindow(myWindow); SetMovieGWorld(theMovie, GetWindowPort(myWindow), NULL); GoToBeginningOfMovie(theMovie); MoviesTask(theMovie, 0); StartMovie(theMovie); myErr = GetMoviesError(); if (myErr != noErr) goto bail; while (!IsMovieDone(theMovie)) MoviesTask(theMovie, 0); bail: free(myTitle); if (theMovie != NULL) DisposeMovie(theMovie); if (myWindow != NULL) DisposeWindow(myWindow); return(myErr); }
void QTCode_DisposeMovieAndController(Movie theMovie, short movRefNum) { // Dispose movie and controller if (movRefNum) { CloseMovieFile(movRefNum); } if (theMovie) { DisposeMovie(theMovie); } }
void qtCanvas::Impl::finishMovie() { if (mMovie) { UpdateMovieInStorage(mMovie, mDataHandler); CheckMoviesError("UpdateMovieInStorage"); DisposeMovie(mMovie); } if (mDataHandler) { CloseMovieStorage(mDataHandler); CheckMoviesError("CloseMovieStorage"); } }
QuickTimeFileReader::~QuickTimeFileReader() { SVDEBUG << "QuickTimeFileReader::~QuickTimeFileReader" << endl; if (m_decodeThread) { m_cancelled = true; m_decodeThread->wait(); delete m_decodeThread; } SetMovieActive(m_d->movie, FALSE); DisposeMovie(m_d->movie); delete[] m_d->data; delete m_d; }
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 }
static void CreateAMovie (void) { Point where = {100,100}; SFReply theSFReply; Movie theMovie = nil; FSSpec mySpec; short resRefNum = 0; short resId = movieInDataForkResID; OSErr err = noErr; SFPutFile (where, c2pstr(kPrompt), c2pstr(kMovieFileName), nil, &theSFReply); if (!theSFReply.good) return; FSMakeFSSpec(theSFReply.vRefNum, 0, theSFReply.fName, &mySpec); err = CreateMovieFile (&mySpec, kMyCreatorType, smCurrentScript, createMovieFileDeleteCurFile | createMovieFileDontCreateResFile, &resRefNum, &theMovie ); CheckError(err, "CreateMovieFile error"); QTVideo_CreateMyVideoTrack (theMovie); QTSound_CreateMySoundTrack (theMovie); err = AddMovieResource (theMovie, resRefNum, &resId, theSFReply.fName); CheckError(err, "AddMovieResource error"); if (resRefNum) { CloseMovieFile (resRefNum); } DisposeMovie (theMovie); }
static void playerdisposecurrentmovie (void) { /* 7.0b4 PBS: dispose the current movie and controller, if there is one. */ if (currentcontroller != nil) { DisposeMovieController (currentcontroller); currentcontroller = nil; } if (currentmovie != nil) { DisposeMovie (currentmovie); currentmovie = nil; } } /*playerdisposecurrentmovie*/
~QTAudioReader() { JUCE_AUTORELEASEPOOL checkThreadIsAttached(); if (dataHandle != nullptr) DisposeHandle (dataHandle); if (extractor != nullptr) { MovieAudioExtractionEnd (extractor); extractor = nullptr; } DisposeMovie (movie); #if JUCE_MAC ExitMoviesOnThread (); #endif }
void DoKillMovie() { if (mMovieController && mMovie) { OSErr err = noErr; /* stop movie */ MCDoAction(mMovieController, mcActionPlay, (void*)Long2Fix(0)); #ifdef __APPLE_CC__ err = QTUninstallNextTaskNeededSoonerCallback(mTaskNeededSoonerCallback,mMovieTimerState.theEventTimer); #else err = mQTUninstallNextTaskPtr(mTaskNeededSoonerCallback,mMovieTimerState.theEventTimer); #endif RemoveEventLoopTimer(mMovieTimerState.theEventTimer); /* remove draw complete proc. */ SetMovieDrawingCompleteProc(mMovie, movieDrawingCallWhenChanged, nil, NULL); DisposeMovieDrawingCompleteUPP(mMyDrawCompleteProc); DisposeMungData(); DisposeMovieController(mMovieController); DisposeMovie(mMovie); DisposeEventLoopTimerUPP(mEventLoopTimer); #ifdef __APPLE_CC__ DisposeQTNextTaskNeededSoonerCallbackUPP(mTaskNeededSoonerCallback); #else mDisposeQTNextTaskPtr(mTaskNeededSoonerCallback); #endif mMovieController = nil; mMovie = nil; } }
/* * PsychQTDeleteMovie() -- Delete a movie object and release all associated ressources. */ void PsychQTDeleteMovie(int moviehandle) { if (moviehandle < 0 || moviehandle >= PSYCH_MAX_MOVIES) { PsychErrorExitMsg(PsychError_user, "Invalid moviehandle provided!"); } if (movieRecordBANK[moviehandle].theMovie == NULL) { PsychErrorExitMsg(PsychError_user, "Invalid moviehandle provided. No movie associated with this handle !!!"); } // Stop movie playback immediately: MoviesTask(movieRecordBANK[moviehandle].theMovie, 0); StopMovie(movieRecordBANK[moviehandle].theMovie); glFinish(); QTVisualContextTask(movieRecordBANK[moviehandle].QTMovieContext); MoviesTask(movieRecordBANK[moviehandle].theMovie, 0); QTVisualContextTask(movieRecordBANK[moviehandle].QTMovieContext); glFinish(); // Delete movieobject for this handle: DisposeMovie(movieRecordBANK[moviehandle].theMovie); movieRecordBANK[moviehandle].theMovie=NULL; // Delete GWorld if any: if (movieRecordBANK[moviehandle].QTMovieGWorld) DisposeGWorld(movieRecordBANK[moviehandle].QTMovieGWorld); movieRecordBANK[moviehandle].QTMovieGWorld = NULL; // Delete visual context for this movie: if (movieRecordBANK[moviehandle].QTMovieContext) QTVisualContextRelease(movieRecordBANK[moviehandle].QTMovieContext); movieRecordBANK[moviehandle].QTMovieContext = NULL; // Delete audio context for this movie: QTAudioContextRelease(movieRecordBANK[moviehandle].QTAudioContext); movieRecordBANK[moviehandle].QTAudioContext = NULL; // Decrease counter: if (numMovieRecords>0) numMovieRecords--; return; }