=== Tracks Block (`TRKS`)

The tracks block holds a structured list of track entries, typically aligned with the layout specified in the table of contents or a similar indexing schema.
This format is common in optical media such as CDs, DVDs, and related disc-based formats.

==== Structure Definition

[source,c]
#define TRACKS_MAGIC 0x534B5254
/**Contains list of optical disc tracks */
typedef struct TracksHeader
{
    uint32_t identifier;  ///< Block identifier (must be BlockType::TracksBlock).
    uint16_t entries;     ///< Number of TrackEntry records following this header.
    uint64_t crc64;  ///< CRC64-ECMA of the TrackEntry array (header excluded, legacy byte-swap for early versions).
} TracksHeader;

==== Field Descriptions

[cols="2,2,2,6",options="header"]
|===
|Type|Size|Name|Description
|uint32_t|4 bytes|identifier|The tracks block identifier, always `TRKS`
|uint16_t|2 bytes|entries|The number of entries following this header
|uint64_t|8 bytes|crc64|CRC64-ECMA checksum of the entries following this header
|===

==== Track entries

[source,c]
/**Optical disc track */
typedef struct TrackEntry
{
    uint8_t sequence;  ///< Track number (1..99 typical for CD audio/data). 0 may indicate placeholder/non-standard.
    uint8_t type;      ///< Track type (value from \ref TrackType).
    int64_t start;     ///< Inclusive starting LBA of the track.
    int64_t end;       ///< Inclusive ending LBA of the track.
    int64_t pregap;    ///< Pre-gap length in sectors preceding track start (0 if none).
    uint8_t session;   ///< Session number (1-based). 1 for single-session discs.
    uint8_t isrc[13];  ///< ISRC raw 13-byte code (no null terminator). All zeros if not present.
    uint8_t flags;     ///< Control / attribute bitfield (see file documentation for suggested bit mapping).
} TrackEntry;

==== Field Descriptions

[cols="2,2,2,6",options="header"]
|===
|Type|Size|Name|Description
|uint8|1 byte|sequence|Track number.
|uint8|1 byte|type|Track type (see table below).
|int64|8 bytes|start|Track starting LBA (including pregap).
|int64|8 bytes|end|Track ending LBA.
|int64|8 bytes|pregap|Size of track’s pregap in sectors.
|uint8|1 byte|session|Session the track belongs to.
|StringA|13 bytes|isrc|Track’s ISRC in ASCIIZ.
|uint8|1 byte|flags|Track flags as indicated in TOC if applicable.
|===

==== Track Types

[cols="2,1,8",options="header"]
|===
|Type|Value|Description
|Audio|0|All sectors in the track contain audio as defined by the Red Book.
|Data|1|All sectors in the track contain user data that is not defined by any of the following types.
|CdMode1|2|All sectors in the track contain user data according to MODE 1 as  defined by the Yellow Book.
|CdMode2Formless|3|All sectors in the track contain user data according to MODE 2 as  defined by the Yellow and Green Books. Not all sectors belong to the same Form.
|CdMode2Form1|4|All sectors in the track contain user data according to MODE 2 Form 1 as  defined by the Yellow and Green Books. All sectors belong to the same Form.
|CdMode2Form2|5|All sectors in the track contain user data according to MODE 2 Form 2 as  defined by the Yellow and Green Books. All sectors belong to the same Form.
|===
