Closed glebm closed 3 years ago
A function that can convert file position to block number + position is probably sufficient to implement streaming API user-side:
/* returns the block number, size, and block start position for the given position in the unpacked file. */
int32_t libmpq__block_seek(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t file_position, uint32_t *block_number, libmpq__off_t *block_size, uint32_t *block_start_position) {
I'll give it a go
If the client code makes the assumption that all block sizes except the last one are equal, such a function is not necessary, but I don't know if it's OK for client code to make this assumption.
It'd be very useful to have a streaming API for files with read/seek functions, so that it can be wrapped as e.g.
SDL_RWops
for audio streaming.