libsmackerdec: Implement GotoFrame() function

# Conflicts:
#	source/libsmackerdec/src/SmackerDecoder.cpp
This commit is contained in:
sirlemonhead 2020-05-14 00:32:27 +01:00 committed by Christoph Oelckers
parent 9428c88e29
commit e2569d9980
2 changed files with 9 additions and 8 deletions

View file

@ -152,6 +152,7 @@ class SmackerDecoder
uint32_t currentFrame;
int32_t nextPos;
int32_t firstFrameFilePos;
bool DecodeHeaderTrees();
int DecodeHeaderTree(SmackerCommon::BitReader &bits, std::vector<int> &recodes, int *last, int size);

View file

@ -406,9 +406,10 @@ bool SmackerDecoder::Open(const char *fileName)
// set nextPos to where we are now, as next data is frame 1
nextPos = file.GetPosition();
firstFrameFilePos = nextPos;
// determine max buffer sizes for audio tracks
file.Seek(nextPos, SmackerCommon::FileStream::kSeekStart);
// file.Seek(nextPos, SmackerCommon::FileStream::kSeekStart);
uint32_t UNUSED(frameSize) = frameSizes[0] & (~3);
uint8_t frameFlag = frameFlags[0];
@ -1111,21 +1112,20 @@ float SmackerDecoder::GetFrameRate()
void SmackerDecoder::GotoFrame(uint32_t frameNum)
{
if (frameNum >= nFrames) {
if (frameNum > nFrames) {
Printf("SmackerDecoder::GotoFrame() - Invalid frame number\n");
return;
}
// TODO
// file.Seek(firstFrameFilePos, SmackerCommon::FileStream::kSeekStart);
// seek to the desired frame (just set currentFrame)
// currentFrame = frameNum;
currentFrame = 0;
nextPos = firstFrameFilePos;
// what else? (memset some stuff?)
for (int i = 0; i < frameNum + 1; i++)
GetNextFrame();
}
SmackerAudioInfo SmackerDecoder::GetAudioTrackDetails(uint32_t trackIndex)
{
SmackerAudioInfo info;