Short answer:
Windows -- iTunes (with a little help from QuickTime)
OS X -- iTunes via QuickTime & Core Audio
Long answer:
When it encodes, iTunes adds the appropriate information to each file's tag, which is used during playback. iTunes also supports
Nero AAC files with their method of incorporating gapless info (as of iTunes v7.1.2, if I'm not mistaken).
The answer to your original question can be found in the following thread:
http://www.hydrogenaudio.org/forums/index....showtopic=48231More specifically:
QUOTE(kincaid @ Sep 14 2006, 12:07)

QUOTE(nyaochi @ Sep 14 2006, 09:58)

I also confirmed that iTunes v7.0.0.70 does attach the information for calculating accurate stream length to MP3 files.
Creating two WAVE files with 441000 samples (10 seconds) and 441001 samples (10 seconds + 1 sample), I encoded them to two MP3 files by using iTunes v7.0.0.70. I checked the MP3 files and noticed some differences in ID3v2.2 tags generated by the encoder.
[441000.mp3]
TT2: segment1
COM(eng): iTunPGAP=0
TEN: iTunes v7.0.0.70
COM(eng): iTunNORM= 0000121E 00000C71 00006417 00002D9A 000024A1 0000234E 0000827F 000085FB 0000023E 00000D43
COM(eng): iTunSMPB= 00000000 00000210 000007C8 000000000006BAA8 00000000 00026783 00000000 00000000 00000000 00000000 00000000 00000000
[441001.mp3]
TT2: segment1
COM(eng): iTunPGAP=0
TEN: iTunes v7.0.0.70
COM(eng): iTunNORM= 0000121E 00000C71 00006416 00002D9A 000024A1 0000234E 0000827F 000085FA 0000023E 00000D43
COM(eng): iTunSMPB= 00000000 00000210 000007C7 000000000006BAA9 00000000 00026783 00000000 00000000 00000000 00000000 00000000 00000000
Note that there're some differences in iTunNORM and iTunSMPB comment frames. The different values may represent the number of padded samples by the encoder.
As these MP3 files have 385 frames, the number of decoded samples will be 1152 * 385 = 443520 [samples] (without any handling for gapless playback). Assuming that the second and third values in iTunSMPB present the numbers of encoder delay and encoder padding in samples, I obtain the original sample length: 443520 - 528 (0x210) - 1992 (0x7C8) = 441000 [samples] = 10 [sec]. The forth value in iTunSMPB frame probably represents the original sample length since 0x6BAA8 equals to 441000 [samples]. I'm not sure how other values in these frames are used, but I hope this will be a good starting point to understand the mechanism of the gapless playback proposed by Apple.
This analysis is correct. Additionally, the sixth value is the byte offset from the first audio frame to the 8th-from-last frame. This provides a resynchronization mechanism to restore a decoder's true sample number after a seek.