Posted with wrong from address.. here it is again.
Hi im new to the list. Im trying to decode some data using the low level api, I want to decode it a frame at a time , but currently im just trying to do something simple, give it 8k of data and have it call decode without hanging. in is a pointer to the data, I just put 8192 in for the hell of it. The 8k of data is valid mpeg data and I can decode it fine with my own fpu based mp3 code. I tried this
mad_stream_init(&stream); mad_frame_init(&frame); mad_synth_init(&synth);
mad_stream_buffer(&stream, in, 8192);
if (mad_frame_decode(&frame, &stream) == -1) { return FALSE; }
It decodes the header correctly, then when decoding the data in the (stereo mp3) file, it goes into an infinite loop inside mad_frame_decode. The code it hangs in is in III_huffdecode (not immediately).. The while loop is the following one.
while (!pair->final) { cachesz -= clumpsz; clumpsz = pair->ptr.bits; pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)]; } Its called from the III_decode function, and it is gr = 1, ngr = 2 and ch = 1 nch = 2. So it performs in this manner. gr = 0 ch = 0 : succeeds gr = 0 ch = 1 : succeeds gr = 1 ch = 0 : succeeds gr = 1 ch = 1 : hang
Maybe I didnt set the project up properly, all I did was create a new project in devstudio, add all the mad files, then defined FPM_DEFAULT,OPT_SPEED in my project. Is there anything else I should be doing?
thanks Brett