static pascal void MyMovieIdlingTimer(EventLoopTimerRef inTimer, void *inUserData)
{
#pragma unused(inTimer)

    OSStatus error;
    long durationInMillis;
    MyStatePtr myState = (MyStatePtr)inUserData; // Application's state
    // related to its list of movies
    
    /* You insert the code here to idle the movies and/or movie controllers that the
    application has in use––for example, calls to MCIdle(). */
    IdleMovie();
    
    // Ask the idling mechanism when we should fire the next time.
#ifdef __APPLE_CC__
    error = QTGetTimeUntilNextTask(&durationInMillis, 1000);
#else
	error = mQTGetTimeUntilNextTaskPtr(&durationInMillis, 1000);
#endif
    // 1000 == millisecond timescale
    if (durationInMillis == 0) // When zero, pin the duration
    // to our minimum
        durationInMillis = kMinimumIdleDurationInMillis;
    // Reschedule the event loop timer
    SetEventLoopTimerNextFireTime(myState->theEventTimer, durationInMillis * kEventDurationMillisecond);
}
Beispiel #2
0
void QTMovieTask::updateTaskTimer(double maxInterval, double minInterval)
{
    ASSERT(m_setTaskTimerDelay);
    if (!m_setTaskTimerDelay)
        return;

    ASSERT(m_stopTaskTimer);
    if (!m_taskList.size() && m_stopTaskTimer) {
        m_stopTaskTimer();
        return;
    }

    long intervalInMS;
    OSStatus status = QTGetTimeUntilNextTask(&intervalInMS, 1000);
    double interval = intervalInMS / 1000.0;
    if (interval < minInterval)
        interval = minInterval;
    if (interval > maxInterval)
        interval = maxInterval;
    m_setTaskTimerDelay(interval);
}