hmm...i saw this thread, find it interesting and decided to try create my own decoder as well, and probably help out kurt2.
but i came across some problems myself
So far i've sort of completed the body of each callbacks (read, write, metadata and error). I roughly guess what needs to be done in each callback by the refering to the API (such as what status to return, etc).
I have a buffer(inputBuff) that takes in a certain amount of data regularly from the FLAC file. I expect to decode the data in inputBuff, and pass to another buffer(outputBuff) which should be PCM
The thing that i don't understand is this:
QUOTE
Read callback: Set the read callback. The supplied function will be called when the decoder needs more input data. The address of the buffer to be filled is supplied, along with the number of bytes the buffer can hold. The callback may choose to supply less data and modify the byte count but must be careful not to overflow the buffer. The callback then returns a status code chosen from FLAC__StreamDecoderReadStatus.
Q1: The buffer mentioned in the quote(which is one of the callback's parameters), is it automatically created by the FLAC codes, or is it one of the buffers that i defined myself (inputBuff, outputBuff).
Q2: If not mistaken, callbacks are event-based, and
read callback is called when the decoder needs more input data, as mentioned in the quote. Which buffer does it check for insufficient data?
Well, basically my questions are about buffers; how many do i need, what should be the program flow. This is what i'm blur at now.