It would be nice to have an additional API to complement the feed reader. The API should be modeled after the MAD api. Specifically:
- Caller provides all input memory buffers. This means not using bufferchain at all.
- Caller provides the output memory buffer.
- Copies of the input data are not made. Removing bufferchain from the raw api will help this a lot. This will also eliminate the calls to malloc() and free() from a decoding thread.
- A decode_frame() that advances the current position to the next valid frame but does not actually do the decoding. Information like channels, the number of samples, and other header information should be available. This lets you skip through the file and calculate frame offsets and play time without the expense of decoding.
- A separate function to perform the actual decoding given the current frame position. This is the mathematically expensive step[.
- A function to notify the handle that the caller has changed locations in the input data. This should flush the bit reservoir or other state information and start the decoder fresh. This is useful if you have implemented your own seeking algorithm.
I have already begun work on this project. I have added a new reader called "raw" and added some api functions. There are bugs when I seek (using my own external seek algorithm). Any help would be appreciated. The goal is to create an API that gives the caller full control over the decoding process, allocates no memory, and does not create copies of the data.
Log in to post a comment.