Hi everybody

I’m trying to create an codec plugin for fmod. I started using the codec_raw code but I don’t really understand it.

I think the read function should do the actual decoding of the input.
Do I get the data from the inputfile by calling codec->fileread() and do I return the decoded data using the second parameter(buffer) of the read funtion?
Is the third parameter(size) the bytes I should try to read from the input?
The 4th parameter(read) is the number of bytes written to the buffer or the number of bytes read from the input?
If it’s the number of bytes read from the input how does fmod know how much bytes I wrote into the buffer?

If my decoder is able to decode a normal input file, will it be able to decode a stream as well?

I’d be thankfull for answers

  • You must to post comments

I think I do understand the whole system now.
But I still got a big problem.

I’m trying to use faad2 to decode an aac stream.
The decoding is working. The only problem is that the faad-decode funtion returns it’s own buffer with the PCM data and I’ve got to copy it into the buffer of the read function.
I tried it using
memcpy(buffer + lastpos, mybuf, samples * 2);
lastpos = samples*2;
I’ve got a 16bit PCM so 2 times the read samples should be the right size (8138) in one frame. The requested size is 16384.
After some calls to this callback funtion I get an access violation from an unknown source in fmodex.dll.
If I use just memset(buffer,0,16384) it is working without an access violation.

Can someone please help me?

I got it working now. At least as far as I need. but now there is another Problem:

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.