* 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.
Retain TextureCraft signed wrapping and delta widths from bdbb52c9b66b221a55b370105b42f485a76e6fc7; use explicit widths, output byte budget, checked code-table admission and fallible reservation.
Extract framing from PhotoCraft 16941f7198da9ae1811a8928f4c256b5cb37c1cb, retaining the overflow protection added by 3b45e8baee7117e53847523b5bc3ae2b337966d4. Allocation-free adaptation leaves text policy with callers.
Co-authored-by: Valentin Klein <vangel1976@googlemail.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
Source: storytold/texturecraft bdbb52c9b66b221a55b370105b42f485a76e6fc7. Preserve chunk framing and output cap policy, with fallible allocation and checked offsets.
Port raw framing from PhotoCraft f7f8fdcd89 and 9a390661b5; preserve tolerant import semantics and keep colour policy with consumers.
Co-authored-by: Khawar Zamman Wani <wanikhawar@gmail.com>
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
Extract the TextureCraft writer originally introduced in 59f0ab48508e2dc5a812acd1aee00d5d59a528d8, retaining caller colour and timestamp policy. Preserve the is_multiple_of cleanup from 59a3018.
Co-authored-by: bflatastic <bflat@storyteller.ai>
* craft-dxf: add VectorCraft's ASCII drawing writer
Move the incremental file writer from vectorcraft-cad (crates/cad/src/writer.rs)
into craft_dxf::drawing. It writes the HEADER/TABLES/BLOCKS/OBJECTS skeleton
around a pre-built ENTITIES section, which is the format API VectorCraft's
scene mapper already uses. The existing model::write tag serializer is
unchanged.
Golden files lock the bytes for empty and one-LINE drawings in R12, 2000 and
2018. Part of #791 / #778.
* test(dxf): preserve exact golden bytes on Windows checkout
* fix(dxf): preserve BYBLOCK and use valid image dictionary keys
* test(dxf): clone images before write in dictionary-key test
Drawing::write takes self, so the assertions have to use a clone of
the image list. The rest of the test is unchanged.
---------
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
Extract the remaining metadata delegation from #1198 after #1331 landed the raster facade changes. Preserve current image-codecs API, pixel transforms, docs and regression tests; omit unrelated resolution reexports and TIFF cleanup.
Original-change: 1d52e89405