Skip to main content

lvqr_codec/
error.rs

1//! Shared error type for every codec parser in this crate.
2
3use thiserror::Error;
4
5#[derive(Debug, Error, PartialEq, Eq)]
6pub enum CodecError {
7    #[error("ran out of bits: needed {needed}, have {remaining}")]
8    EndOfStream { needed: usize, remaining: usize },
9
10    #[error("exp-Golomb code exceeds 32 bits")]
11    GolombOverflow,
12
13    #[error("invalid NAL unit type {0}")]
14    InvalidNalType(u8),
15
16    #[error("unsupported SPS feature: {0}")]
17    Unsupported(&'static str),
18
19    #[error("malformed SPS: {0}")]
20    MalformedSps(&'static str),
21
22    #[error("malformed AudioSpecificConfig: {0}")]
23    MalformedAsc(&'static str),
24
25    #[error("malformed SCTE-35 splice_info_section: {0}")]
26    Scte35Malformed(&'static str),
27
28    #[error("SCTE-35 CRC mismatch: computed {computed:#010x}, wire {wire:#010x}")]
29    Scte35BadCrc { computed: u32, wire: u32 },
30}