Commits
Commits on
35bdf352fffe9566dd2dcdd84bdee33a3b4672fcFiltered to crates/ec-probe/src/lib.rsClear filter2026-08-21
2026-08-20
Merge branch 'probe-mka-duration': rescale initial_padding into the stream time baseAhmet Kaan Gümüş · fd94bb0Browse files
fix(ec-probe): rescale a stream's initial_padding into its own time_base before subtracting it from durationAhmet Kaan Gümüş · 28b9982
fix(ec-probe): rescale a stream's initial_padding into its own time_base before subtracting it from duration Reader::duration() subtracted `initial_padding` (a sample count) straight off `duration` (time_base ticks). The two units only coincide when the time base is 1/sample_rate; a Matroska file's TimestampScale usually is not (commonly milliseconds), so a stream's CodecDelay-derived padding — 1024 samples for AAC — was read as 1024 whole ticks and lopped a third off the stated length (aac-mka-stereo-48000.mka: 3.021s -> 1.997s). Root cause: crates/ec-probe/src/lib.rs Reader::duration() (StreamInfo's own doc comment at crates/ec-core/src/registry.rs:245-249 already says initial_padding is samples, not time_base ticks). Fixed by rescaling initial_padding through TimeBase::from_rate(sample_rate) into the stream's time_base before subtracting. Lacing/BlockGroup handling in ec-matroska was already correct — not the bug.
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.
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).
feat(probe): one sniffing reader and one decoder registry for every audio fileAhmet Kaan Gümüş · 51de303
feat(probe): one sniffing reader and one decoder registry for every audio file Content decides the format, never the extension: RIFF, fLaC, OggS, EBML and ftyp by magic, MP3 and ADTS by three chaining frames after any ID3 tag (a lone MPEG audio header turns up inside AAC payload often enough that a single sync is not evidence). WAV, MP3, FLAC and ADTS are demuxed here — one walk, four framings, a frame index built on the first seek so a landing is sample-accurate. Ogg, mp4 and Matroska are delegated to their own crates: there is one EBML parser in this family and it is ec-matroska (cargo tree -p ec-probe shows the edge). Everything is served on the one reader the file was opened with, however many times it is seeked. Reader::seek answers where it actually landed, which is the number a segment start is trimmed against. Reader::unsupported names every audio track with no decoder and why. Cover art is not a video track and never appears as one. Tags: ID3v1/v2 and Vorbis comments; mp4 ilst is not read (edith reads no metadata today) and says so in the module docs. Verified: 26-file fixture matrix (format, codec, channels, packet counts against ffprobe, sample counts against ffmpeg), 100 random seeks per file each landing at or before its target within the container's own granularity, and a 9-file sweep of the real library covering aac, ac3, eac3, opus, mp3 and a TrueHD remux whose unplayable track is listed.