Skip to content

feat(aetherctl): a harness for the native subtitle rendition, and the fix it measured (Sodalite#156) - #564

Merged
superuser404notfound merged 2 commits into
mainfrom
feat/aetherctl-subtitle-toggle
Sep 19, 2026
Merged

superuser404notfound merged 2 commits into
mainfrom
feat/aetherctl-subtitle-toggle

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Two commits: the harness first, then the fix it made measurable. Replaces #563, which shipped half of this and was reverted the same day.

The harness

The native rendition path, the one a host uses whenever the picture leaves its own layer (PiP, AirPlay, a wired display), had no VOD harness. serve --native-subs could stand the renditions up and live --force-master could route a channel behind them, but no VOD session here ever loaded with prepareNativeSubtitles, so the half that matters was untestable from the Mac: whether AVPlayer actually holds a legible selection, and whether the engine keeps feeding the one it holds. AE#359 was found the day the live side got a harness; this is the same gap on the other side, and Sodalite#156 walked into it.

Four tokens on the existing --host-calls, no new flags:

aetherctl play --subs ger --seconds 32 \
  --host-calls nativesubs,nativerender@8,subsoff@14,subson@20 file://$PWD/subs.mkv

The observable is a LEGIBLE line with the selection AVPlayer holds next to the track the engine thinks is active. It prints four ticks after a transition, not one: a deselect is a single hop but a select waits on the cue pre-fill, which is seconds. At +1 it reported every on as a failure, i.e. the harness lying in the expensive direction, which is why that offset carries a comment.

What it found, in one table

after render on after off after on
before German / 2 German / nil German / 2
#563 German / 2 none / nil none / 2
now German / 2 none / nil German / 2

Row 1 column 2 is the reported bug: a rendition nobody is filling any more, which on a receiver is an empty caption box. Row 1 column 3 is the accident that hid the other half, and row 2 column 3 is the regression that got #563 reverted within the hour.

The track-switch case reads selected=Englisch - English / 3 on a two-track fixture (subson@N:eng).

The fix

setNativeSubtitleRendering records a standing request rather than acting once. It says where the picture is and holds until the picture comes back or the session ends, which is what lets both ends know the rendition is the display: a host pick re-asserts it, and subtitles-off takes it down. The two were missing together and hid each other.

Off stays the item-level deselect rather than setNativeSubtitleSelected(nil), whose job this otherwise is: that call also clears nativeSubtitleReapplyOrdinal and nativeOrdinalToReplay is guarded on currentOrdinal == nil, so clearing it here would arm the #170 carryover replay and re-select on the next session-preserving reload.

Verification

Full suite, both runners: swift-testing 3104 tests in 423 suites, XCTest 17 tests, 0 failures. Every row of the table above reproduced on demand in 30 s.

Still outstanding: a device round. macOS has no receiver, so what is proven here is that AVPlayer's legible selection ends up where the host asked for it, not that the Apple TV's caption box goes with it.

🤖 Generated with Claude Code

https://claude.ai/code/session_015PM3xUJB6ZQyqnmGK1fp6F

Vincent Herbst and others added 2 commits September 19, 2026 17:11
…ite#156)

The path a host uses whenever the picture leaves its own layer (PiP, AirPlay, a
wired external display) had no VOD harness. `serve --native-subs` could stand
the renditions up and `live --force-master` could route a channel behind them,
but no VOD session here ever loaded with `prepareNativeSubtitles`, so the half
that matters was untestable from the Mac: whether AVPlayer actually HOLDS a
legible selection, and whether the engine keeps feeding the one it holds. AE#359
was found the day the live side got a harness; this is the same gap on the other
side, and Sodalite#156 is what walked into it.

Four host calls, no new flags (the tokens ride `--host-calls`, which is already
threaded through): `nativesubs` sets the load option, `nativerender@N` is the
call a host makes when the picture leaves, `subsoff@N` / `subson@N` are the
viewer turning subtitles off and back on while it is away.

The observable is a `LEGIBLE` line with the selection AVPlayer holds next to the
track the engine thinks is active. It is printed a tick AFTER each transition,
never inside it: both calls finish on a detached task and the select waits on a
cue pre-fill first, so an immediate read reports what the host asked for rather
than what the item ended up with, which is the whole distinction being made.

It reproduces the field report on the first run, headless, in 30 seconds:
`after off: selected=German engineActive=nil` is a rendition nobody is filling
any more, which on a receiver is an empty caption box with no text in it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015PM3xUJB6ZQyqnmGK1fp6F
…directions (Sodalite#156)

Second attempt, and this time it is measured. The first shipped only the off
half, which uncovered that the on half had never existed either, and the two had
been hiding each other: nothing deselected the rendition, so a pick that never
reached it still left the right language on screen.

The harness in the previous commit shows all three transitions in 30 s:

    before        after render on  selected=German  engineActive=2
                  after off        selected=German  engineActive=nil   <- box
                  after on         selected=German  engineActive=2     <- accident

    first try     after off        selected=none    engineActive=nil
                  after on         selected=none    engineActive=2     <- reverted

    now           after off        selected=none    engineActive=nil
                  after on         selected=German  engineActive=2
    switch        after on         selected=Englisch - English  engineActive=3

`setNativeSubtitleRendering` now records a STANDING request rather than acting
once. It says where the picture is and holds until the picture comes back or the
session ends, which is what lets the two ends know that the rendition is the
display: a host pick re-asserts it (mapping included, and it latches correctly
mid-reload), and subtitles-off takes it down.

Off stays the item-level deselect rather than `setNativeSubtitleSelected(nil)`,
whose job this otherwise is: that call also clears `nativeSubtitleReapplyOrdinal`
and `nativeOrdinalToReplay` is guarded on `currentOrdinal == nil`, so clearing it
here would ARM the #170 carryover replay and re-select on the next
session-preserving reload.

Full suite, both runners: swift-testing 3104 in 423 suites, XCTest 17, 0 failures.
Device round still outstanding: macOS has no receiver, so what is proven here is
that AVPlayer's legible selection ends up where the host asked for it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015PM3xUJB6ZQyqnmGK1fp6F
@superuser404notfound
superuser404notfound merged commit c8e42a8 into main Sep 19, 2026
6 of 7 checks passed
@superuser404notfound
superuser404notfound deleted the feat/aetherctl-subtitle-toggle branch September 19, 2026 15:41
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