Sessions
A session is a self-contained group of tracks with its own lead-in, program area and lead-out. Most discs have just one session. Multisession discs, mostly recordables that were written in several sittings plus a few special pressed formats, have more. This page explains how sessions are laid out, how a drive finds them, the special TOC entries that link them, how recording modes affect the gaps between tracks, and how each image format represents sessions.
1. Why sessions exist #
The original Red Book (audio) and Yellow Book (CD-ROM) assume a disc is written once, all at the factory, with one lead-in at the start and one lead-out at the end.
CD-R changed that. Users wanted to add data to a partly written disc. A CD player or CD-ROM drive only learns what is on a disc by reading the TOC in the lead-in, and a lead-in cannot be rewritten once written. The Orange Book (recordable CD) and the CD-ROM XA multisession extension therefore allow a disc to contain several complete lead-in/program/lead-out units in a row, each written separately:
session 1 session 2 session 3
┌─────────┬───────────────────┬──────────┐ ┌─────────┬──────────────┬──────────┐ ┌─────────┬───┬─────
│ lead-in │ tracks 1..n │ lead-out │ │ lead-in │ tracks n+1.. │ lead-out │ │ lead-in │...│ ...
│ (TOC 1) │ │ │ │ (TOC 2) │ │ │ │ (TOC 3) │ │
└─────────┴───────────────────┴──────────┘ └─────────┴──────────────┴──────────┘ └─────────┴───┴─────
inner edge ─────────────────────────────────────────────────────────────────────────▶ outer edge
Track numbers keep counting across sessions. Session 2 starts with the track number after session 1's last track.
Photo CD was the first big user (one session per batch of photos developed). Later came general data CD-Rs and Enhanced CDs.
2. How a drive finds later sessions #
A drive starts by reading the first lead-in. To discover later sessions, each session's lead-in contains, in addition to the normal track entries (POINT 01–99, A0, A1, A2), a mode 5 (ADR 5) pointer B0 that gives the address where the next session's program area would begin (Subchannels §5.2). The drive jumps there, reads that session's lead-in, follows its B0, and so on, until it finds a B0 that says the disc is closed, or no lead-in at all.
The host sees the result through READ TOC:
- format 0000b (TOC): all tracks from all sessions, plus the last session's lead-out;
- format 0001b (Session information): the first track number and start address of the last complete session. Multisession-aware file systems use this to find the newest volume descriptor (section 6.1);
- format 0010b (Full TOC): every Q entry from every session's lead-in, each with its session number. MDS and CCD capture this data.
3. Sizes of lead-in and lead-out #
For a single-session disc the lead-out must be at least 6,750 sectors (1 min 30 s). With multisession, gaps between sessions would waste a lot of space at that size, so later sessions use shorter lead-outs:
| Area | Sectors | Time |
|---|---|---|
| Lead-out of session 1 | 6,750 | 1:30 |
| Lead-out of session 2 and later | 2,250 | 0:30 |
| Lead-in of session 2 and later | 4,500 | 1:00 |
| Pregap of the first track of session 2+ | 150 | 0:02 |
So between the last sector of session 1 and index 1 of the first track in session 2 there are usually:
6,750 (lead-out 1) + 4,500 (lead-in 2) + 150 (pregap) = 11,400 sectors
Between later sessions it's 2,250 + 4,500 + 150 = 6,900 sectors.
libmirage uses exactly these numbers when an image doesn't record them. Its CUE and CCD parsers set a "lead-out length" of 11,250 for session 1 (6,750 lead-out + 4,500 next lead-in) and 6,750 for later sessions (2,250 + 4,500), then add the 150-sector pregap separately. The MDS parser instead derives the gap from the stored session start and end addresses:
// lib/cdemu/libmirage/images/image-mds/parser.c
leadout_length = session_block->session_start - prev_session_end;
The first session's lead-in is not part of this arithmetic: it lies before LBA −150, and its length varies by disc. On CD-R it is set by ATIP. Later lead-ins are a fixed 4,500 sectors.
4. The multisession pointers B0 and C0 #
These two ADR 5 entries live in the lead-in Q subchannel next to the ordinary TOC entries.
B0: "where can the next session go?" #
| Field | Meaning |
|---|---|
| MIN, SEC, FRAME | Start time of the next possible program area (i.e. where session n+1's first track would begin). FF:FF:FF = disc closed / finalised: no more sessions can be added. |
| ZERO | Number of ADR 5 pointers in this lead-in |
| PMIN, PSEC, PFRAME | The maximum possible start time of the outermost lead-out on the disc (≈ disc capacity, taken from ATIP) |
If B0 is absent, the disc is a plain single-session disc.
C0: recordable-disc information #
Present in the first session of recordable discs:
| Field | Meaning |
|---|---|
| MIN | Optimum recording power (from ATIP) |
| SEC, FRAME | reserved |
| PMIN, PSEC, PFRAME | Start time of the first lead-in of the disc (from ATIP). This doubles as a manufacturer identifier: e.g. 97:25:xx ranges map to specific dye manufacturers |
Aaru's CloneCD reader decodes C0 to name the media manufacturer (ATIP.ManufacturerFromATIP(PSEC, PFRAME)). Aaru's Alcohol writer synthesises B0 and C0 entries when it writes multisession MDS files.
A CCD file from a multisession disc therefore contains entries like:
[Entry 3]
Session=1
Point=0xb0
ADR=0x05
Control=0x04
TrackNo=0
AMin=24 ; next program area starts at 24:52:00 ...
ASec=52
AFrame=0
ALBA=111750
Zero=2 ; two ADR 5 pointers in this lead-in (B0 and C0)
PMin=79 ; ... and the disc can hold up to 79:59:74
PSec=59
PFrame=74
PLBA=359849
(Example values for illustration.)
5. Recording modes: DAO, TAO, SAO #
How a recordable disc was written affects what ends up between tracks and between sessions, and therefore what a dump of it looks like.
- DAO (Disc-At-Once). The whole disc (lead-in, all tracks, lead-out) is written in one continuous pass, without the laser ever turning off. The writer has full control of the gaps, subchannel (with raw writing modes) and CD-TEXT. Factory-like results. Required for copying discs exactly (CloneCD and Alcohol write images this way).
- SAO (Session-At-Once). Like DAO, but for one session at a time. The disc can be left open for further sessions.
- TAO (Track-At-Once). Each track is written separately; the laser stops after each track. Where it stops and starts again, the writer leaves link blocks: typically 2 run-out blocks + 1 link block + 4 run-in blocks, i.e. 7 sectors that contain no valid data. To keep these out of the data, TAO adds a 150-sector postgap after data tracks, and the next track gets a 150-sector pregap. Reading TAO discs often produces a couple of unreadable sectors at the end of a data track ("TAO run-out"). That is normal and must not be "fixed" in the image.
- Packet writing (incremental, as used by UDF on CD-RW and "drag-and-drop" software): data is written in small packets, each with its own link blocks. The CONTROL bit 0 ("incremental") marks such tracks.
The program memory area (PMA) on a recordable disc keeps a provisional TOC while a session is still open. When the session is closed, the real lead-in (with TOC and B0) and lead-out are written. When the disc is finalised, B0 is written as FF:FF:FF (or omitted) so no further sessions can be added.
6. Multisession disc types #
6.1 Multisession data discs (CD-ROM XA multisession, ISO 9660) #
Each session contains one Mode 1 or Mode 2 XA data track with a complete ISO 9660 (or Joliet) file system. To "add files", the burning software writes a new file system in the new session. Its directory tree points back to files in earlier sessions by their absolute LBAs, adds the new ones, and leaves out "deleted" ones. The operating system mounts the file system of the last session. It finds it from READ TOC format 1 (start of the last session's first track) plus 16 sectors for the Primary Volume Descriptor. ECMA-168 (ISO/IEC 13490) formalises this for write-once media.
Consequence for imaging: an ISO image (single track, single session) captures only one session's track. If you image only the last track you get a file system whose extents point into a session that isn't there. If you image only the first, you get an older version of the disc's contents. Formats that keep all sessions (MDS, CCD, CUE with REM SESSION) avoid this.
6.2 Enhanced CD / CD Extra / CD Plus (Blue Book) #
Session 1 holds only audio tracks; session 2 holds a single data track (Mode 2 XA) with an ISO 9660 file system (videos, lyrics, software). Audio CD players only read session 1 and never encounter the data. Computers see both. Copy-protected "CDS" discs from the early 2000s abused the same layout. Imaging these needs a multisession-capable format.
6.3 Photo CD, Video CD, CD-i #
Photo CD is the classic multisession format. Video CD and most CD-i discs are single-session Mode 2 XA (disc type 20 and 10 respectively in pointer A0).
6.4 Pressed multisession discs #
These are uncommon, but they exist: Enhanced CDs are pressed with two sessions, and some game consoles' discs (the Sega Dreamcast GD-ROM's "single-density" and "high-density" areas, which Redump CUE files mark with REM SINGLE-DENSITY AREA / REM HIGH-DENSITY AREA) behave much like two sessions.
7. DVD borders and sessions #
Pressed DVDs have no sessions. Recordable DVDs have a similar mechanism:
- DVD-R/RW: incremental recording writes borders ("Border-in" and "Border-out" areas) between sessions, which play the role of CD lead-out/lead-in. The disc's final lead-out is written only when it is finalised.
- DVD+R: sessions are closed with session closures, using intro/closure zones.
DVD image formats generally ignore all of this and store a single run of LBAs. The MDS format, for example, writes exactly one session and one data block ("Point 1") for a DVD.
8. Sessions in image formats #
| Format | How sessions are represented | Gap between sessions in the data file? |
|---|---|---|
| ISO | Not at all. One track only. | n/a |
| BIN/CUE | Not in the original CDRWIN syntax. The common extension is REM SESSION nn lines before each session's tracks (used by cdrdao, Redump, EAC, IsoBuster). Some tools add REM LEAD-OUT mm:ss:ff. |
Usually no (Redump, one BIN per track). UltraISO/IsoBuster single-file images do include the lead-out/lead-in area, and libmirage has a special correction for this. |
| MDS/MDF | One 24-byte session block per session (start sector, end sector, number, first/last track, data blocks). The header's session count says how many. Mode 5 data blocks (B0, C0) are stored like other TOC entries. | No: each track's MDF offset is explicit. |
| IMG/CCD/SUB | [Disc] Sessions=n, one [Session n] section each, and every [Entry] has a Session= key. The TOC entries (including B0, C0) are stored verbatim. |
No. The .img is the tracks back to back. The reader must add the gaps (libmirage: 11,250 then 6,750). |
Sources #
- ECMA-130 (single-session structure); ECMA-394, the Orange Book equivalent (multisession, PMA, PCA, ATIP, lead-in/lead-out sizes for later sessions, recording modes). https://ecma-international.org/publications-and-standards/standards/ecma-394/
- ECMA-168 / ISO 13490, multisession file systems on write-once CDs. https://ecma-international.org/publications-and-standards/standards/ecma-168/
- T10 MMC-6 draft: READ TOC formats 0/1/2, Annex on ADR 5 pointers (B0, C0), write parameters (TAO/SAO/raw), link block layout. https://www.t10.org/drafts.htm
- libmirage
lib/cdemu/libmirage/images/image-cue/parser.c(session gaps 11250/6750; UltraISO lead-out correction),image-ccd/parser.c,image-mds/parser.c. - Aaru
lib/Aaru/Aaru.Images/CloneCD/Read.cs(C0 decoding),Alcohol120/Write.cs(B0/C0 synthesis). - Wikipedia, "Multisession": https://en.wikipedia.org/wiki/Multisession
- Wikipedia, "Enhanced CD": https://en.wikipedia.org/wiki/Enhanced_CD