Repository navigation
Media: use craft-media for bitstream, isobmff and matroska - #1034
Conversation
deckcraft-bitstream, deckcraft-isobmff and deckcraft-matroska re-export
craft_media::{bitstream, isobmff, matroska} from craft-libs. The packages
and their public paths stay, so the codec crates build unchanged.
deckcraft-bitstream keeps the decoder memory budget as its own module
(budget). deckcraft-media names the new CodecConfig::Apv entry.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Please repin to the canonical craft-media merge commit and rerun the media import/save/reopen and WASM checks against that revision. |
|
Repinned to storytold/craft-libs at f0ad6c1e (craft-libs#246) and merged main. |
What
deckcraft-bitstream,deckcraft-isobmffanddeckcraft-matroskabecome re-exports ofcraft_media::{bitstream, isobmff, matroska}from craft-libs:Cargo.toml:craft-mediain[workspace.dependencies],default-features = false.Each crate enables the feature it re-exports.
src/lib.rsis onepub use craft_media::<module>::*;line. The sources theyreplace are deleted (8,909 lines).
deckcraft-bitstreamkeepsbudget(the picture-store memory budget the H.264, HEVC, VP9 andAV1 decoders check) as its own module next to the re-export.
budget.rsis unchanged.deckcraft_bitstream::budget,deckcraft_matroska::ebml,deckcraft_matroska::element_ids), so the codec crates buildunchanged and
cargo xtask layerskeeps its table.crates/media/src/video.rs:codec_namenames the newCodecConfig::Apv("APV"). It is theonly exhaustive match on a container type outside the replaced crates.
DeckCraft's copies were older than FilmCraft's, so DeckCraft gains APV (MP4 and Matroska),
MPEG-1 audio in Matroska (
Codec::Mp1),.mp2as MPEG audio, AAC channel configurations 11–14,SampleEntry::av1/flac,Mp4Writer::set_sample_entry, Matroska block additions(
Sample::addition,MkvFile::read_sample_addition) andisobmff::boxes.Every input check in DeckCraft's copies is in craft-media:
read_ue_plus, NAL length widths1–4 and the overflow-safe NAL length check,
read_se/write_serange handling, thechapter/tag nesting limit, the box, run,
trunand crop checks, and the QuickTime v2 channelcount and
lpcmbit-depth checks (craft-libs#246).Behaviour that differs from DeckCraft's copies, for input outside the contract only:
BitError::InvalidNalLengthSize(DeckCraft's copy:InvalidLengthSize). Nothing in DeckCraft names either.read_sereads the code fori32::MIN, as the spec allows; DeckCraft's copy rejected it.Every
se(v)field the H.264 and HEVC decoders use in arithmetic is range-checked first.PcmConfig::bytes_per_framereturnsu32and saturates; DeckCraft's returnedOption<u32>.DeckCraft decodes audio with Symphonia, so this only affects what
media.inforeports.i64::MAX, or a block timestamp that overflows, saturatesat
i64::MAXinstead of failing the open. Chapter and tag nesting is cut at 64 levels insteadof 32.
MkvWriterwritescraft-mediaas MuxingApp/WritingApp. DeckCraft does not mux Matroska.Why
FilmCraft, SoundCraft, LightCraft and EffectCraft use the same code. The copies had drifted:
DeckCraft lacked FilmCraft's APV and block-addition work, and FilmCraft lacked DeckCraft's
overflow checks. craft-media has both, and with one shared copy a fix lands once.
Pin
craft-mediais pinned tostorytold/craft-libsatf0ad6c1e(craft-libs#246, after #182,#196 and #245), the same way as
craft-pdf.Checks
cargo xtask ciatcdf116a, on Linux withCRAFT_FONTS_DIRset to craft-fonts at43913056(the ref CI uses): all 8 steps passed.cargo fmt --all -- --check,cargo xtask pdf-deps,cargo clippy --workspace --all-targets -- -D warnings: clean.cargo xtask assets: all 47 asset files attributed.cargo xtask layers: 28 crates, no layering violations.cargo xtask wasm: all 23 crates ok, includingdeckcraft-bitstream,-isobmff,-matroskaand-media.deckcraft-cli run:insert.videoof an ffmpeg-made H.264/AAC.mp4and a VP9/Opus.mkv, thenmedia.infoand--saveto.pptx. Both probe with the right container, codecs and duration and get a decoded poster frame. Reopened from the.pptx,media.infois identical to the same steps on main (c787f4f).Summary by CodeRabbit