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
//! Small helpers shared by the encoder and decoder for talking to libheif's C API.
use CStr;
use ptr;
use Once;
use cratesys;
/// Initialize libheif exactly once before first use. libheif's objects are reference counted internally; calling
/// `heif_init` ensures plugin registration and that library memory is set up. We never call `heif_deinit` — the process
/// owns these globals for its whole lifetime, mirroring how the codec libraries expect to be used.
pub
/// Convert a [`heif_error`](sys::heif_error) returned by value into a `Result`. Returns `Ok(())` for `heif_error_Ok`;
/// otherwise extracts the human-readable `message`.
pub