mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 19:14:26 +00:00
Port the container reader of storytold/lightcraft#1208 into `items`: - `read` follows `pitm`, `cdsc` and the `dimg` inputs to return the primary image's EXIF and XMP, then items tied to no image. A thumbnail's or depth map's metadata is no longer the photo's. - `scan` returns every EXIF and XMP item, with each item's bytes or why they can't be read, and `Scan::complete` is false when the item catalog can't be read in full. An app that must prove a file has no location refuses when unsure. - `exif_tiff` finds the TIFF stream with or without a correct offset field or an `Exif\0\0` prefix. - `iloc` is walked once; the module denies indexing and unchecked arithmetic; boxes, items and gathered bytes are bounded. The tests of #1055 and lightcraft#1208 come along, adapted to assert the returned bytes and the scan's completeness.
37 lines
1.6 KiB
TOML
37 lines
1.6 KiB
TOML
[package]
|
|
name = "craft-heif"
|
|
description = "Optional HEIF/HEIC still-image decoder: heic-rs for the container and HEVC, libheif-matching colour conversion, panic-guarded."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[dependencies]
|
|
# Pure Rust, no unsafe. Pinned exactly: a young, single-owner crate that parses untrusted files;
|
|
# moving the pin is a reviewed change (re-run these tests and each app's HEIF corpus tests).
|
|
# heic-rs was chosen over the other permissive candidates (heif-oxide's HEVC decoder, rust_h265, follows FFmpeg's (LGPL)
|
|
# code structure; gamut-heic has no HEVC decoder of its own).
|
|
heic-rs = { version = "=0.1.4", default-features = false, features = ["std"], optional = true }
|
|
|
|
# The tiles of a HEIC photo decode in parallel on native; wasm stays single-threaded.
|
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
|
heic-rs = { version = "=0.1.4", default-features = false, features = ["std", "parallel"], optional = true }
|
|
rayon = { workspace = true, optional = true }
|
|
|
|
[dev-dependencies]
|
|
proptest = { workspace = true }
|
|
|
|
[features]
|
|
default = ["decode"]
|
|
# The decoder (probe, decode, decode_thumbnail, read_metadata): heic-rs for the container and HEVC.
|
|
decode = ["dep:heic-rs", "dep:rayon"]
|
|
# `items`: the Exif and XMP items from the box structure alone, without heic-rs. Without `decode`,
|
|
# `read_metadata` is this reader.
|
|
metadata = []
|
|
# `craft_heif::testdata`: lossless synthetic HEIF files, for the tests of the crates above.
|
|
testdata = []
|
|
|
|
[lints]
|
|
workspace = true
|