Skip to main content

yscv_video_mpp/
error.rs

1use thiserror::Error;
2
3/// Errors from MPP encoder operations.
4#[derive(Debug, Error)]
5pub enum MppError {
6    /// `librockchip_mpp.so` not found on this host.
7    #[error("librockchip_mpp.so not found — install Rockchip MPP runtime")]
8    LibraryNotFound,
9
10    /// Required MPP function symbol missing from loaded library.
11    #[error("MPP symbol `{0}` not found — incompatible MPP version")]
12    SymbolMissing(&'static str),
13
14    /// MPP returned non-zero status code from a call.
15    #[error("MPP `{op}` failed with status {status}")]
16    CallFailed { op: &'static str, status: i32 },
17
18    /// User passed an invalid encoder configuration.
19    #[error("MPP encoder config invalid: {0}")]
20    InvalidConfig(String),
21
22    /// MPP context not initialised yet.
23    #[error("MPP encoder not initialised")]
24    NotInitialised,
25
26    /// MPP encoder reported buffer-not-ready for non-blocking call.
27    #[error("MPP buffer would block — caller should retry")]
28    WouldBlock,
29}
30
31pub type MppResult<T> = Result<T, MppError>;