Repository navigation
Conversation
FILE, AUDIOFILE and DATAFILE names were opened relative to the current directory, although the path relative to the TOC file's directory was already computed and stored as the track's filename. TOC files only opened when the program ran from the TOC file's directory, which is how the cdrdao driver test runs. Open the computed path, as the bincue driver does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cdrdao's TOC format is DATAFILE "<filename>" [#byte-offset] [<length>]
(see cdrdao(1)), and cdrdao read-cd and read-toc write the length of
each track there. The parser took it as the track's start instead, so
every track started at its own length; test/data/cdda.toc and vcd2.toc
opened with negative LSNs:
cdda.toc before: track 1 LSN -125, lead-out 177
after: track 1 LSN 0, lead-out 25
vcd2.toc before: tracks at LSN -150, -147, -125, lead-out 177
after: tracks at LSN 0, 302, 305, lead-out 330
Store the length as the track's sector count and start each track
where the previous one ends: after its length, or after the rest of
its data file when no length is given. That fallback used to add the
150 sector lead-in pregap on every track, and dropped any byte offset.
Keep the LBA of the sector at the track's byte offset in data_lba, as
START moves start_lba past the pregap, and leave unknown lengths at 0
on START instead of making them negative.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Audio sectors were read from the first track's data file at lsn * 2352, ignoring each track's file, byte offset and block size. That only works for a single file that starts at the first sector. For DATAFILE tracks, find the track holding each sector and read it from that track's file, at its byte offset plus the sector's position times the block size. FILE and AUDIOFILE tracks are read as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TRACK <track-mode> [<sub-channel-mode>] was parsed, but the sub-channel mode was ignored. With RW or RW_RAW, 96 bytes of sub-channel data follow each sector in the data file (see cdrdao(1)), as written by cdrdao read-cd --read-subchan rw or rw_raw. Their sectors were read 2352 bytes apart instead of 2448, so all audio after the first sector was misaligned. Record the mode and add the sub-channel data to the track's block size. Reject unknown sub-channel modes, as is done for track modes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cdda-rw-raw.toc describes two audio tracks with raw P-W sub-channel data after each sector, as cdrdao read-cd --read-subchan rw_raw writes them: one data file with a byte offset and a length for each track, and a two sector START pregap in track 2. Open it from outside its directory and check the track positions and that audio reads leave out the sub-channel data. Add cdda.toc to check_DATA, as the test already reads it, and skip the new audio-only image in check_fuzzyiso.sh like cdda.bin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The cdrdao driver misreads common TOCs:
DATAFILElength is read as a start position. The test suite'scdda.tocandvcd2.tocopen with negative track LSNs and a wrong lead-out.lsn * 2352, ignoring each track's file, byte offset and block size.RWandRW_RAWsub-channel modes are ignored, so images read withcdrdao read-cd --read-subchanreturn misaligned audio.Changes
DATAFILEMSF as the track length.RW/RW_RAW, and reject unknown sub-channel modes.RW_RAWimage, opened from outside its directory, that checks track positions and audio. Also addcdda.toctocheck_DATA, since a test already reads it.Testing
make checkpasses at each commit.cdrdao read-cd --read-raw --read-subchan rw_raw, the image now opens with the correct track positions and audio.Returning the stored sub-channel data is a separate draft, #106, since it needs MMC commands on images.
🤖 Generated with Claude Code