Skip to content

Commit

Permalink
MAD Decoder: Correct length of iTunes MP3 files
Browse files Browse the repository at this point in the history
The total frames count in the iTunSMPB header is the encoded length, so
add the start and end padding to it for the decoder implementation,
which expects this variable to contain the total decodable length
including the start and end padding. Fixes gapless decoding of iTunes
files.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
  • Loading branch information
kode54 committed Mar 8, 2022
1 parent 183a036 commit 9a0c598
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Plugins/MAD/MADDecoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ - (BOOL)scanFile {
if(end_pad >= 528 + 1) {
_startPadding = start_pad + 528 + 1;
_endPadding = end_pad - (528 + 1);
totalFrames = temp_duration;
// iTunes encodes the original length of the file here
totalFrames = temp_duration + _startPadding + _endPadding;
_foundiTunSMPB = YES;
}
}
Expand Down

0 comments on commit 9a0c598

Please sign in to comment.