Conflicts:
crates/audio/Cargo.toml
Conflict in crates/audio/Cargo.toml: main folded every [[test]] binary into the library's test executable (tests/main.rs); dropped the [[test]] list and added s302m_oracle to tests/main.rs behind feature s302m. Ran: cargo test -p craft-audio --lib --features s302m s302m (8 passed), clippy -p craft-audio --all-targets --features s302m -D warnings (clean).
Conflicts:
crates/audio/src/alac/encoder.rs
Conflict in crates/audio/src/alac/encoder.rs: main's test cleanup removed bad_input_is_refused; kept that removal and this PR's new silence/quiet/shift tests. Ran: cargo test -p craft-audio --lib --features alac-decode,alac-encode alac (13 passed).
The WAV reader takes an RF64 file's data size from the first ds64 chunk of
16 bytes or more. repair_wav skipped a first ds64 chunk under 28 bytes and
wrote the sizes into a later one, so the frame count it returned differed
from what decoding gave. It now returns Malformed for a first ds64 chunk of
16 to 27 bytes, before writing anything.
repair_wav wrote the pad byte of odd-length data before the size fields. A
write error after the pad left 8-bit mono data of even length with the old
size, which a second repair refused. The pad byte is now written last.
An extensible fmt chunk with a cbSize below 22, or with more valid bits
than bits per sample, passed repair_wav's checks and was rewritten,
while the WAV reader rejects it as malformed. repair_wav now returns
AudioError::Malformed for both, and its docs list the case.
An RF64 file with a second ds64 chunk before its data had repair_wav
write the 24-byte size table over the start of that later chunk, leaving
the leading ds64 with its stale sizes, and the reader took the data size
from the last ds64 it met. EBU Tech 3306 places ds64 first after WAVE,
and both now use the first one. repair_wav also writes the frame count
into the first fact chunk instead of the last.
repair_wav accepted any bit width for PCM and IEEE float, so a 16-bit
float file or PCM wider than 32 bits had its sizes rewritten and was
reported repaired, though the WAV reader still refuses it. repair_wav
now returns Unsupported unless the file is PCM of 1 to 32 bits or float
of 32 or 64 bits, the widths the reader decodes, and leaves the file
unchanged.
When repair_wav turns a RIFF file past 4 GiB into RF64, it renames the
JUNK chunk after WAVE to ds64 before it writes RF64. A write error
between the two left a RIFF file with a ds64 chunk there, and every
later repair returned TooLarge. repair_wav now takes a 28-byte ds64
chunk right after WAVE in a RIFF file as the slot to promote.
In a RIFF file, a ds64 chunk further on is no longer used. Before, a
later ds64 chunk took the place of the leading JUNK chunk, so the file
became RF64 with JUNK as its first chunk and the later chunk's table
length was set to 0.
repair_wav refused an extensible WAV with the Ambisonic PCM or float
subformat, which the WAV reader reads as PCM. The Ambisonic GUID tail
now lives with the other shared WAVE constants and both sides check it.
When a RIFF file past 4 GiB becomes RF64, the last 4 bytes of the
leading JUNK chunk become the ds64 table length. repair_wav wrote only
the first 24 bytes, so a JUNK chunk holding other bytes left a table
length that names entries the file does not have. It now writes a
table length of 0.
The repair_wav doc comment said every chunk before the data keeps its
contents, but repair rewrites the frame count in a fact chunk, the start
of an existing ds64 chunk, and turns the leading 28-byte JUNK chunk into
ds64 when a RIFF file passes 4 GiB. It now lists the fields it writes
and the bytes it leaves alone. The Errors section now names every case:
Malformed also for the data chunk before fmt, a short fmt chunk, 0
channels or bits, a block size that does not match, no data chunk in the
first 100,000 chunks, and RF64 without ds64; Unsupported for an
extensible format whose subformat is not PCM or float; and Io.
A recorder that writes the WAV header first and rewrites it as the file
grows leaves stale RIFF, data, ds64 and fact sizes when the process dies.
repair_wav walks the chunks up to the data chunk, counts the whole frames
the file holds and rewrites those fields in place, keeping bext and every
other chunk. It writes the pad byte an odd data length needs, turns a file
past 4 GiB into RF64 when it starts with the JUNK chunk FileEncoder and
wav_float_header reserve, and returns the frame count and the length to
truncate the file to. A finished file is left as it is. Compressed formats,
headers whose block size does not match the channels and bit depth, and
unfinished 8-bit mono data of even length (where a pad byte cannot be told
from a sample) are refused.
wav_float_header always wrote its header without BWF metadata, so a recorder
that wanted a bext chunk had to splice one into the returned bytes at a fixed
offset. wav_float_header_with_bwf takes a BwfInfo and writes the same header
with the bext chunk in place. Its length still does not depend on the frame
count, so the header is rewritten in place as the file grows, and the finished
file matches encode() with the same BWF metadata byte for byte.
The Vorbis decoder returns channels in Vorbis I order (L C R ... LFE), and
the rest of craft-audio works in WAV order. vorbis::wav_order(channels)
gives the reorder for 3, 5, 6, 7 and 8 channels, and vorbis::layout(channels)
gives the speakers of the result. For 7 channels the layout is 6.1 with a
back center and side surrounds, which ChannelLayout::default_for(7) does
not give.
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.
A `data` chunk of size 0 counted as empty only when the RIFF size matched
the file. A writer that appends a `LIST` chunk after writing the RIFF size
leaves it stale, so the reader took the file for an unfinished recording
and decoded the `LIST` chunk's bytes as samples (8 frames of noise instead
of none).
A size-0 `data` chunk is now also empty when whole chunks follow it and the
first one has an id that follows audio (LIST, bext, cue, JUNK, ...). A
recording that was never finalised (PCM after the header) and bytes that
only start like a chunk still decode as audio.
- 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.