Skip to content

spatial: expand SpatialAudioFormat enum (MPEG-H MHM1/MHA1, APAC, ASAF clarification) #39

@Salem874

Description

@Salem874

Summary

meedya-codecs::spatial::SpatialAudioFormat covers 9 variants (DolbyAtmos, DtsX, DtsXImax, MpegH3d, Sony360Ra, AppleSpatial, Auro3d, Iamf, Ambisonics). Consuming apps need finer-grained MPEG-H sub-variants plus 1–2 missing Apple formats. Filed in response to MeedyaManager#131 (spatial audio detection) which is blocked on these.

Parent epic: #9 (meedya-codecs detection).

Requested additions / clarifications

Definitely new

New variant Display name Authoritative signal Notes
Apac APAC (Apple Positional Audio Codec) Codec four-CC apac in MP4 stsd (verify against tvOS 17+ / AirPods Pro 2 samples) New Apple codec, sparse public docs. FOUR-CC needs verification before shipping.

MPEG-H sub-variant question (decide one)

Either:

(a) Keep MpegH3d as a single variant; carry MHM1 vs MHA1 in a separate MpegHContainer field on the detection result. Simpler enum; sub-variant is metadata.

OR

(b) Split into MpegH3dMhm1 (broadcast, multi-frame) and MpegH3dMha1 (file storage, single-frame). Distinct four-CCs (mhm1 vs mha1), distinct config atoms (mhmC vs mhaC).

Recommendation: (b) — distinct identifiers + distinct config atoms argue for distinct variants. Downstream apps may want to filter / route differently for broadcast streams vs stored files. Sony360Ra would still be its own variant, detected when the sub-profile signals 360RA regardless of MHM1 vs MHA1 container.

Apple Spatial Audio Format (ASAF) — clarification needed

The existing AppleSpatial variant currently means "binaural rendering of Atmos" (per the source comment). Downstream apps using the name "ASAF" may mean something different — a distinct Apple file format (possibly an MPEG-H-over-Apple-container variant in Apple Music spatial downloads).

Possible outcomes:

  • (i) Confirm AppleSpatial IS what's commonly called ASAF in Apple's public messaging — document the equivalence in the doc comment and close.
  • (ii) ASAF is distinct (e.g. a specific Apple-only MP4 atom layered on MPEG-H base) — add AppleAsaf as a separate variant; keep AppleSpatial as the binaural-rendering hint.
  • (iii) ASAF is a marketing-only term for Atmos-via-EAC3-JOC delivery on Apple platforms — document this and prefer DolbyAtmos for detection.

Needs Apple-developer-docs cross-check. Tracked here so downstream MeedyaManager#131 has a definitive answer.

Method changes

For any new variant added:

  • SpatialAudioFormat::display_name() — new strings
  • is_object_based()Apac → ? (TBD per Apple docs); MHM1/MHA1 → true (MPEG-H is object/scene hybrid)
  • is_scene_based() — both MPEG-H variants → true
  • requires_license()Apactrue (Apple proprietary); MHM1/MHA1 → false (open standard but patents apply via MPEG-LA pool — call this out in the doc comment)

Detection-side hooks (for follow-up under #9)

Detection should populate source_signal strings:

  • apac_four_cc
  • mhm1_four_cc_plus_mhmC / mha1_four_cc_plus_mhaC
  • mpegh_360ra_sub_profile — for 360RA detected via MPEG-H base sub-profile + Sony encoder string

Safety / false-positive avoidance (for callers)

  • Sony 360 Reality Audio MUST NOT also flag as MpegH3dMha1 / MpegH3dMhm1 — once 360RA markers match (sub-profile + encoder string), suppress the generic MPEG-H label.
  • IMAX Enhanced DTS:X MUST NOT also flag as plain DtsX — once IMAX signaling matches, emit DtsXImax.
  • A file with Apple-Music-spatial metadata is generally Dolby Atmos via EAC3+JOC — don't auto-classify as AppleAsaf based on filename / iTunes metadata alone.

Backwards compatibility

Purely additive for Apac and MpegH3dMhm1 / MpegH3dMha1 (if we split). If we keep MpegH3d and add a separate sub-variant field, that's also non-breaking.

For ASAF: outcome (i) is non-breaking (docs only). Outcome (ii) is non-breaking (additive). Outcome (iii) is non-breaking (docs only, plus possibly deprecate AppleSpatial if the name causes confusion).

Serde rename-all (kebab-case) applies:

  • apac
  • mpeg-h-3d-mhm1, mpeg-h-3d-mha1 (option b)
  • apple-asaf (option ii)

Acceptance

  • Decision on MPEG-H sub-variant strategy (a vs b)
  • Decision on ASAF (i / ii / iii) — backed by Apple docs reference
  • APAC four-CC verified against actual sample
  • New variants added with display_name() / is_object_based() / is_scene_based() / requires_license()
  • Unit tests for classification + serde roundtrip
  • Doc comments updated for any clarified existing variants

Refs MeedyaManager#131, #9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions