| 95 | } |
| 96 | |
| 97 | void SectionStream::nextSection() |
| 98 | { |
| 99 | do { |
| 100 | ++currentSectionIndex; |
| 101 | if(currentSectionIndex >= sectionCount) { |
| 102 | finished = true; |
| 103 | return; |
| 104 | } |
| 105 | auto& sect = sections[currentSectionIndex]; |
| 106 | sectionOffset = 0; |
| 107 | sect.recordCount = 0; // Wipe any existing count |
| 108 | sect.recordIndex = -1; |
| 109 | readOffset = stream->seekFrom(sect.start, SeekOrigin::Start); |
| 110 | if(readOffset != sect.start) { |
| 111 | debug_e("SectionStream: Failed to seek source"); |
| 112 | finished = true; |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | if(nextSectionCallback) { |
| 117 | nextSectionCallback(); |
| 118 | } |
| 119 | |
| 120 | } while(!nextRecord()); |
| 121 | |
| 122 | sections[currentSectionIndex].recordIndex = 0; |
| 123 | } |
| 124 | |
| 125 | uint16_t SectionStream::readMemoryBlock(char* data, int bufSize) |
| 126 | { |