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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Error types for zenavif
use enough::StopReason;
/// Error type for zenavif decoding operations
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// AVIF container parsing error
#[error("AVIF parse error: {0}")]
Parse(#[from] zenavif_parse::Error),
/// AV1 decode error from rav1d
#[error("AV1 decode error {code}: {msg}")]
Decode {
/// rav1d error code
code: i32,
/// Error description
msg: &'static str,
},
/// YUV to RGB color conversion error
#[error("Color conversion error: {0}")]
ColorConversion(#[from] yuv::YuvError),
/// AV1 encode error
#[error("AV1 encode error: {0}")]
Encode(String),
/// Unsupported feature
#[error("Unsupported: {0}")]
Unsupported(&'static str),
/// Image dimensions exceed configured limit
#[error("Image too large: {width}x{height}")]
ImageTooLarge {
/// Image width
width: u32,
/// Image height
height: u32,
},
/// A resource limit was exceeded (memory, input size, output size, etc.)
#[error("Resource limit exceeded: {0}")]
ResourceLimit(String),
/// Memory allocation failed
#[error("Out of memory")]
OutOfMemory,
/// Operation was cancelled via Stop trait
#[error("Operation cancelled: {0:?}")]
Cancelled(StopReason),
/// Unsupported codec operation
#[cfg(feature = "zencodec")]
#[error(transparent)]
UnsupportedOperation(#[from] zencodec::UnsupportedOperation),
}
impl From<StopReason> for Error {
fn from(reason: StopReason) -> Self {
Error::Cancelled(reason)
}
}
/// Result type for zenavif operations with location tracking
pub type Result<T, E = whereat::At<Error>> = core::result::Result<T, E>;