Skip to content

OCTO-11541 - #399

Closed
OlteanuRares wants to merge 2 commits into
mainfrom
OCTO-11541
Closed

OCTO-11541 #399
OlteanuRares wants to merge 2 commits into
mainfrom
OCTO-11541

Conversation

@OlteanuRares

@OlteanuRares OlteanuRares commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When converting from center-default formats (VTT/SRT/SCC) to left-default formats (DFXP/SAMI), writers now emit explicit center alignment — fixing a visual regression where players rendered text left-aligned
  • SCC positional layouts (row/col coordinates) are detected via is_positional_anchor and mapped to center instead of leaking tts:origin into DFXP, margin-left/margin-top into SAMI, or align:left position:N% line:N% into VTT
  • SAMI writer emits semantic <i>/<b>/<u> tags and adds a trailing &nbsp; sync to clear the final caption

Problem

DFXP's spec default is textAlign="start" (left). SAMI's default is text-align: left. When a VTT/SRT/SCC file (visual default: center) was converted to DFXP or SAMI without explicit alignment, players rendered the text left-aligned — a silent visual regression with no data loss to detect.

SCC captions carry origin+LEFT alignment as a coordinate-system anchor (row 14, col 0), not as "align this text left." Previous code emitted these as tts:origin in DFXP, margin-left/margin-top in SAMI, and align:left position:N% line:N% size:N% in VTT — producing incorrect positioning in all three targets.

Approach

  • Layout.is_positional_anchor flag distinguishes SCC coordinate positioning from visual alignment intent (set in _get_layout_from_tuple)
  • RegionCreator._has_null_layouts() detects VTT/SRT/SCC sources (no layout → center default region) vs DFXP/SAMI sources (has layout → preserve original alignment)
  • _is_scc_positional() gates origin suppression in DFXP and SAMI writers
  • WebVTT writer returns empty cue settings for positional anchors (VTT defaults to center)
  • DFXP→DFXP and SAMI→SAMI round-trips are unaffected (sources have layout, so _has_null_layouts() returns False)
  • Skylab flows (SinglePositioningDFXPWriter, LegacyDFXPWriter) are unaffected — they assign layout before reaching the new logic

Test plan

  • All 505 tests pass
  • SCC/VTT/SRT → DFXP: tts:textAlign="center" present, no tts:textAlign="left", no tts:origin
  • SCC/VTT/SRT → SAMI: text-align:center present, no margin leaks
  • SCC → VTT: no align:left, no position:, no line:, no size:
  • DFXP/SAMI → VTT: emits align:start / align:left (preserves source intent)
  • DFXP→DFXP preserves start/left (no false promotion)
  • Explicit VTT align:left / align:right preserved through conversion
  • Timing within tolerance across all paths
  • SinglePositioningDFXPWriter / LegacyDFXPWriter output unchanged

Alignment matrix — all 25 conversion paths (implicit default input)

# Path Source Default Target Default Output Viewer Sees Result
1 SCC → SCC CENTER CENTER N/A (no alignment attribute) CENTER OK (format limitation)
2 SCC → VTT CENTER CENTER none → player uses CENTER CENTER CORRECT
3 SCC → SRT CENTER N/A N/A (no alignment support) N/A OK (format limitation)
4 SCC → DFXP CENTER LEFT/START CENTER (explicit) CENTER CORRECT
5 SCC → SAMI CENTER LEFT CENTER (explicit) CENTER CORRECT
6 VTT → SCC CENTER CENTER N/A (no alignment attribute) CENTER OK (format limitation)
7 VTT → VTT CENTER CENTER none → player uses CENTER CENTER CORRECT
8 VTT → SRT CENTER N/A N/A (no alignment support) N/A OK (format limitation)
9 VTT → DFXP CENTER LEFT/START CENTER (explicit) CENTER CORRECT
10 VTT → SAMI CENTER LEFT CENTER (explicit) CENTER CORRECT
11 SRT → SCC CENTER CENTER N/A (no alignment attribute) CENTER OK (format limitation)
12 SRT → VTT CENTER CENTER none → player uses CENTER CENTER CORRECT
13 SRT → SRT CENTER N/A N/A (no alignment support) N/A OK (format limitation)
14 SRT → DFXP CENTER LEFT/START CENTER (explicit) CENTER CORRECT
15 SRT → SAMI CENTER LEFT CENTER (explicit) CENTER CORRECT
16 DFXP → SCC LEFT/START CENTER N/A (no alignment attribute) CENTER OK (format limitation)
17 DFXP → VTT LEFT/START CENTER START (explicit) LEFT CORRECT
18 DFXP → SRT LEFT/START N/A N/A (no alignment support) N/A OK (format limitation)
19 DFXP → DFXP LEFT/START LEFT/START LEFT/START (explicit) LEFT CORRECT
20 DFXP → SAMI LEFT/START LEFT LEFT (explicit) LEFT CORRECT
21 SAMI → SCC LEFT CENTER N/A (no alignment attribute) CENTER OK (format limitation)
22 SAMI → VTT LEFT CENTER LEFT (explicit) LEFT CORRECT
23 SAMI → SRT LEFT N/A N/A (no alignment support) N/A OK (format limitation)
24 SAMI → DFXP LEFT LEFT/START LEFT/START (explicit) LEFT CORRECT
25 SAMI → SAMI LEFT LEFT none → player uses LEFT LEFT CORRECT

…ting

  between formats with different visual defaults.

  VTT/SRT/SCC visually default to center; DFXP/SAMI default to left/start.
  Without explicit alignment, cross-format conversion causes visual
  regression. The fix detects source format via null layouts and the new
  is_positional_anchor flag, and emits explicit center in DFXP/SAMI output.

  - DFXP writer: emit tts:textAlign=center for VTT/SRT/SCC sources;
    suppress tts:origin from SCC positional layouts
  - SAMI writer: emit text-align:center for centerdefault sources;
    use semantic <i>/<b>/<u> tags; add trailing &nbsp; clearing sync
  - Geometry: add is_positional_anchor to Layout (SCC row/col vs alignment)
  - Tests: update assertions for center alignment and semantic tags
@OlteanuRares
OlteanuRares requested a review from a team as a code owner July 30, 2026 12:39
@github-actions

Copy link
Copy Markdown

🟡 PR Compliance Review

Risk Level: MEDIUM

  • Compliance Issues: 0 (0 critical)
  • Regressions: 0

REVIEW REQUIRED - Address issues before merging

Full report available in workflow artifacts

…ttings

  SCC row/col coordinates leaked as align:left position:N% line:N% size:N%
  in VTT output — a visual regression where centered SCC captions appeared
  left-aligned in VTT players. The is_positional_anchor check now returns
  early from _convert_positioning(), letting VTT default to center.
@github-actions

Copy link
Copy Markdown

🟡 PR Compliance Review

Risk Level: MEDIUM

  • Compliance Issues: 0 (0 critical)
  • Regressions: 0

REVIEW REQUIRED - Address issues before merging

Full report available in workflow artifacts

@OlteanuRares

Copy link
Copy Markdown
Contributor Author

solved with #400

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