VIDEO: Fix MKV frames navigation. First visuals

This commit is contained in:
Eugene Sandulenko 2022-12-14 10:30:41 +01:00
parent 0357ccc5d9
commit 2b15031f55
2 changed files with 17 additions and 8 deletions

View File

@ -271,6 +271,14 @@ bool MKVDecoder::loadStream(Common::SeekableReadStream *stream) {
error("_cluster::GetFirst() failed");
}
pBlock = pBlockEntry->GetBlock();
trackNum = pBlock->GetTrackNumber();
tn = static_cast<unsigned long>(trackNum);
pTrack = pTracks->GetTrackByNumber(tn);
trackType = pTrack->GetType();
frameCount = pBlock->GetFrameCount();
time_ns = pBlock->GetTime(_cluster);
return true;
}
@ -283,14 +291,6 @@ void MKVDecoder::close() {
void MKVDecoder::readNextPacket() {
warning("MKVDecoder::readNextPacket()");
const mkvparser::Block *pBlock = pBlockEntry->GetBlock();
long long trackNum = pBlock->GetTrackNumber();
unsigned long tn = static_cast<unsigned long>(trackNum);
const mkvparser::Track *pTrack = pTracks->GetTrackByNumber(tn);
long long trackType = pTrack->GetType();
int frameCount = pBlock->GetFrameCount();
long long time_ns = pBlock->GetTime(_cluster);
// First, let's get our frame
while (_cluster != nullptr && !_cluster->EOS()) {
if (frameCounter >= frameCount) {

View File

@ -58,6 +58,7 @@ class MkvReader;
class Cluster;
class Track;
class Tracks;
class Block;
class BlockEntry;
class Segment;
}
@ -180,6 +181,14 @@ private:
int videoTrack = -1;
int audioTrack = -1;
const mkvparser::Block *pBlock;
long long trackNum;
unsigned long tn;
const mkvparser::Track *pTrack;
long long trackType;
int frameCount;
long long time_ns;
Graphics::Surface _displaySurface;
};