本文整理汇总了C++中MoviesTask函数的典型用法代码示例。如果您正苦于以下问题:C++ MoviesTask函数的具体用法?C++ MoviesTask怎么用?C++ MoviesTask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MoviesTask函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTDR_PlayMovieFromRAM
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);
}
示例2: start
//--------------------------------------------------------
void ofVideoPlayer::play(){
//--------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------
if (!bStarted){
start();
}else {
// ------------ lower level "startMovie"
// ------------ use desired speed & time (-1,1,etc) to Preroll...
bPlaying = true;
TimeValue timeNow;
timeNow = GetMovieTime(moviePtr, nil);
PrerollMovie(moviePtr, timeNow, X2Fix(speed));
SetMovieRate(moviePtr, X2Fix(speed));
MoviesTask(moviePtr, 0);
}
//--------------------------------------
#endif
//--------------------------------------
}
示例3: PsychDetermineMovieFramecountAndFps
/** Internal helper function: Returns fps rate of movie and optionally
* the total number of video frames in the movie. Framecount is determined
* by stepping through the whole movie and counting frames. This can take
* significant time on big movie files.
*
* Always returns fps as a double. Only counts and returns full framecount,
* if *nrframes is non-NULL.
*/
double PsychDetermineMovieFramecountAndFps(Movie theMovie, int* nrframes)
{
// Count total number of videoframes: This code is derived from Apple
// example code.
long myCount = -1;
short myFlags;
TimeValue myTime = 0;
TimeValue myDuration = 0;
OSType myTypes[1];
// We want video samples.
myTypes[0] = VisualMediaCharacteristic;
// We want to begin with the first frame in the movie:
myFlags = nextTimeStep + nextTimeEdgeOK;
// We count either the first 3 frames if nrframes==NULL aka only
// fps requested, or if framecount is requested, we count all frames.
while (myTime >= 0 && (myCount<2 || nrframes!=NULL)) {
myCount++;
// look for the next frame in the track; when there are no more frames,
// myTime is set to -1, so we'll exit the while loop
GetMovieNextInterestingTime(theMovie, myFlags, 1, myTypes, myTime, FloatToFixed(1), &myTime, &myDuration);
// after the first interesting time, don't include the time we're currently at
myFlags = nextTimeStep;
}
// Return optional count of frames:
if (nrframes) *nrframes = (int) myCount;
GoToBeginningOfMovie(theMovie);
MoviesTask(theMovie, 0);
// Compute and return frame rate in fps as (Ticks per second / Duration of single frame in ticks):
return((double) GetMovieTimeScale(theMovie) / (double) myDuration);
}
示例4: PsychSetMovieTimeIndex
/*
* PsychSetMovieTimeIndex() -- Set current playback time of movie.
*/
double PsychSetMovieTimeIndex(int moviehandle, double timeindex)
{
Movie theMovie;
double oldtime;
if (moviehandle < 0 || moviehandle >= PSYCH_MAX_MOVIES) {
PsychErrorExitMsg(PsychError_user, "Invalid moviehandle provided!");
}
// Fetch references to objects we need:
theMovie = movieRecordBANK[moviehandle].theMovie;
if (theMovie == NULL) {
PsychErrorExitMsg(PsychError_user, "Invalid moviehandle provided. No movie associated with this handle !!!");
}
// Retrieve current timeindex:
oldtime = (double) GetMovieTime(theMovie, NULL) / (double) GetMovieTimeScale(theMovie);
// Set new timeindex:
SetMovieTimeValue(theMovie, (TimeValue) (((timeindex * (double) GetMovieTimeScale(theMovie))) + 0.5f));
// Check if end of movie is reached. Rewind, if so...
if (IsMovieDone(theMovie) && movieRecordBANK[moviehandle].loopflag > 0) {
if (GetMovieRate(theMovie)>0) {
GoToBeginningOfMovie(theMovie);
} else {
GoToEndOfMovie(theMovie);
}
}
MoviesTask(theMovie, 0);
// Return old value:
return(oldtime);
}
示例5: QTSplitter_loading_thread
static DWORD WINAPI QTSplitter_loading_thread(LPVOID data)
{
QTSplitter *This = (QTSplitter *)data;
if (This->pAudio_Pin)
{
/* according to QA1469 a movie has to be fully loaded before we
can reliably start the Extraction session.
If loaded earlier, then we only get an extraction session for
the part of the movie that is loaded at that time.
We are trying to load as much of the movie as we can before we
start extracting. However we can recreate the extraction session
again when we run out of loaded extraction frames. But we want
to try to minimize that.
*/
EnterCriticalSection(&This->csReceive);
while(This->pQTMovie && GetMovieLoadState(This->pQTMovie) < kMovieLoadStateComplete)
{
MoviesTask(This->pQTMovie, 100);
LeaveCriticalSection(&This->csReceive);
Sleep(0);
EnterCriticalSection(&This->csReceive);
}
LeaveCriticalSection(&This->csReceive);
}
return 0;
}
示例6: GetMovieTimeBase
//---------------------------------------------------------------------------
void ofVideoPlayer::setPosition(float pct){
//--------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------
TimeRecord tr;
tr.base = GetMovieTimeBase(moviePtr);
long total = GetMovieDuration(moviePtr );
long newPos = (long)((float)total * pct);
SetMovieTimeValue(moviePtr, newPos);
MoviesTask(moviePtr,0);
//--------------------------------------
#else
//--------------------------------------
gstUtils.setPosition(pct);
//--------------------------------------
#endif
//--------------------------------------
}
示例7: QTCode_ForceMovieRedraw
void QTCode_ForceMovieRedraw(Movie theMovie)
{
OSErr err = noErr;
Rect movieRect;
RgnHandle clipRegion = NULL;
if (theMovie == NULL) goto bail;
clipRegion = NewRgn();
if (clipRegion == NULL) goto bail;
GetClip(clipRegion);
GetMovieBox(theMovie, &movieRect);
ClipRect(&movieRect);
UpdateMovie(theMovie);
MoviesTask(theMovie, 0);
SetClip(clipRegion);
/* Closure. Clean up if we have handles. */
bail:
if (clipRegion != NULL)
{
DisposeRgn(clipRegion);
}
}
示例8: defined
//---------------------------------------------------------------------------
void ofQuickTimePlayer::update(){
if (bLoaded == true){
//--------------------------------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------------------------------
#if defined(TARGET_WIN32) || defined(QT_USE_MOVIETASK)
MoviesTask(moviePtr,0);
#endif
//--------------------------------------------------------------
#endif
//--------------------------------------------------------------
}
// ---------------------------------------------------
// on all platforms,
// do "new"ness ever time we idle...
// before "isFrameNew" was clearning,
// people had issues with that...
// and it was badly named so now, newness happens
// per-idle not per isNew call
// ---------------------------------------------------
if (bLoaded == true){
bIsFrameNew = bHavePixelsChanged;
if (bHavePixelsChanged == true) {
bHavePixelsChanged = false;
}
}
}
示例9: SetMovieActive
//--------------------------------------------------------
void ofQuickTimePlayer::start(){
//--------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------
if (bLoaded == true && bStarted == false){
SetMovieActive(moviePtr, true);
//------------------ set the movie rate to default
//------------------ and preroll, so the first frames come correct
TimeValue timeNow = GetMovieTime(moviePtr, 0);
Fixed playRate = GetMoviePreferredRate(moviePtr); //Not being used!
PrerollMovie(moviePtr, timeNow, X2Fix(speed));
SetMovieRate(moviePtr, X2Fix(speed));
setLoopState(currentLoopState);
// get some pixels in there right away:
MoviesTask(moviePtr,0);
#if defined(TARGET_OSX) && defined(__BIG_ENDIAN__)
convertPixels(offscreenGWorldPixels, pixels.getPixels(), width, height);
#endif
bHavePixelsChanged = true;
bStarted = true;
bPlaying = true;
}
//--------------------------------------
#endif
//--------------------------------------
}
示例10: isplayerevent
boolean isplayerevent (void) {
/*
7.0b4 PBS: called from the main event loop.
QuickTime needs to catch some events.
Return true if the event is consumed by QuickTime
and should be ignored by the event loop.
*/
boolean fl = false;
if (currentmovie == nil) /*if no current movie, return right away*/
return (fl);
if (currentcontroller == nil) /*if no controller, return right away*/
return (fl);
if (MCIsPlayerEvent (currentcontroller, &shellevent))
fl = true; /*the event was consumed by QuickTime*/
MCIdle (currentcontroller);
MoviesTask (nil, 0);
return (fl);
} /*isplayerevent*/
示例11: ofLog
//--------------------------------------------------------
void ofQuickTimePlayer::play(){
if( !isLoaded() ){
ofLog(OF_LOG_ERROR, "ofQuickTimePlayer::play - movie not loaded!");
return;
}
bPlaying = true;
bPaused = false;
//--------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------
if (!bStarted){
start();
}else {
// ------------ lower level "startMovie"
// ------------ use desired speed & time (-1,1,etc) to Preroll...
TimeValue timeNow;
timeNow = GetMovieTime(moviePtr, nil);
PrerollMovie(moviePtr, timeNow, X2Fix(speed));
SetMovieRate(moviePtr, X2Fix(speed));
MoviesTask(moviePtr, 0);
}
//--------------------------------------
#endif
//--------------------------------------
//this is if we set the speed first but it only can be set when we are playing.
setSpeed(speed);
}
示例12: SetMovieActive
//--------------------------------------------------------
void ofVideoPlayer::start(){
//--------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------
if (bLoaded == true && bStarted == false){
SetMovieActive(moviePtr, true);
//------------------ set the movie rate to default
//------------------ and preroll, so the first frames come correct
TimeValue timeNow = GetMovieTime(moviePtr, 0);
Fixed playRate = GetMoviePreferredRate(moviePtr); //Not being used!
PrerollMovie(moviePtr, timeNow, X2Fix(speed));
SetMovieRate(moviePtr, X2Fix(speed));
setLoopState(OF_LOOP_NORMAL);
// get some pixels in there right away:
MoviesTask(moviePtr,0);
convertPixels(offscreenGWorldPixels, pixels, width, height);
bHavePixelsChanged = true;
if (bUseTexture == true){
tex.loadData(pixels, width, height, GL_RGB);
}
bStarted = true;
bPlaying = true;
}
//--------------------------------------
#endif
//--------------------------------------
}
示例13: MIDI_Update
//
// 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;
}
}
}
}
示例14: MoviesTask
//---------------------------------------------------------------------------
void ofQuickTimePlayer::update() {
if (bLoaded == true) {
//--------------------------------------------------------------
#ifdef OF_VIDEO_PLAYER_QUICKTIME
//--------------------------------------------------------------
// is this necessary on windows with quicktime?
#ifdef TARGET_OSX
// call MoviesTask if we're not on the main thread
if ( CFRunLoopGetCurrent() != CFRunLoopGetMain() )
{
//ofLog( OF_LOG_NOTICE, "not on the main loop, calling MoviesTask") ;
MoviesTask(moviePtr,0);
}
#else
// on windows we always call MoviesTask
MoviesTask(moviePtr,0);
#endif
//--------------------------------------------------------------
#endif
//--------------------------------------------------------------
}
// ---------------------------------------------------
// on all platforms,
// do "new"ness ever time we idle...
// before "isFrameNew" was clearning,
// people had issues with that...
// and it was badly named so now, newness happens
// per-idle not per isNew call
// ---------------------------------------------------
if (bLoaded == true) {
bIsFrameNew = bHavePixelsChanged;
if (bHavePixelsChanged == true) {
bHavePixelsChanged = false;
}
}
}
示例15: PsychQTDeleteMovie
/*
* 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;
}