| 236 | } |
| 237 | |
| 238 | void 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 | |
| 262 | void PlaybackController::nextFrame() |
| 263 | { |
no test coverage detected