MCPcopy Create free account
hub / github.com/IENT/YUView / startOrUpdateTimer

Method startOrUpdateTimer

YUViewLib/src/ui/PlaybackController.cpp:238–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238void PlaybackController::startOrUpdateTimer()
239{
240 if (this->anyItemIndexedByFrame())
241 {
242 const auto frameRate = this->getCurrentItemsFrameRate();
243 this->timerInterval = std::chrono::duration_cast<std::chrono::milliseconds>(1000ms / frameRate);
244 const auto ticksToUpdateEachSecond = static_cast<int>(frameRate);
245 this->countdownForFPSUpdate = CountDown(ticksToUpdateEachSecond);
246 DEBUG_PLAYBACK("PlaybackController::startOrUpdateTimer framerate %f", frameRate);
247 }
248 else
249 {
250 this->timerInterval = 100ms;
251 const auto ticksForStaticItem =
252 static_cast<int>(this->currentItem[0]->properties().duration * 10);
253 this->countDownForStaticItem = CountDown(ticksForStaticItem);
254 DEBUG_PLAYBACK("PlaybackController::startOrUpdateTimer duration %d", this->timerInterval);
255 }
256
257 this->timer.start(this->timerInterval.count(), Qt::PreciseTimer, this);
258 this->playbackMode = PlaybackMode::Running;
259 this->fpsUpdateStopWatch = StopWatch();
260}
261
262void PlaybackController::nextFrame()
263{

Callers 3

startPlaybackMethod · 0.95
goToNextFrameMethod · 0.95

Calls 5

anyItemIndexedByFrameMethod · 0.95
CountDownClass · 0.85
StopWatchClass · 0.85
propertiesMethod · 0.80

Tested by

no test coverage detected