The ADM writer only exported object positions, so the size, gain and divergence
present in the E-AC-3 JOC metadata never reached the ADM BWF.
build_adm_tracks now keeps the per-object render state that frame_state()
already produces (gain, size, divergence, snap). The state is carried across
frames without an OAMD payload and a snapshot is attached to every ADM
keyframe; inactive objects write gain 0 so their PCM is muted in the ADM.
Divergence follows the speaker renderer's per-payload behaviour: it is taken
from the current payload and is 0 when the extended element does not carry it,
rather than holding a stale value.
adm_serializer writes the metadata on each audioBlockFormat:
- size -> width/height/depth (relative units 0..1, OAMD width/depth/height
order; all three are written together);
- gain -> gain gainUnit="linear" (only when it is not unity);
- divergence -> objectDivergence positionRange (only when non-zero).
Defaults (point source, 0 dB, no divergence) omit the elements, so existing
outputs are unchanged.
Verified on a 30 s E-AC-3 JOC excerpt: PCM and the default axml stay
byte-identical to the previous writer, the ADM validator passes, and a
metadata-override ADM carries width/height/depth with unchanged PCM. The
speaker controls tests still pass.
Parse the trim element: warp_mode, global_trim_mode, the nine
per-configuration trim_balance_presence records, and the per-object
bypass flags. Select the configuration that applies to a layout from
its surround and height speaker counts:
cfg = kappa_f(surrounds) + 3 * kappa_h(heights)
kappa_f: 0 -> 0, 2..3 -> 1, otherwise 2
kappa_h: 0 -> 0, 2 -> 1, otherwise 2
Write the configuration to both carriers:
* AXML gets a DolbyAtmosMasterFile container holding
DolbyMasterContentInfo, DolbyTrimModeSetup (one records entry per
configuration with centerTrim, surroundTrim, heightTrim and the two
balance fields) and DolbyWarpMode.
* Segment 10 of the dbmd chunk gets the nine 15-byte records: bit 0
is the automatic flag, and an explicit record carries three float32
trims followed by two sign-magnitude balance bytes.
Configurations left at default keep the automatic flag and carry no
value elements.