file seek support, new test cases, AVI use file seek

This commit is contained in:
2021-02-25 07:42:27 +01:00
parent f04742a1b0
commit c89f599112
6 changed files with 189 additions and 38 deletions

View File

@@ -32,6 +32,16 @@ public:
std::string getName() const {return h.getName();}
/** current position within the file */
uint32_t curPos() const {
return curAbsPos;
}
/** seek to a new position within the file */
void seekTo(uint32_t pos) {
_seekTo(pos);
}
/** read x bytes from the file */
uint32_t read(uint32_t size, uint8_t* dst) {
@@ -105,6 +115,12 @@ private:
}
void _seekTo(uint32_t pos) {
this->curAbsPos = pos;
this->iCurCluster = pos / fs.tmp.bytesPerCluster;
this->posInCluster = pos - (this->iCurCluster * fs.tmp.bytesPerCluster);
}
int32_t _read(uint32_t readSize, uint8_t* dst) {
// EOF reached?