Closed sezero closed 1 year ago
PING @dbry ?
Hi @sezero . Sorry for the delayed response; was out of town then had house guest.
Yes, you can always use seek (-1). The reason I did not simply use the relative seek callback is that the decoder will work quite well without general seek functionality, for example when reading from a pipe. Of course, this precludes actual seeking to a specific sample index or getting tags at EOF, but is useful otherwise.
But I did need the ability to push back a single byte to avoid a lot of ugliness. The byte pushed back will always be the same as the one read, and at most only one byte will be pushed back, so it's pretty trivial to implement. I think that even pipes are guaranteed to provide at least this functionality.
OK, thank you.
Closing the ticket.
Does wavpack ever use
push_back_byte
by modifying the stdio buffer? I.e.: Can I safely usefseek(file, -1, SEEK_CUR)
for that reader functionality? I'll have to use reader functions without stdio at all, e.g. a reader from const memory, a file api without anyungetc
functionality at all, etc.My limited scanning of library shows that the actual intent is simply going back one byte after successfully reading one byte and without modifying the buffer (in
WavpackOpenFileInputEx64()
), but I just have to ask...