#[non_exhaustive]pub enum DecodeError {
Io(Error),
UnsupportedCodec(AudioCodec),
UnsupportedContainer(ContainerFormat),
InvalidData(String),
SeekFailed(String),
SeekOutOfRange(String),
ProbeFailed,
BackendUnavailable {
backend: &'static str,
},
Interrupted,
Backend(Box<dyn Error + Sync + Send>),
}Expand description
Errors that can occur during audio decoding.
This error type is backend-agnostic, wrapping decoder-specific errors
in the Backend variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
UnsupportedCodec(AudioCodec)
UnsupportedContainer(ContainerFormat)
InvalidData(String)
SeekFailed(String)
SeekOutOfRange(String)
The seek target is invalid for this stream — past EOF, beyond the indexed sample range, or otherwise out of the addressable space.
Distinct from SeekFailed because there is no
recovery action that helps: the duration/length come from the
stream itself, not from decoder state, so a freshly built decoder
rejects the same target with the same answer. Pipeline must
surface this to the caller (fail the seek) rather than retry.
ProbeFailed
The caller selected a backend that is not compiled in for the
current target/feature combination (e.g. DecoderBackend::Apple
on Linux, or DecoderBackend::Symphonia without the symphonia
feature). Distinct from UnsupportedCodec
(codec/container the backend cannot handle): BackendUnavailable
means the backend itself is absent from the binary.
Interrupted
A seek interrupted the decode operation. Not a real error — the caller should check for pending seeks and retry.
Backend(Box<dyn Error + Sync + Send>)
Implementations§
Source§impl DecodeError
impl DecodeError
Sourcepub fn backend<E>(err: E) -> DecodeError
pub fn backend<E>(err: E) -> DecodeError
Wrap any StdError + Send + Sync payload as a DecodeError::Backend.
Avoids 30+ repeats of .map_err(|e| DecodeError::Backend(Box::new(e)))
across the apple / android / symphonia codec layers.
Sourcepub fn backend_msg<S>(msg: S) -> DecodeError
pub fn backend_msg<S>(msg: S) -> DecodeError
Convenience constructor for “we have a description string, not
a typed source error” — typically format!(...) payloads for
FFI status codes (Apple OSStatus, Android media_status_t).
Sourcepub fn classify(&self) -> ErrorClass
pub fn classify(&self) -> ErrorClass
Tag the error in one source-chain pass so hot decode loops can
replace per-class boolean predicate ladders with a single
match over the discriminant.
Sourcepub fn is_interrupted(&self) -> bool
pub fn is_interrupted(&self) -> bool
Returns true if the error is an Interrupted variant.
Trait Implementations§
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()