CDA files are generally RIFF resources. The RIFF id of .CDA file is "CDDA" (43h, 44h, 44h, 41h). They contain only one data block called "fmt
" (66h, 6dh, 74h, 20h). In current version of .CDA file, this block is 24 bytes long. Here's structure of it:
Offset | Length | Description |
00h | 02h | CDA file version. Currently equals 1. If it has other value, following data may be out of date. |
02h | 02h | Number of track. |
04h | 04h | CD disc serial number (the one stored in CDPLAYER.INI) |
08h | 04h | Beginning of the track in HSG format. |
0Ch | 04h | Length of the track in HSG format. |
10h | 04h | Beginning of the track in Red-Book format. |
14h | 04h | Length of the track in Red-Book format. |
As you see, time is represented in two formats: HSG and Red-Book. HSG can be calculated as following:
time = minute * 4500 + second * 75 + frame
Red-book is much easier to use, because it contains minutes, seconds and frames in unmodified form, byte-packed:
Offset | Length | Description |
00h | 01h | Frame |
01h | 01h | Second |
02h | 01h | Minute |
03h | 01h | not used |
Now, I'll show you an example file. First part is a hex dump of the file, the second is the explanation of the fields.
52 49 46 46 24 00 00 00 43 44 44 41 66 6D 74 20 RIFF$...CDDAfmt
18 00 00 00 01 00 04 00 B8 24 F6 00 F7 11 01 00 .........$......
B4 5C 00 00 0A 25 0F 00 20 10 05 00 .\...%.. ...
01 00 - first version of CDA file :)
04 00 - fourth track
B8 24 F6 00 - serial number of CD in CDPLAYER.INI [F623B8]
F7 11 01 00 - begining of track in HSG format
B4 5C 00 00 - length of track in HSG format
0A 25 0F 00 - begining of track in Red-Book format (15:37)
20 10 05 00 - length of track in Red-book format (05:16)
No comments:
Post a Comment