Repository navigation
fix(disc): trust MPLS title duration and follow selected title for stills (#105) - #109
Merged
Merged
Conversation
…ills (#105) Follow-up to the decoy-playlist fix, from reporter re-test on a multi-title Blu-ray. Two independent disc bugs surfaced on the short auxiliary titles: - Wrong duration: FFmpeg's mpegts duration estimate over concatenated multi-clip m2ts with discontinuous PTS is unreliable (a 42s title probed as 25.5h and built 22961 phantom HLS segments; a 35s title probed as 5s). The MPLS/IFO playlist duration is authoritative, so Demuxer.duration now returns the selected disc title's duration when it has one, falling back to the container estimate for non-disc sources or an unparsed title. This corrects the scrubber total, the HLS segment plan, and the still-extractor's past-duration clamp in one place. It is a no-op for the main feature (MPLS and container agree within rounding). - Stale snapshot on title switch: the full-res still extractor opened its own disc demuxer with no title id, so it always decoded the default title regardless of the selected one. FrameDecodeContext / FrameExtractor now thread a selectTitleID into Demuxer.open(url:), and makeFrameExtractor pins it to the engine's activeDiscTitleID. Tests: DemuxerDurationTests covers the duration authority helper. The selectTitleID wiring forwards an already-tested Demuxer/DiscReader parameter (covered by the disc title-selection tests) and is verified by the full suite + tvOS build. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HFZVoTDayyEfpqrY8ohNyg
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.
Follow-up to #108 (decoy-playlist defeat). The reporter re-tested on 0.9.2: the decoy fix works (the disc now recognizes 14 titles and the real 2:05 feature is the main title). Two independent disc bugs then surfaced on the short auxiliary titles they switched to.
Bug 1: bogus duration on multi-clip disc titles
FFmpeg's mpegts duration estimate over concatenated multi-clip m2ts with discontinuous PTS is unreliable:
The scrubber showed the bogus demuxer duration, so total and playhead were inconsistent (25:12:34 / 25:30:43; 10:04 / 0:05). The MPLS/IFO playlist duration is authoritative (the title list already shows it correctly), so
Demuxer.durationnow returns the selected disc title's duration when present, falling back to the container estimate for non-disc sources or an unparsed title. One point corrects the scrubber total, the HLS segment plan, and the still extractor's past-duration clamp. No-op for the main feature (MPLS and container agree within rounding), which also removes the cosmetic 1s TitleInfo vs duration difference.Bug 2: stale snapshot on title switch
The full-res still extractor opened its own disc demuxer with no title id, so it always decoded the default title regardless of the selected one ("switch to title3, snapshot is still title1's").
FrameDecodeContext/FrameExtractornow thread aselectTitleIDintoDemuxer.open(url:), andmakeFrameExtractorpins it to the engine'sactiveDiscTitleID. (The host rebuilds the extractor when the disc title changes.)Tests / verification
DemuxerDurationTests: the duration-authority helper (disc duration wins when present, falls back otherwise).swift build -Xswiftc -strict-concurrency=complete: clean. tvOS Simulator build: SUCCEEDED.🤖 Generated with Claude Code
https://claude.ai/code/session_01HFZVoTDayyEfpqrY8ohNyg