Repository navigation
fix(disc): fold a DVD title by cell and seek it by its time map - #738
superuser404notfound merged 1 commit into
Conversation
A DVD title's VOBs are read as one MPEG-PS, and many discs restart the presentation timestamps at a cell boundary (The Little Chinese Seamstress puts cell 7, at 3569 s of title time, at about 147 s). A seek was a timestamp search over the whole title, which on real discs read straight to the end: a 2000 s seek ended the session. Recognition now reads the selected title's main PGC cells and VTS time map (DVDIFOParser.parseMainPGCCells / parseMainTimeMap). Contiguous cells from the first title sector, outside any angle block, become AE#105 clip spans; the demuxer measures each cell's timestamp base from its navigation packs (PCI VOBU start PTS less the cell's elapsed time) and absorbs them, so the Blu-ray clip fold carries the playhead across cells. Every seek entry point goes to the VOBU's byte through the time map. A title outside that shape, or a disc without a time map, reads and seeks as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4666e3d
into
superuser404notfound:main
|
Merged in 4666e3d, thank you. This closes the DVD half of what #737 left open, and the two real-disc runs in the description made it easy to trust. It needed a manual merge: 7.35.1 added the Blu-ray EP-map seek table (AE#736) at the same places ( One thing I may harden later: a later cell's |
…tfound#738) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
A DVD title's VOBs are read as one MPEG-PS, and many discs restart the presentation timestamps at a cell boundary. A seek was a timestamp search over the whole title, and on real discs it read straight to the end of the title: a 2000 s seek ended the session. This folds the main PGC's cells onto one title timeline with the clip fold Blu-ray already uses (AE#105), each cell's base measured from its navigation packs, and seeks through the title's VTS time map. It is MovieClaw P13 from #703, and the limitation #737 points at.
What changed
DVDIFOParser:parseMainPGCCells(first / last sector, playback time, angle-block flag per cell) andparseMainTimeMap(VTS_TMAPT at VTSI0xD4, the map at the main PGC's own index, discontinuity bit stripped).mainPGCOffsetnow comes frommainPGC, which also returns that index; the existing duration, chapter and language reads are unchanged.DiscReader.dvdCellTimeline: for the selected title's VTS IFO, contiguous cells from the first title sector and outside any angle block becomeClipSpans (byte start in the concatenated VOBs, start on the title timeline, predicted shift as if each cell restarted from cell 0's base), plus aDVDTimeMapof VOBU bytes. Anything else yields neither and the title reads as before. Both ride onDiscInfoand the recognition cache.Demuxer:dvdCellFold) keeps itsDVD_NAVstream throughdiscardAllStreamsExcept.readPacketLockedabsorbs every navigation pack, so callers never see one. A PCI sets its cell's resolved shift to its base (VOBU start PTS less C_ELTM) minus cell 0's base and the cell's title start, before that cell's audio and video are folded. Cell 0's base is the stream'sstart_time, so a resume landing in a later cell can fold at once.seek(to:),seekBoundedandseek(to:streamIndex:)tryseekByDVDTimeMapLockedfirst: title time from the folded source axis, the VOBU at or before it, oneAVSEEK_FLAG_BYTEseek. Without a time map, or before cell 0's base is known, they search by timestamp as before.docs/formats.md(Disc) and CHANGELOG.Relation to #737: that PR moves the ISO9660 DVD branch into
wrapDVDso a UDF-only image shares it. The two merge cleanly in either order (checked locally), and the cell timeline then applies to UDF-only images too, as in the second disc below.Test plan
Device / OS: MacBook Pro (Mac14,5, M2 Max), macOS 27.0.1, Xcode 27.0 (27A266a).
Real remote images from a NAS, served by a local
Rangeorigin,aetherctl play <url> --seconds 60 --seek-every 10|12 --seek-pattern …. Software path (720x480 MPEG-2 PS) on both:noActiveSession)The log shows
DVD time map seek: title=…s -> byte …for each seek andDVD cell 7: base=147.456s cumBefore=3569.1s -> shift -3421.682sfor the restarted cell. Dropped-frame counts are the same with and without this change.New
DVDCellTimelineTests(7): cells in playback order with their sectors and times; the time map at the main PGC's own index, and none without VTS_TMAPT; the discontinuity bit; spans and byte map from contiguous cells; one cell, a late start, a gap, or an angle block left alone (4 cases); the time map's VOBU lookup; the cell base from a 29.97 and a 25 fps PCI, a DSI ignored, and a short PCI ignored. The navigation-pack absorption and the fold through the demuxer need a real DVD program stream, so the real discs above cover them.Full
swift test --jobs 8: 737 XCTest cases (1 skipped) and 4,205 Swift Testing cases in 584 suites, all passing.Scripts/check-doc-links.pypasses.Checklist
CHANGELOG.mdupdatedfeat(...),fix(...),chore(...))🤖 Generated with Claude Code