Skip to content

feat(mp4): add wave box for QuickTime audio decoder configuration - #547

Open
nchitkara-xai wants to merge 1 commit into
Eyevinn:masterfrom
nchitkara-xai:wave-box
Open

feat(mp4): add wave box for QuickTime audio decoder configuration#547
nchitkara-xai wants to merge 1 commit into
Eyevinn:masterfrom
nchitkara-xai:wave-box

Conversation

@nchitkara-xai

@nchitkara-xai nchitkara-xai commented Aug 11, 2026

Copy link
Copy Markdown

Problem

The QuickTime siDecompressionParam atom (wave) wraps the decoder
configuration of QuickTime audio sample entries, so the esds of such an entry
is unreachable as an opaque UnknownBox payload.

Fix

A WaveBox container decodes frma and esds children (reachable as
AudioSampleEntryBox.Wave.Esds), and stays byte-exact for the irregular
content wave atoms carry in the wild:

  • a child that does not decode cleanly — e.g. the 12-byte mp4a stub, or an
    esds whose decode consumes fewer bytes than its declared size — is kept as
    an UnknownBox with its bytes verbatim;
  • a tail that is not a well-formed box — e.g. the terminator atom when
    written with size zero — is preserved verbatim in RawTail.

Decoding a wave body never fails, so garbage inside a wave cannot make a
sample entry undecodable (and cannot trip the ISO-layout fallback of #544).

Tests

Typed frma/esds decode, stub and malformed-esds fallback to UnknownBox,
size-zero terminator tail, programmatic construction, and a wave-wrapped esds
inside a version 1 sound sample entry — all byte-exact through both decode
paths. go test ./..., go vet, gofmt, golangci-lint pass.

The QuickTime siDecompressionParam atom (wave) wraps the decoder
configuration of QuickTime audio sample entries, so the esds of such an
entry was unreachable as an opaque UnknownBox payload.

Add a WaveBox container that decodes frma and esds children, keeps
children that do not decode cleanly as UnknownBox (such as the 12-byte
mp4a stub), and preserves a tail that is not a well-formed box (such as
a size-zero terminator atom) verbatim in RawTail, so round trips stay
byte-exact. The box is reachable as AudioSampleEntryBox.Wave.
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