1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! ISO Base Media File Format (ISOBMFF) container for still images — the structural layer the AVIF
//! and HEIC codecs share.
//!
//! This crate owns the *container*, not the codec: it models the box tree of a single-image ISOBMFF
//! file (`ftyp` + a `meta` box of image items + `mdat`) and leaves the coded bitstream opaque
//! ([`PropertyKind::CodecConfiguration`] for the `av1C`/`hvcC` record, [`Item::payload`] for the
//! samples). [`write`] serialises an [`IsoBmffImage`]; [`read`] parses one back. The two are inverse
//! for any file this crate writes (`read(&write(&img)) == img`).
//!
//! It is image-first: the supported boxes are the HEIF still-image set (`ftyp`, `meta` with
//! `hdlr`/`pitm`/`iloc` v0/`iinf`+`infe` v2/`iprp`, and the `ispe`/`pixi`/`colr`/`irot`/`imir`
//! properties), plus opaque codec-configuration and unrecognised properties carried verbatim. Image
//! sequences/tracks, `iloc` v1/v2, multi-extent items, and `idat`/`grid`/alpha are out of scope —
//! see this crate's `STATUS.md`. Box byte layouts follow ISO/IEC 14496-12 (ISOBMFF) and ISO/IEC
//! 23008-12 (HEIF); see `references/isobmff`.
//!
//! ```
//! use gamut_isobmff::{IsoBmffImage, Item, Property, PropertyKind, read, write};
//!
//! let img = IsoBmffImage {
//! major_brand: *b"avif",
//! minor_version: 0,
//! compatible_brands: vec![*b"avif", *b"mif1", *b"miaf"],
//! primary_item_id: 1,
//! items: vec![Item {
//! id: 1,
//! item_type: *b"av01",
//! name: String::new(),
//! properties: vec![Property {
//! essential: false,
//! kind: PropertyKind::ImageSpatialExtents { width: 64, height: 64 },
//! }],
//! payload: vec![1, 2, 3, 4], // the coded bitstream (opaque to this crate)
//! }],
//! };
//! let bytes = write(&img);
//! assert_eq!(read(&bytes).unwrap(), img);
//! ```
pub use ;
pub use read;
pub use write;