Skip to content

feat(video): publish the 3D layout a source declares - #1154

Open
RockJohnson503 wants to merge 1 commit into
superuser404notfound:mainfrom
RockJohnson503:feat/source-video-stereo
Open

RockJohnson503 wants to merge 1 commit into
superuser404notfound:mainfrom
RockJohnson503:feat/source-video-stereo

Conversation

@RockJohnson503

Copy link
Copy Markdown

Summary

Publishes the 3D layout a source declares, so a host that badges a 3D title, or draws the two views itself, reads it instead of guessing from the file name. Today the engine reads the declaration for the visionOS stereo session only.

What changed

  • New public VideoStereoLayout: .mono, .multiview, .sideBySide(rightViewFirst:), .overUnder(rightViewFirst:), .frameSequence(rightViewFirst:), .other.
  • New @Published sourceVideoStereoLayout, set by the load probe next to sourceVideoStreamFormat. nil before load, without video, when the source declares nothing and on the remote-HLS bypass. Kept across reloads, reset on stop.
  • It is the declaration, not the presentation: the same on every system and under every stereoPresentation. Frame sequence (Matroska block_lr, a 3D Blu-ray MVC remux) and 2D are published too, though no session presents them.
  • VideoStereoLayout.resolve is the one mapping from the side data. StereoVideoSignal.resolve reads it under .automatic. The signal it picks and its log lines are unchanged.
  • A disc title switch does not re-read it, like sourceVideoStreamFormat: a disc's MPEG-TS or PS carries no stereo declaration.
  • Docs: api.md (a row, a Stereo layout section, a line under stereoPresentation), features.md, formats.md, guide.md, source-map.md. CHANGELOG under Unreleased.
  • Tests: the mapping table, and a load under .mono that publishes block_lr and left_right, keeps them across a reload and clears them on stop. The two Matroska fixtures in Issue435MultiviewCarriageTests drop private so both suites share them.

Test plan

  • Device / OS: Mac mini (Apple M4), macOS 27. Not run on a Vision Pro; the stereo session path is unchanged.
  • Source media (container / video codec + profile / audio / HDR-DV): the in-repo Matroska fixtures, 64x64 H.264, no audio, SDR, StereoMode block_lr and left_right. The side data FFmpeg reports for Matroska mono, right_left, bottom_top, block_rl, checkerboard and an MP4 st3d mono was checked with ffprobe (FFmpeg 9.0.2).
  • Result: swift build passes. swift test: 6885 tests pass. swift test --enable-all-traits: 7383 tests pass. check-doc-links.py, check-source-map.py and check-test-hygiene.py pass.

Checklist

  • CHANGELOG.md updated
  • Commit messages follow Conventional Commits (feat(...), fix(...), chore(...))
  • The fix lives in the engine, not in a host-side workaround
  • Public API changes are intentional and documented
  • Docs updated for every changed behaviour, in the page that owns the topic, in plain short sentences (the CHANGELOG entry does not count)

The engine read a source's stereo declaration (Matroska StereoMode, an
MP4's st3d or vexu, the MV-HEVC multilayer disposition) for the visionOS
stereo session only. A host that badges a 3D title, or draws the two
views itself under .mono, had to guess from the file name.

sourceVideoStereoLayout publishes it at load as a VideoStereoLayout:
mono, multiview, side by side, over-under, frame sequence (each packing
with rightViewFirst for the inverted order) or other. It reads the same
on every system and under every stereoPresentation, is kept across
reloads and is reset on stop.

VideoStereoLayout.resolve is the one mapping from the side data.
StereoVideoSignal.resolve reads it under .automatic, so a host sees the
declaration the session plays from. The signal it picks and its log
lines are unchanged.

@quint-aether quint-aether Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review

Status: 🟡 Minor follow-ups. Only small touch-ups left.

This PR publishes the 3D layout a source declares as sourceVideoStereoLayout (a new public VideoStereoLayout). The value is read once in the load probe from the same side data and multilayer disposition that the stereo session already uses. The direction is right: the engine exposes what it already knows, so hosts no longer guess from file names. The .automatic branch of StereoVideoSignal.resolve now goes through VideoStereoLayout.resolve and keeps its old behaviour. Multilayer is still checked first and still needs HEVC. Side-by-side and over-under still map to the same packing, and every other case still logs "no stereo".

Findings

  • Nit: The Stereo layout section says "Kept across reloads, reset on stop" but does not say what a disc title switch does. The Scan type section just above does say it. One clause would settle it, for example "not re-read on a disc title switch (a disc's MPEG-TS or PS declares no stereo)". (docs/api.md:1327)

Checklist: CHANGELOG yes, docs yes, tests yes, traits both ways n.a.

Needs a device run: Nothing new beyond CI. The visionOS stereo session should be unchanged. Only a Vision Pro run would confirm that MV-HEVC and packed HEVC still pick the same signal, though the refactor keeps the old mapping.

Thanks for a clean, well-scoped change with docs in every page that owns the topic.

Automated review by Quint (Claude) of 805d4ef. It reads the code, it does not build or run it; a maintainer reviews and merges.

Comment thread docs/api.md
- A packed frame does not declare whether each view keeps full or half size. The frame size and `sourceVideoPixelAspectRatio` tell.
- It is the declaration, not the presentation. It reads the same under every `stereoPresentation` and on every system, those that play 3D in 2D included.
- nil before load, without video, when the source declares nothing, and on the probe-free remote-HLS bypass.
- Kept across reloads, reset on stop.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the Scan type section above says what happens on a disc title switch, but this section does not. The PR body says the layout is not re-read on a title switch, like sourceVideoStreamFormat. A reader comparing the two sections may wonder whether the omission matters. Suggest adding: "Kept across reloads, not re-read on a disc title switch (a disc's MPEG-TS or PS declares no stereo), reset on stop."

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