Bug 130626 - Calculation of MPEG frame length is wrong
Summary: Calculation of MPEG frame length is wrong
Status: RESOLVED DUPLICATE of bug 130625
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-11 16:37 UTC by Dirk E. Wagner
Modified: 2006-07-11 16:44 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk E. Wagner 2006-07-11 16:37:55 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.2.3 
OS:                Linux

In the file mpegheader.cpp line 249 of taglib-1.4 the calculation of 
the frame length is wrong. At this time it is implemented as follows:

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);

This must be replaced by:

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

See http://www.dv.co.yu/mpgscript/mpeghdr.htm section 'How to 
calculate frame length' for details.
Comment 1 Rex Dieter 2006-07-11 16:44:19 UTC

*** This bug has been marked as a duplicate of 130625 ***