forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-mp4/src/demux.rsClear filter

2026-10-23

Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23)

On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local
repository with all of its history. This commit restores the working tree
from the newest surviving copy, the host-c server lane mirror. That mirror
matches local main as of the testcut Phase 2 reports, including the tool
cache, the nextest fast profile and changed-crates.sh. The history before
this commit was not recovered.

2026-09-19

mp4: read the tkhd display matrix and surface it as a typed RotationAhmet Kaan Gümüş · ead0050
mp4: read the tkhd display matrix and surface it as a typed Rotation

ec-core gains a public Rotation (None/Cw90/Cw180/Cw270/Other{a,b,c,d}) and
StreamInfo.rotation, defaulting to None; the only StreamInfo struct literal
in the workspace (the mp4 demuxer) is migrated.

The mp4 demuxer's read_trak now reads the 36-byte tkhd display matrix that
sits before the width/height at the far end of the box, for both box
versions, and maps its 2x2 linear part to a quarter turn clockwise -- the
same reading edith's engine takes, so a consumer no longer needs its own
matrix parser. A matrix that is not a pure quarter turn is carried verbatim
as Other rather than rounded onto a turn it would then apply for real.

Fixtures under crates/ec-mp4/tests/data (rot0/90/180/270/45) are committed
with gen.sh, and the generator reproduces them byte-for-byte. Parse and
surface only: no pixel rotation, and the muxer still writes a unity matrix.

2026-09-06

fix(mp4): a QuickTime .mov kept its esds inside wave and demuxed silentAhmet Kaan Gümüş · 25da208
fix(mp4): a QuickTime .mov kept its esds inside wave and demuxed silent

QuickTime-brand files (Resolve, Final Cut, `ffmpeg -f mov`) state `mp4a` as
a SoundDescription, not an ISO sample entry: the codec configuration sits in
a `wave` box beside the `frma` restating the format, and the entry itself
carries a version-1 tail or a version-2 block before its children. The
reader skipped `wave` outright, so it never found the `esds`, handed the
decoder no AudioSpecificConfig and the sound track played as nothing.

`wave` is now walked for the configuration box the sample entry's own
fourcc names (`esds`, `dac3`, `dec3`, `alac`, `dfLa`, `dOps`), stopping at
the zero terminator. The version-2 block's sample rate, a double, is read
instead of dropped for an `mdhd` timescale nothing applied -- a v2 entry
reported 0 Hz.

The ISO path is untouched: the corpus gains a QuickTime-branded copy of the
AAC fixture, checked against ffprobe for codec, rate, channels and
extradata, and a synthetic v2 entry pins the shape no ffmpeg-written
fixture has.

2026-08-21

2026-08-14

fix(probe): the head of a file is exact, and a default track is the flagged oneAhmet Kaan Gümüş · c665d19
fix(probe): the head of a file is exact, and a default track is the flagged one

Three gaps the symphonia swap (edith W7) found, all at the start of a file or
at the pick of a track:

- **An MP3 is gapless.** The LAME tag's encoder delay and padding went unread,
  so a `.mp3` claimed the silence around its sound as part of it and its
  samples arrived 25 ms behind the `.flac` of the same tone.
  `StreamInfo::initial_padding` now states the delay (the tag's, plus Layer
  III's own 529 samples of synthesis delay) and the duration ends at the last
  audible sample. Measured against ffmpeg on eight fixtures and three files of
  a real library: lag 0, correlation 1.0000, where the mp3 was 1105 samples
  late before.
- **A seek to the beginning goes there.** `candidate` started at the nearest
  *cue*, and a cue naming another track can sit past our own first block: this
  muxer opens a cluster at every video keyframe and cues the video alone, so a
  file whose first cluster holds only sound lost that cluster on every seek to
  zero. Another track's cue now backs off one entry, and a target before
  everything indexed starts at the first cluster.
- **`FlagDefault` picks the track.** `default_stream` answered with the first
  stream of a kind, so a dual-audio remux that marked its second track default
  opened in the other language. `StreamInfo::default` carries the flag where a
  file really wrote it (the element's absent value is 1, which is why
  "flagged" and "eligible" have to be different questions), and the symphonia
  shim's `default_track` reads it.

The shim gains the surface that carries these: `Track::delay`, the umbrella's
feature names (no-ops -- ec-probe serves every format unconditionally -- but a
`[patch.crates-io]` consumer naming `features = ["mkv"]` must still resolve).

Checks: `ec_probe` `the_head_of_a_file_is_exact` (gapless arithmetic exact
against ffmpeg, and no seek lands past a first packet) and `ec_matroska`
`the_first_cluster_is_reachable_when_no_cue_names_it` (fails without the cue
back-off: the audio restarts at 21 ms instead of 0).
fix(mp4): an nclc colr box states no range, and must not be read as oneAhmet Kaan Gümüş · 98eeb6c
fix(mp4): an nclc colr box states no range, and must not be read as one

`ColorInfo` has to answer `full_range` whether or not the file stated one, so
the ten-byte QuickTime `nclc` box -- which stops before the range byte -- was
coming back as a *declaration* of limited range. A host resolving its colour in
tiers then took that fabricated claim as the container tier and shadowed a
bitstream VUI that said full range: a full-range picture displayed as limited,
which is a visibly washed-out one.

`colr` now returns the triplet and the `Tags` that triplet really states, and
`Mp4Demuxer::color_tags(stream)` hands the second one over: an `nclx` states its
range (1 + the flag), an `nclc` and an `nclx` truncated before that byte state
none at all, and a track with no `colr` states nothing. `VideoParameters::color`
is unchanged for every file that really carries an `nclx`.

Latent rather than seen: no file in the scanned library carries an `nclc`.
Fixed as a class anyway -- the same shape sits in ec-matroska, whose `Range`
element is likewise absent-means-limited (`demux.rs:1214`).

cargo test -p ec-mp4: 17 unit + 10 integration passed.
feat(mp4): the index, random access and late-declared streams a host needsAhmet Kaan Gümüş · d7dca0c
feat(mp4): the index, random access and late-declared streams a host needs

The replica's engine reads and writes mp4 through this crate now, and five
things it needs were not reachable through the two traits alone:

- `Sample` is public, and `samples(stream)` hands the whole resolved table
  over. That table *is* the index an mp4 carries of itself -- a caller that
  counts frames, builds a display-order seek table or asks what a track spends
  reads it here instead of walking the file again.
- `read_sample(stream, index)` reads one sample of one stream without moving
  the packet cursor: random access beside the sequential `next_packet`, for a
  caller holding an index of its own.
- `tracks()` lists every track the container declares, in file order, with its
  `tkhd` id, its handler, its sample entry fourcc, its language and its edit
  list's `media_time`. Two things ride on it: a track whose codec this build
  has no id for is still listed (a picker greys such a row out rather than
  pretending the file has fewer tracks than it has), and `avc3` can be told
  from `avc1` by a host that re-injects parameter sets out of the `avcC`.
- `duration_secs()` is the `mvhd`'s own length, which is what a file's byte
  rate is measured over -- not any one track's.
- The muxer takes `add_stream` at any point before `finish`, and `set_color`
  after the stream is declared. Samples are written where they arrive and the
  sample entries are built at the end, so a track declared after the picture
  is already in the `mdat` costs nothing -- which is what lets an export mix
  and encode its sound while it writes the picture, and add its subtitles once
  the film's length is known.

cargo test -p ec-mp4: 10 passed.
feat(mp4): ISOBMFF box model, esds descriptors and the demuxerAhmet Kaan Gümüş · 49be010
feat(mp4): ISOBMFF box model, esds descriptors and the demuxer

The box walk checks every size against its parent and every table entry
count against the box that holds it, so a crafted header is an error and
never an allocation. The moov walk resolves the sample tables into
offset/size/dts/cts/sync per sample, reads fragments (moof/traf/trun)
into the same tables, and takes the frame rate off stts as an exact
rational -- whole track over whole track, so NTSC film stays 24000/1001
instead of decaying into 23.

A sample entry is read for what it says it is: an mp4a holding MP3 is an
MP3 track rather than a dropped one, ac-3/ec-3/alac/Opus/fLaC and the
QuickTime PCM entries are their own codecs, and an entry with no CodecId
leaves its track listed rather than decoded as something else. The esds
parser hands back the DecoderSpecificInfo as bytes, which is the field
callers previously had to rebuild from parsed fields.