On Mon, May 27, 2002 at 12:04:21AM -0700, Rob Leslie wrote:
... I think the problem is that you are refilling your stream buffer without copying the unconsumed data from the end of the previous buffer. ...
Is there a good reason for this requirement? It seems to cause trouble for some people, because they forgot about it or because it makes certain types of buffer management that much more complicated.
How many places go fishing around in the stream struct directly? It seems mad_bit_read() and friends are almost exclusively responsible for furnishing input data to the rest of the library; mad_header_decode() does some direct manipulation too. If these functions were taught how to get bytes from the previous stream buffer until it was fully `used up', before starting on the current one, could we then have a new function, say mad_stream_buffer_append(), which would leave the bitptr struct intact counting down bits from the last buffer, and hence avoid the need for the caller to do memmove()? Would the overhead of checking the number of bits left in those low-level access routines be prohibitive?
Robin.