void ThumbFinder::updateThumb(void) { int itemNo = m_imageGrid->GetCurrentPos(); MythUIButtonListItem *item = m_imageGrid->GetItemCurrent(); ThumbImage *thumb = m_thumbList.at(itemNo); if (!thumb) return; // copy current frame image to the selected thumb image QString imageFile = thumb->filename; QFile dst(imageFile); QFile src(m_frameFile); copy(dst, src); item->SetImage(imageFile, "", true); // update the image grid item int64_t pos = (int) ((m_currentPTS - m_startPTS) / m_frameTime); thumb->frame = pos - m_offset; if (itemNo != 0) { thumb->caption = frameToTime(thumb->frame); item->SetText(thumb->caption); } m_imageGrid->SetRedraw(); }
/****************************************************************************** * Timer callback used during animation playback. ******************************************************************************/ void AnimationSettings::onPlaybackTimer() { // Check if the animation playback has been deactivated in the meantime. if(!_isPlaybackActive) return; // Add one frame to current time int newFrame = timeToFrame(time()) + 1; TimePoint newTime = frameToTime(newFrame); // Loop back to first frame if end has been reached. if(newTime > animationInterval().end()) newTime = animationInterval().start(); // Set new time. setTime(newTime); // Wait until the scene is ready. Then jump to the next frame. dataset()->runWhenSceneIsReady([this]() { if(_isPlaybackActive) { _isPlaybackActive = false; startAnimationPlayback(); } }); }
/****************************************************************************** * Jumps to the previous animation frame. ******************************************************************************/ void AnimationSettings::jumpToNextFrame() { // Subtract one frame from current time. TimePoint newTime = frameToTime(timeToFrame(time()) + 1); // Clamp new time newTime = std::min(newTime, animationInterval().end()); // Set new time. setTime(newTime); }
/****************************************************************************** * Jumps to the previous animation frame. ******************************************************************************/ void AnimationSettings::jumpToPreviousFrame() { // Subtract one frame from current time. TimePoint newTime = frameToTime(timeToFrame(time()) - 1); // Clamp new time newTime = std::max(newTime, animationInterval().start()); // Set new time. setTime(newTime); }
/****************************************************************************** * Converts a string to a time value. * Throws an exception when a parsing error occurs. ******************************************************************************/ TimePoint AnimationSettings::stringToTime(const QString& stringValue) { TimePoint value; bool ok; value = (TimePoint)stringValue.toInt(&ok); if(!ok) throw Exception(tr("Invalid frame number format: %1").arg(stringValue)); return frameToTime(value); }
void ThumbFinder::updateCurrentPos() { int64_t pos = m_currentPTS - m_firstIFramePTS; int64_t frame = pos / m_frameTime; if (m_currentPosText) m_currentPosText->SetText(frameToTime(frame, true)); updatePositionBar(frame); }