forge
Explore
Log in

Don't you dare go Hollow

Commits

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

2026-11-15

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-08-20

feat(mux): declare an audio encoder's priming so no-elst/no-CodecDelay means zero delayAhmet Kaan Gümüş · f40e85c
feat(mux): declare an audio encoder's priming so no-elst/no-CodecDelay means zero delay

Root cause: mp4's elst and Matroska's CodecDelay only ever came from a
reordered video track's ctts offset, so an AAC track's encoder priming (one
1024-sample frame, always) was never written. A downstream reader had no way
to distinguish "this file truly has zero delay" from "this file's muxer never
said" and had to guess a fallback -- guessing wrong either trims real audio
from a genuinely delay-free file or leaves an encoder's priming samples in.

ec-mp4: Mp4Muxer::set_audio_delay(stream, priming_samples) folds into the
same elst media_time/segment_duration the video-reorder path already writes
(a shift, never a trim); the demuxer already applied elst generically, so no
demux change was needed there -- verified with a mux+demux round trip.

ec-matroska: the muxer already wrote CodecDelay (set_track_delay), but the
demuxer never read it back. CodecDelay is a decode-but-don't-play priming,
the same contract as StreamInfo::initial_padding (which mp3/Opus already use)
and not a timeline shift, so it is converted ns -> samples and reported there.

ec-aac: AacEncoder::encoder_delay() -> usize accessor (1024, the fixed cost
of the first MDCT window's overlap-add having nothing to overlap yet) for a
muxer caller to pass into the above.

Tests: ec-mp4::aac_priming_round_trips_through_an_elst,
ec-matroska::aac_priming_round_trips_through_codec_delay.

2026-08-14

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): the writer, with the boxes edith wrote by hand in-crateAhmet Kaan Gümüş · 7336903
feat(mp4): the writer, with the boxes edith wrote by hand in-crate

One pass: ftyp, then an mdat the samples stream into, then the moov built
from what was written (a faststart layout would have to copy the whole
mdat a second time). Sample tables are generated from the packets --
run-length stts, ctts only where something is reordered, stss only where
some sample is not a sync one, co64 where the file is big enough to need
it -- and an elst is written where the first picture is not the first
decoded one, so a reordered track does not start late.

The four boxes edith patched into the incumbent's output are written here
instead: av01+av1C, hvc1+hvcC, colr nclx (with mdcv/clli beside it, so an
HDR grade survives a remux) and udta/name for the movie and each track,
plus a tx3g entry with its style and font table.