forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-matroska/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-08-21

2026-08-20

feat(ec-probe,ec-matroska): register the TrueHD decoder in the unified readerAhmet Kaan Gümüş · 4026107
feat(ec-probe,ec-matroska): register the TrueHD decoder in the unified reader

ec-probe's AudioDecoder now carries a TrueHd arm (mirrors Ac3: send_packet/
receive_frame/flush/reset through the generic Decoder trait), so a TrueHD
track decodes through Reader/AudioDecoder like any other codec instead of
only being named in Reader::unsupported. ec-matroska's muxer writes
CodecId::TrueHd back out as A_TRUEHD (demux already read it in); the
symphonia shim needed no change since it wraps ec_probe::AudioDecoder
generically. Library test updated from "TrueHD is listed unsupported" to
"the TrueHD track in his 7.1 remux decodes, 8ch/48kHz, alongside the AC-3
track"; added a demux->mux->demux codec-id round-trip test in ec-matroska.
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.
fix(ec-matroska): derive laced-frame pts from the codec's own frame duration when the file states noneAhmet Kaan Gümüş · 73735ec
fix(ec-matroska): derive laced-frame pts from the codec's own frame duration when the file states none

DefaultDuration absent on a track (e.g. an A_OPUS track laced 8 frames per
SimpleBlock) collapsed every frame in a lace onto the block's base pts,
so a seek landing mid-lace reported a pts up to ~145ms early. emit_block
now steps each laced frame by, in order: DefaultDuration, an even split of
BlockDuration, or a codec-derived duration (Opus TOC byte per RFC 6716,
AAC's fixed 1024-sample frame) -- falling back to 0 only when none apply.

Also fixes a distinct scale bug this surfaced: emit_block was dividing a
codec-derived nanosecond duration by TimeBase::num(), which TimeBase
reduces against 1e9 and is not the file's raw TimestampScale; the real
TimestampScale is now kept on MatroskaDemuxer itself.

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(matroska): a Colour element with no Range child states no rangeAhmet Kaan Gümüş · 18d0fc1
fix(matroska): a Colour element with no Range child states no range

Same class as ec-mp4 2a3816e, in the crate that commit named as carrying it.
`ColorInfo` has to answer `full_range` whether or not the file wrote a `Range`
child, so a `Colour` element without one -- which is most of them -- read as a
*declaration* of limited range. A host resolving colour in tiers then took that
fabricated claim as the container tier and shadowed a bitstream VUI that said
full: a full-range picture displayed as limited, which is a visibly washed-out
one.

`MatroskaDemuxer::color_tags(stream)` hands over what the element really stated
-- the Matroska `Range` coding straight into `Tags::from_codes`, where 0 is
"nothing said" -- and `VideoParameters::color` is unchanged for every file that
carries a `Range`. The unit test holds all three cases.
fix(matroska): the SeekHead really points at the Cues, and four track facts a host needsAhmet Kaan Gümüş · c2c209e
fix(matroska): the SeekHead really points at the Cues, and four track facts a host needs

The `SeekHead` stated the `Cues` position twice off the segment: `cues_at` was
already relative and the table subtracted the segment body again, so the pointer
landed in the middle of a cluster. This crate's own demuxer never noticed --
finding no `Cues` there it falls back to the cluster-header walk and reads the
file perfectly -- while symphonia's reader follows the pointer, meets an element
that cannot be there and refuses the file outright. Found by driving an exported
`.mkv` back through symphonia. The remux test now resolves every `SeekHead`
entry and asserts the element it lands on is the one it names.

Four accessors a host cannot do without, all off the `Tracks` element that was
already parsed:

- `track_codec_id` -- the file's own `CodecID` (`A_EAC3`, `S_HDMV/PGS`), which
  says more than the `CodecId` it maps to and is what a copy and a refusal name.
- `track_title` -- `TrackName`, now parsed and now written: `set_track_title`
  puts it back, so a subtitle track called "Signs" survives a remux.
- `track_refusal` / `track_is_plain` -- what a `ContentEncodings` this cannot
  undo did, asked at the header instead of a cluster later, so one unreadable
  subtitle track is listed beside the readable ones rather than failing the file.
- `unread_tracks` -- the `TrackEntry`s this crate hands no stream for, with
  their type: "MPEG-2 video nothing here decodes" is an answer, "no video track"
  is a lie about the same file.

And `set_track_delay`, which writes `CodecDelay` for a track whose encoder delay
only the caller knows: Opus states its own pre-skip in the `OpusHead` and is
unaffected, AAC's is one access unit and nothing in the file says so -- a track
written without it plays ~21 ms early against the picture.
feat(core): TrueHD and DTS codec ids, and a Matroska track's own numberAhmet Kaan Gümüş · 254c09a
feat(core): TrueHD and DTS codec ids, and a Matroska track's own number

A track nothing here decodes is named rather than dropped: a player that
lists a TrueHD track as unsupported tells the user something, and one
that shows no audio at all does not. The Matroska reader maps A_TRUEHD,
A_MLP and the A_DTS family onto them.

MatroskaDemuxer::track_number answers what TrackNumber a stream index
came from, which is how a caller names one language of a dual-audio
remux (edith matches its audio streams by that number).
feat(matroska): EBML grammar and Matroska/WebM demuxerAhmet Kaan Gümüş · 4888147
feat(matroska): EBML grammar and Matroska/WebM demuxer

The element grammar both directions share (variable-length ids and sizes,
in-memory child walks, the unknown-length rule) and the reader on top of it:
segment and track walk, cluster walk, SimpleBlock and BlockGroup, all three
lacings, ContentEncodings undone (zlib through ec-inflate, header stripping
put back, everything else refused by name), and cue-driven seeking on the one
reader a file was opened with.

Ported from the engine's own demuxer, restructured around the ec-core Demuxer
contract: packets stream out of one cluster-sized allocation instead of a
frame index built for a video editor, and every track of the file becomes a
StreamInfo rather than one picture track plus a sound list.