Skip to content

fix: keep all objects of a PGS multi-object display set; per-cue forced flag (#146) - #153

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/ae146-pgs-multi-object-display-set
Jul 19, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/ae146-pgs-multi-object-display-set

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes #146.

Problem

A PGS display set can carry multiple composition objects at the same start PTS (a forced sign at the top plus dialogue at the bottom, a common real-disc shape). The decoder correctly fans N objects into N same-start image cues, but two layers then collapsed them onto a single object, silently dropping the sibling(s):

  1. Retained store (insertCueSorted): the same-start image replacement assumed "a PGS composition has a unique start PTS". True per composition, false per composition object.
  2. Reconstruction gate (PGSStaleArrivalGate): the pass held a single candidate cue, so a multi-object landing set lost all but one object at seek time.

There was also no per-cue forced flag anywhere on the engine surface (AVSubtitleRect.flags / AV_SUBTITLE_FLAG_FORCED was never read; only track-level TrackInfo.isForced exists), so a host could not even tell which line was dropped.

Fix

Tests

Issue146PGSMultiObjectTests, 9 cases with the reporter's geometry (sign [685,110,550,59] + dialogue [685,910,550,59] @1080p). The three collapse repros fail on main (store keeps 1 of 2 siblings; gate emits [1, 3] instead of [1, 2, 3]). 756 tests green, strict-concurrency=complete clean, tvOS Simulator build green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw

…ed flag (#146)

A PGS display set can carry multiple composition objects at one start PTS
(forced sign + dialogue, a common real-disc shape). The decoder correctly
fans N objects into N same-start image cues, but two layers then collapsed
them onto a single object:

- The retained store's same-start image replacement assumed "a PGS
  composition has a unique start PTS", true per composition, false per
  composition OBJECT. The replacement key now includes object geometry
  (normalized position + pixel size, both deterministic across re-decodes
  via the alpha-bounding-box crop): a re-decode still replaces its
  placeholder twin, sibling objects are all kept, mirroring the text
  path's distinct-simultaneous-speakers rule.

- The reconstruction pass held a SINGLE candidate cue, so a multi-object
  landing set lost all but one object at seek time. The candidate is now
  the whole same-start group; the #143 clear-trim applies per member.

API half: AVSubtitleRect's AV_SUBTITLE_FLAG_FORCED was never read, so a
host could not tell a forced sign from dialogue. It now lands in
SubtitleImage.isForced and surfaces per cue as SubtitleCue.isForced
(source-compatible additions; track-level TrackInfo.isForced unchanged).

Covered by Issue146PGSMultiObjectTests (9 cases; the three collapse
repros fail on main). Reported by cmcpherson274 (#146).

Co-Authored-By: Claude <[email protected]>
@superuser404notfound
superuser404notfound merged commit 1ffce89 into main Jul 19, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/ae146-pgs-multi-object-display-set branch July 19, 2026 15:44
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.

PGS multi-object display set collapses to its last composition object in the retained store; no per-cue forced flag to distinguish the dropped sibling

1 participant