Re: Decoding small blocks of data
Jamie Wilkinson <[email protected]> Mon, 28 Jun 2004 14:40:17 +1000
| Newsgroups | gmane.comp.audio.mad.user |
|---|---|
| Message-ID | <[email protected]> |
This one time, at band camp, [email protected] wrote: >I am trying to decode a mp3-file 100kB at a time. The core of the problem is that your mpeg frames may not be an integer divisor of 100kB. >I'm not familiar with the mp3-format structure but i guess that the data in the file should be sent to the decoder in complete blocks. >I was hoping that the decoder would save incomplete data from the end of the previous buffer sent and join them with the next buffer sent. But it isn't ? Nah, you should do that yourself. >So if I want to decode small blocks of the file. >If I look through the file and only send complete blocks of data to the decoder. It's been a while since I wrote any code against libmad, but I'm pretty sure you get back a count of how much data was eaten. So, feed the decoder data until you've done 100kB and then finish the frame. You get back a count of how much data was eaten and how much is left in the buffer, and you can then feed that remaining data to the decoder the next time around. -- [email protected] http://spacepants.org/jaq.gpg