* fix(media): support custom ftyp compatible brands and real ReferenceBlock deltas
* fix(media): satisfy clippy::chunks_exact_to_as_chunks in ftyp test
next makes craft-media optional in craft-video, and main's track decoder (built with any decoder
feature, now including ffv1 and vp8-decode) imports craft_media::CodecParams. Every feature that
builds the track module now turns on craft-media, as dnx and av1-decode already do.
The AV1 descriptor fields `seq_level_idx[0]` and `seq_tier[0]` are code, so rustdoc no longer
reads `[0]` as an intra-doc link (next's media workflow documents with -D warnings).
Merges main at d7c9632bfb.
- Cargo.toml: both sides' new workspace crates (next's font-subset, harfbuzz-subset-sys and
host; main's gpu, gpu-null, gpu-providers and gpu-wgpu).
- crates/jpeg: next split lib.rs into modules; main's reduced-size decoding goes to them: the
scaled IDCT, reconstruction and render_scaled to idct.rs, MAX_SHRINK, reduced_estimate and
decode_reduced stay public in lib.rs. Main's new test added; the frame test next removed
stays removed.
- crates/audio, crates/media: next builds the integration tests into the library's test
executable (autotests off, tests/main.rs); main's new DSD and MPEG-TS mux tests are modules
there behind their features instead of [[test]] targets, and the mux tests reach their shared
helper module through the integration module.
- crates/media/src/matroska/track.rs: main's new FFV1 codec-parameter test added; the test
modules next removed stay removed.
- crates/file-formats: main's JXL capability test, which asks the codec whether JXL reads,
replaces next's interim check.
* craft-media: mpegts::mux writes MPEG-2 transport streams frame by frame to any io::Write
The mpegts feature gains a transport stream writer (ITU-T H.222.0 |
ISO/IEC 13818-1) next to the demuxer:
- PAT and PMT with the CRC-32 the demuxer checks (ts::crc32_mpeg), at
the start, every psi_interval, directly before video keyframes, and
after replace_writer and discontinuity; a PMT longer than one packet
spans packets.
- One PES packet per frame for H.264, HEVC, MPEG-1, MPEG-2 and MPEG-4
Part 2 video, AV1 (Carriage of AV1 in MPEG-2 TS), AAC (ADTS, or raw
frames given an ADTS header), Opus (Opus transport draft V0.1.3,
including explicit channel mappings and trims), AC-3, E-AC-3 and MPEG
audio, with PTS and DTS modulo 2^33.
- The PCR on a stream's PID or its own, at most pcr_interval apart
(100 ms at most), PCR-only packets in gaps, advance() for idle live
outputs, continuity counters, random access and discontinuity
indicators.
- Packets go out in batches of batch_packets (7 by default) built in
fixed buffers; replace_writer returns per-segment facts.
- Frames are checked before anything is written; video frames are
limited to MAX_UNIT_BYTES so the demuxer reads every one back.
Tests read every codec back with the demuxer (bytes, PTS, DTS, keyframes,
PCR range, no continuity or CRC warnings), check the PES header bits and
the refusals, and fuzz programs, timelines, idle gaps and output swaps.
* craft-media: mpegts::mux leaves out zero-ended AV1 padding and refuses 960-sample AAC configs
An AV1 padding OBU that ends with a zero byte, an empty one included, is
now left out like a temporal delimiter instead of failing the whole
temporal unit. Decoders ignore padding, and the trailing zero would
otherwise form a forbidden sequence with the next start code.
Codec::aac_from_asc refuses an AudioSpecificConfig with frameLengthFlag 1:
an ADTS header has no field for 960-sample frames, so decoders would read
the stream as 1024-sample frames.
* craft-media: the transport stream packet checker refuses a PCR flag in an adaptation field shorter than seven bytes
* craft-media: README states the multistream layout for 3 to 8 channel Opus
An Opus { channels } access unit is one Opus packet for 1 or 2 channels.
For 3 to 8 channels it holds the mapping family 1 streams in the order
of table 4-3 of the Opus transport draft, every stream but the last
self-delimited (RFC 6716 Appendix B). The README now says so, matching
the Codec::Opus doc comment.
Merges main at 3b8e426a26.
- crates/ui: main's e-sign dialog (crates/ui/src/esign) moves to craft-cloud-ui beside the
share dialog, behind craft-cloud-ui's esign feature; craft-ui forwards `esign` and
re-exports the module.
- crates/proof: main's can_suggest_cased goes to affix/check.rs and its tests to
affix/tests.rs (next split affix.rs); French wiring in lib.rs.
- crates/svg: main's validated resolver and raster validation stay under tree-render, which
now also enables gif and image-webp; the shared image-codec helpers are gated on tree.
- craft-ai-agents: main's rev (craft-ai-integrations main), one entry.
- crates/craft: facade dependencies, features and re-exports for main's new crates.
- Workflows: main's per-crate layout, with next in the push triggers, Linux only for pushes to
next, next's crate features (keymap egui, window and update ui) and test paths (crw samples and
the pdf fixtures run inside the lib's test binary). The workspace gate keeps --keep-going and
the facade-as-an-app clippy from next's ui.yml. Per-crate doc steps live in docs.yml, which also
documents craft-ui, the ui-* crates, craft-doc and craft-pdf with every feature. docpath, i18n,
print and ui workflows go, as on main. actions.lock lists docs.yml and theme.yml.
- Main's cloud and share UI (account, cloud, share, presence, the overflow menu and split button)
lives in the new crate craft-cloud-ui as main wrote it; the craft-ui facade forwards share and
cloud and re-exports account, cloud, share and presence, so craft-cloud-local builds unchanged.
- audio and media: main's new tests join tests/main.rs under their features.
- cms: main's new synth and FOGRA39 tests, with the fogra39() helper they use.
- nextest: no gpu group on unix; next's tests create no GPU device.
storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.
- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
file() only checked length when reopening after eviction, so a prefix
read could still succeed if the handle was pooled. Check metadata on
the cached handle too, and drop the entry if the file is shorter or no
longer a regular file. MAX_OPEN_FILES is documented as a bound on
retained pool entries, not in-flight Arc handles.
A relative path was stored as given, so after the pool evicted the
handle a later working-directory change could reopen a different
same-length file. Resolve std::path::absolute once before the first
open and reuse that path. The regression runs in a subprocess so it
does not change other tests' cwd.
Opening a named pipe with no writer blocks. Check the path is a regular
file first, then open with O_NONBLOCK (as filmcraft-media does), and
check the handle again so a FIFO swapped in after the path check cannot
hang the open or a reopen after eviction.
FileReader reads a file in place and keeps at most MAX_OPEN_FILES
descriptors open in a shared LRU pool, reopening by path when a file
was closed. A project with hundreds of clips can stay under the process
file-descriptor limit. A file truncated since it was opened is refused.
Part of #778 and effectcraft#781.
961 upstream commits since 7bb6c900. Resolutions:
- Test-only conflicts: upstream tests from before the base that our side
cut stay cut; tests new upstream are kept (audio aac/config, layout,
encode_format; cms lutfile; media mux; print windows_native, ticket;
update self_update; xml hostile).
- Code our side moved, with upstream's change carried to the new place:
craft-media mux roll sample groups (mux/boxes.rs) and writer-start
offsets with overflow checks (mux/progressive.rs); craft-print's
shrink-to-fit scale guard (sheets/plan.rs); craft-update's nextest
archive detection (self_update/detect.rs); craft-vectorcraft-format's
Tail::write_to_with (container.rs); craft-i18n's pedantic fixes
(bidi.rs, negotiation.rs).
- craft-ui: the old crate's modules stay removed; gpu_test_lock guarded
their per-test wgpu renderers, which the snapshot kit does not have.
- New upstream tests in crates that build their integration tests into
the library's test executable are modules of tests/main.rs (audio
flac_decode and qoa_oracle, cms, docpath, pcraft-format,
vectorcraft-format).
- The 22 new crates are optional members of the craft facade.
* audio: pure-Rust Vorbis encoder, and an Ogg page writer in craft-media
Replace the libvorbis wrapper (vorbis_rs, C, desktop only) behind
`vorbis-encode` with FilmCraft's clean-room Vorbis I encoder by
@JordyUSA (storytold/filmcraft#4481), and move its Ogg page writer into
craft-media's `ogg` module.
craft-audio:
- `vorbis::encoder::{Encoder, EncoderConfig, Error}`: 1-8 channels in
Vorbis order, any sample rate, quality -1 to 10 (VBR), streaming
packets with granule positions.
- `encode_ogg_vorbis` with `OggVorbisOptions` (quality, vendor, tags,
serial) writes a whole Ogg Vorbis file with a comment header.
- `encode_ogg(buf, kbps)` and `OGG_BITRATES` keep working: the bit rate
picks the quality whose nominal rate it is (`quality_for_bitrate`).
- `encode` with `EncodeFormat::Ogg` takes 1-8 channel WAV-order layouts
and writes them in Vorbis order, and `RateControl::Quality`.
- Ogg is built on wasm32 too.
- Residue partitions hold whole sample frames (48, 40, 48 or 56 values
for 3, 5, 6 and 7 channels): libvorbis decodes each partition from
channel 0, so 32-value partitions came out scrambled for those counts.
- The first audio packet gets a page of its own, so a short file's
first audio page is never also its last (ffmpeg then kept the padding).
craft-media: `ogg::PageWriter`, `opus_tags`, `vorbis_comment`.
Part of storytold/craft-libs#778.
* audio, media: address review on the Vorbis encoder and Ogg writer
- Encoder: read cursor into the pending input, compacted once per call,
so a large encode() call no longer moves the tail on every block.
- Tests: check ffmpeg's libvorbis decoder only when ffmpeg has it.
- PageWriter::finish: the end granule replaces the last page's only when
a packet completes on it (RFC 7845 4.4); documented and tested.
- README: Ogg Opus packet granules are the samples decoded so far.
* audio: pick Ogg by extension on wasm32 too
The Vorbis encoder is pure Rust now, so encode_format_for("ogg") follows
the vorbis-encode feature alone, as EncodeFormat::Ogg.is_built() and
ENCODE_EXTENSIONS already do.
- media: the frame buffer comes from a helper that returns `None` for a
size the address space cannot hold; a test asks it for sizes past
`isize::MAX`, where `vec!` panicked.
- video: the real-file comparison takes the palette of a frame without
a rectangle, as the documented loop does, instead of failing on it.
- media: `read_frame` reserves the frame's bytes fallibly. On a 32-bit
target a frame of over 2 GiB inside a larger source made `vec!` panic
with a capacity overflow; it is now an error.
- video: `Decoder::decode_palette` takes the palette of a frame that
has no rectangle in the picture, so the documented frame loop no
longer drops it. ffmpeg applies the palette of a frame whose
rectangle is empty; the pictures after it now agree.
- media: correct round 1's frame placement. The picture's position is
not one value for a file: it starts at the screen's corner and a
frame with data that is as large as the picture and not at the corner
moves it for the frames that follow, as ffmpeg was seen to do.
`picture_rect` now takes the frame's index; `origin()` is gone.
- audio: unknown frame flags are refused for an empty frame too.
- video: count the unpack buffer in the picture budget.
- docs: which sound frames are bounded by what, which cut-short blocks
are errors, and why sound needs both the flag and a rate.
- tests: ffmpeg's placement cases, the size of the LZ stop, multi-block
16-bit stereo frames, and an LZ test that compared half its picture.
- media: place video frames by the first frame as large as the picture,
not by the header's position fields, as ffmpeg was seen to do; a
frame outside the picture has no rectangle.
- media: a file has sound only with the header flag and a sample rate.
- video: stop LZ unpacking at what a picture can use, so a frame's cost
no longer goes by a length the file states.
- audio: a flags 1 sound frame plays every whole block it holds.
- docs: how sound lines up with pictures, what the buffer count is, and
which cut-short blocks are errors.
- tests: the frame-count cap, the 0xFF tag near the end of LZ data,
palette components over 6 bits, the error conversion and the new
identifiers.
Sierra VMD (Video and Music Data) is the video format of Sierra and
Coktel Vision games of the 1990s. Written clean-room from the public
format description at https://wiki.multimedia.cx/index.php/VMD, with
ffmpeg as a black-box oracle.
- craft-media: `vmd` feature, a demuxer for the 816-byte header and the
table of contents; `Container::Vmd`, `CodecId::VmdVideo` and
`CodecId::VmdAudio`.
- craft-video: `vmd` feature, a decoder for 8-bit paletted pictures
(rendering methods 1 to 3, LZ packing, palette changes).
- craft-audio: `vmd-decode` feature, a decoder for 8-bit PCM and 16-bit
DPCM sound, mono and stereo.
- craft-media-testkit: a VMD fixture writer, since ffmpeg reads VMD but
cannot write it.
Tests compare the decoders with ffmpeg on generated files, and on real
files when CRAFT_MEDIA_VMD_SAMPLES names a directory of them. 16-bit,
24-bit and Indeo 3 pictures, IMA ADPCM sound and the later header
revisions are not decoded.
- craft-media: Mp4Writer counts written bytes with a checked sum, so a
writer that takes bytes past the last position gets an error, not an
overflow (correction to round 3, which checked only the header).
- Docs: the AAC bit-rate floor keeps a margin above where the encoder
codes silence, about half of it.
Refs #1230
- craft-media: Mp4Writer::new refuses a writer positioned where the header
would end past u64::MAX instead of overflowing the sum (correction to
round 2, which let the M4A writer reach that addition).
- AAC is written at 6 kbit/s or a quarter of the sample rate per channel at
least: the encoder accepts lower rates but codes only silence at them, so
with_bitrate(128) gave a silent file.
- README: what to do with a layout a coded format refuses, and the names
encode_format_for takes for M4A.
Refs #1230
- craft-media: Mp4Writer counts chunk offsets from the first byte of the
file, not from position 0 of the writer, so a file begun mid-writer is
valid. This replaces the seek adapter the M4A writer wrapped its sink in.
- Tests pin the bytes of the roll sample group and each format's feature.
- Docs: ALAC's length comes from the sample durations, not an edit list;
which readers take an empty AAC file; speaker names as the errors print
them; craft-media's README lists roll_distance.
- Error messages for a layout a format has not no longer suggest setting
a layout that was set.
Refs #1230
- craft-media: TrackConfig::roll_distance writes a `roll` sample group
(sgpd + sbgp) over every sample. The AAC M4A track sets -1: Apple's
decoders took 2112 frames of priming and dropped the start of the audio
without it (afinfo now reports the frames written and 1024 priming).
- EncodeFormat::is_built and feature: which formats this build writes.
- Clippy: the writer enum's variants differ in size with flac-encode and
a codec feature but no pcm-encode.
- Tests for the finished sample entry (AAC bit rate, ALAC cookie), ALAC
dither and afinfo's reading of the priming.
- README: ffmpeg's reading of 8-channel AAC, and files with no audio.
Refs #1230
202 upstream commits since 6cb00467a. Resolutions:
- craft-window, craft-platform: ours. Upstream's frame policy v2, restore
store and GNOME light/wait_first are the versions carried on 28 Oct;
ours moved place() to craft-behavior and kept LayoutWatch and the
appearance/portal.rs split.
- craft-timeline: ours. craft-time (crates/time) lands as upstream wrote
it and is not yet used by craft-timeline.
- Old crates/ui modules stay removed. Upstream's frosted backdrops, shape
gallery, dialog tabs and the iconic flyout top-edge rendering are not
carried. The #1094 model half is in craft-behavior's dock:
Group::flyout_offset and Action::MoveFlyoutTop.
- craft-update: #586 Save and Update, the install probe on the check
thread and quiet per-user MSI self-updates, carried into updater.rs,
stack_dialogs.rs, install/windows.rs and self_update/helper.rs.
- craft-jpeg: progressive Huffman decoding, carried into huffman.rs,
parse.rs and scan.rs.
- craft-print: the driver settings dialog's new tests and the bounded
XML parse's tests, as trials.
- Test-only conflicts: upstream tests from before the base that our side
cut stay cut; tests new upstream are kept.
Write AVI files: hdrl with avih and one strl (strh, strf, strn, indx) per
stream, odml/dmlh, an interleaved movi and idx1. Past the RIFF limit
(default 1 GiB) the file continues in OpenDML RIFF AVIX extensions with
ix## standard indexes and an indx super index per stream.
- VideoSpec::for_codec builds the stream from CodecParams; MPEG-4 Part 2
is tagged FMP4.
- Audio is timed by bytes (PCM-style) or one packet per chunk.
- Bad options and chunks are errors; finish() closes a readable file
after a failed write.
Tests read the files back through this crate's demuxer by every index,
and through ffmpeg (decode identical to the sources, seeks through the
index, ffprobe fields), in one RIFF and across AVIX extensions. The
MPEG-4 encoder tests play its packets from an AVI file.