Re: obtaining stream length from mad decoder

Joe Drew <[email protected]> Sat, 30 Jul 2005 11:54:39 -0400
Newsgroups gmane.comp.audio.mad.devel
Message-ID <[email protected]>
On Jul 30, 2005, at 5:37 AM, Nigel Sinfield wrote:

>> 4. Scan every frame header of the file.... This does not require a
>>
> full
>
>> decode of each frame, so it can be done relatively quickly.
>>
>
> Do you have any sample code to do this?

http://mpg321.depooter.org/project/file/mpg321/mad.c

Look at scan() (and calc_length()) in this file. It tries to  
calculate the length of an mp3 regardless of whether it's VBR or not,  
and whether it has XING tags or not.