Skip to content

fix(disc): trust MPLS title duration and follow selected title for stills (#105) - #109

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/disc-title-snapshot-duration
Jul 6, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/disc-title-snapshot-duration

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

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:

  • a 42s title probed as 91844s (25.5h) and built 22961 phantom HLS segments
  • a 35s title probed as 5s

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.duration now 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 / FrameExtractor now thread a selectTitleID into Demuxer.open(url:), and makeFrameExtractor pins it to the engine's activeDiscTitleID. (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).
  • Full suite: 0 failures. swift build -Xswiftc -strict-concurrency=complete: clean. tvOS Simulator build: SUCCEEDED.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HFZVoTDayyEfpqrY8ohNyg

…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
@superuser404notfound
superuser404notfound merged commit 565c936 into main Jul 6, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/disc-title-snapshot-duration branch July 7, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant