incorrect MPEG frame length calculation

jmartin_92 at verizon.net jmartin_92 at verizon.net
Fri Jun 27 05:54:50 CEST 2008


Hi.

I am not sure but I think the MPEG frame length might be being 
incorrectly calculated.

MPEG::Header::parse has:

if(d->layer == 1)
     d->frameLength = 24000 * 2 * d->bitrate / d->sampleRate + 
int(d->isPadded);
   else
     d->frameLength = 72000 * d->bitrate / d->sampleRate + 
int(d->isPadded);


Now I don't know anything about layer 1 files so I'm skipping that part. 
But I think the else clause is only correct for version 2 or 2.5 files. 
I think for version 1 files it should be:

d->frameLength = 72000 * 2 * d->bitrate / d->sampleRate + 
int(d->isPadded);


Am I right about this?  I'm hoping that there is someone on the list who 
knows more about MPEG file structure than I do (which is very little) 
that can either confirm this or correct me.

Thanks.

Jim



More information about the taglib-devel mailing list