forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 7f487c10e98d32efa4e4b554b778d2eea5d16efdFiltered to crates/engine/tests/capability_matrix.rsClear filter

2026-08-12

✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusingAhmet Kaan Gümüş · c94ba8b
✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusing

An 8-channel Opus track came back "IMPORT FAILED: unsupported channel
layout: 8 channels (max stereo)" and took the picture with it, and a
48 kHz file "audio 48000 Hz 2 ch does not match the timeline's 44100 Hz
2 ch". Both strings are gone: an import converts.

Width: `fold_5_1` becomes `downmix`, a coefficient table per layout from
2.1 to 7.1 (ITU-R BS.775 — front channels keep their side, centre and
surrounds join at -3 dB, LFE dropped, both sides normalised by their own
coefficient sum so a full-scale source cannot clip). 5.1 comes out of the
table bit-identical to what it was. `vorbis_to_film_order` gains the RFC
7845 permutations for 3, 5, 7 and 8 channels beside the 6 it had, so
surround Opus at any width reaches the fold in the order the fold reads.
The AC-3 decoder's own 2.1 passthrough, which it leaves at 3, folds here
too, and a multichannel AAC track in an *mp4* now takes the `rusty_aac`
route the Matroska side already had (`aac_decoder`, one call for both).

Rate: the segment resampler a speeded clip already goes through takes the
source rate over the timeline's into its step, so the two compose into one
interpolation and 48 kHz onto a 44.1 kHz timeline keeps its pitch. All of
it is convert-on-read — per packet in the decoder, per buffer in `emit`,
after the window trim — so there is no upfront pass to show progress for
and nothing to cancel.

What is still refused is the layout alone: a mono track cannot join a
stereo timeline, in the words "audio 1 ch does not match the timeline's
2 ch". The picker's grey-out rule follows the gate rather than leading it.

Measured on a 12.9 GB 2160p AV1 remux with a real-library 7.1 Opus
track: imports, opens as a timeline, and a ten-second WAV export comes
back at RMS 0.0091 left / 0.0085 right.
🔊 feat(audio): an Opus film is heard, not refusedAhmet Kaan Gümüş · 699950a
🔊 feat(audio): an Opus film is heard, not refused

The refusal was the bug again. `is_audio` said "no opus, ac3 or dts, for
which no pure-Rust decoder exists" while symphonia's own mkv and ogg readers
have always mapped `A_OPUS` and `OpusHead` to `CODEC_ID_OPUS`: the containers
read the format, only the decoder was missing. Symphonia genuinely has none
at any version -- its feature list stops at vorbis and there is no
`symphonia-codec-opus` crate -- so the decoder is `ruopus`, pure Rust, MIT,
no dependencies of its own, and the film plays.

Which crate is not a coin toss. A 5.1 track is four elementary Opus streams
in one packet, all but the last self-delimited (RFC 6716 App. B).
`rusty-opus 0.9.1` -- the sibling of `rusty_aac`/`rusty_mp3` already here --
hands each self-delimited slice to a decoder that parses it as an ordinary
packet, so every stream but the last reads the length prefix as payload: it
was measured on a 5.1 Opus remux as full-scale noise at -13
dBFS over a passage where the film is silent, which is exactly the failure
that "the decoder returns samples" would have shipped. `ruopus` matches
ffmpeg's decode of the same file to a correlation of 1.00000 on all six
channels.

Two things that are Opus's alone: it is stored in Vorbis channel order
(FL, FC, FR, BL, BR, LFE) and the 5.1 fold reads the film order every other
decoder here hands back, so the frame is permuted before it folds; and its
encoder delay lives in the stream (`OpusHead`'s pre-skip, 312 samples) where
neither reader drops it, so that is this track's priming -- sample-exact
against ffmpeg afterwards, 6.5 ms late before.

`.opus` and `.mka` join `is_audio`, `unsupported` asks the other reader
before naming a codec (a refusal that fires on a track which decodes is the
same defect wearing the other face), and `capability_matrix` covers Opus per
container with DTS left as the one live refusal row.
🐛 fix(demux): a codec's support is probed per container, not inferred from a neighbourAhmet Kaan Gümüş · 4f4dcb4
🐛 fix(demux): a codec's support is probed per container, not inferred from a neighbour

VP9 was decodable out of an mp4 and refused out of a .webm — `V_VP9` fell
through the Matroska track dispatch into `OtherVideo` and came back as
"V_VP9 video in a Matroska file is not supported", with the VA-API VP9
decoder wired in `engine-hw` the whole time. A browser-downloaded .mkv was one of those
files.

Both dispatches now read one table (`CODEC_IDS`), and the Matroska arm
matches on `Codec` with no wildcard, so a codec added to the enum fails
to compile until it has been routed rather than falling through to a
refusal. A cell that is deliberately absent is a row in `UNSUPPORTED`
with a reason, and the refusal quotes that reason instead of listing
what is supported and leaving the user to guess.

The mp4 video track comes out of `moov.traks` in file order, not a
`HashMap` walk of `Mp4Reader::tracks()`: a file with two video tracks
opened on a different picture from one run to the next, and a saved
.edith reopened on the other one. `audio::audio_track_ids` fixed the same
trap for sound; the naming half of `AudioSession::unsupported` had it too.

VP9 states its bit depth in no container record — an mkv `TrackEntry`
carries none and an mp4's `vpcC` is optional — so it is read off the
first keyframe's uncompressed header. Assumed 8-bit, a profile 2 stream
would decode into an NV12 pool and come back as garbage; 12-bit is
refused by name like 12-bit AV1 and HEVC.

The audio refusals said "AAC and AC-3 only" long after FLAC, MP3, Vorbis,
ALAC and PCM decoded out of a Matroska file. They name the real set now,
per container, because an mp4 video's sound never reaches symphonia and
reads fewer codecs than an mkv does.

tests/capability_matrix.rs holds all of it against real files.