Repository navigation
svga v0.1.0
First release of svga, a pure-Rust codec for the SVGA animation format: decode, inspect, edit without loss, encode. It renders nothing and makes no optimization decisions.
[dependencies]
svga = "0.1"What is in it
Document, the lossless layer. Every top-level protobuf field is kept as its original bytes, so unknown fields, field order and float bit patterns survive, and an unedited document re-encodes to exactly the payload it was read from.replace_image,insert_imageandremove_imagereturn a new document and leave every other byte alone.Movie, a typed read-only view decoded on demand: params, sprites, frames, layouts, transforms, shapes, audio. It reports referenced, unused and missing image keys, and the largest drawn size of each image across visible frames.Animation, one entry point for every flavour: SVGA 2.x (zlib + protobuf), zipped 2.x (movie.binary) and SVGA 1.x (movie.specJSON).to_document()turns the zip flavours into a standalone 2.x document.- Built for untrusted input. Configurable
Limits(input size, inflated size, top-level fields, zip entries, 1.x spec size, decoded elements), trailing bytes after the zlib stream are an error, checked arithmetic throughout, and errors carry anErrorKindplus a stablesvga_*code. - Pure Rust by default, so it builds for
wasm32and on docs.rs. The optionallibdeflatefeature makesCompression::Bestuse libdeflate for the smallest output; the defaultzipfeature can be turned off.
Verification
Checked against 233 real-world files (not part of the repository): all 231 zlib files re-encode to a byte-identical inflated payload, and every file's version, view box, fps, frame, image, sprite and audio counts match libsvga's svga_probe. The opt-in corpus test in tests/corpus.rs repeats this on any directory of files.
MSRV 1.89. MIT licensed.