VIDEO: Implement row and column navigation methods

This commit is contained in:
Krish 2024-07-10 22:30:49 +05:30 committed by Eugene Sandulenko
parent 2a095e6c87
commit 19647ff996
2 changed files with 56 additions and 0 deletions

View File

@ -671,6 +671,55 @@ void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y) {
}
}
void QuickTimeDecoder::setCurrentRow(int row) {
VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
int currentColumn = track->getCurFrame() % _nav.columns;
int newFrame = row * _nav.columns + currentColumn;
if (newFrame >= 0 && newFrame < track->getFrameCount()) {
track->setCurFrame(newFrame);
}
}
void QuickTimeDecoder::setCurrentColumn(int column) {
VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
int currentRow = track->getCurFrame() / _nav.columns;
int newFrame = currentRow * _nav.columns + column;
if (newFrame >= 0 && newFrame < track->getFrameCount()) {
track->setCurFrame(newFrame);
}
}
void QuickTimeDecoder::nudge(const Common::String &direction) {
VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
int curFrame = track->getCurFrame();
int currentRow = curFrame / _nav.columns;
int currentRowStart = currentRow * _nav.columns;
int newFrame = curFrame;
if (direction.equalsIgnoreCase("left")) {
newFrame = (curFrame - 1 - currentRowStart) % _nav.columns + currentRowStart;
} else if (direction.equalsIgnoreCase("right")) {
newFrame = (curFrame + 1 - currentRowStart) % _nav.columns + currentRowStart;
} else if (direction.equalsIgnoreCase("top")) {
newFrame = curFrame - _nav.columns;
if (newFrame < 0)
return;
} else if (direction.equalsIgnoreCase("bottom")) {
newFrame = curFrame + _nav.columns;
if (newFrame >= track->getFrameCount())
return;
} else {
error("QuickTimeDecoder::nudge(): Invald direction: ('%s')!", direction.c_str());
}
track->setCurFrame(newFrame);
}
QuickTimeDecoder::NodeData QuickTimeDecoder::getNodeData(uint32 nodeID) {
for (const auto &sample : _panoTrack->panoSamples) {
if (sample.hdr.nodeID == nodeID) {

View File

@ -83,6 +83,13 @@ public:
float getFOV() const { return ((VideoTrackHandler *)_nextVideoTrack)->getFOV(); }
void setFOV(float fov) { ((VideoTrackHandler *)_nextVideoTrack)->setFOV(fov); }
int getCurrentRow() { return _nextVideoTrack->getCurFrame() / _nav.columns; }
void setCurrentRow(int row);
int getCurrentColumn() { return _nextVideoTrack->getCurFrame() % _nav.columns; }
void setCurrentColumn(int column);
void nudge(const Common::String &direction);
bool isVR() const { return _isVR; }
QTVRType getQTVRType() const { return _qtvrType; }