Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 21 variants BufferTooShort { need: usize, have: usize, what: &'static str, }, LargesizeBufferTooShort { need: usize, have: usize, }, UuidBufferTooShort { need: usize, have: usize, }, BoxSizeUnderflow { size: u64, header_size: usize, }, OutputBufferTooSmall { need: usize, have: usize, }, InvalidValue { field: &'static str, value: u64, reason: &'static str, }, UnexpectedBox { expected: &'static str, }, InvalidInput(&'static str), UnsupportedCodec { codec: &'static str, }, TooManyElementaryStreams { family: &'static str, max: u8, }, UnsupportedCencScheme { scheme: CencScheme, }, UnsupportedMkvCodec { codec: &'static str, }, Ps(Error), EmsgSerialize(Error), UnsupportedSampleEntry { fourcc: String, }, UnmuxableDataTrack { track_id: u32, stream_type: u8, }, UnmuxableSubtitleTrack { track_id: u32, format: SubtitleFormat, }, BufferCapExceeded { what: &'static str, cap: usize, }, FieldOverflow(FieldOverflow), UnsupportedFeature(&'static str), HlsAttrValue(Error),
}
Expand description

Error variants that parsers + builders can return.

Spec references inside #[error(...)] strings quote clauses from ISO/IEC 14496-12:2015 (§4.2) where applicable.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BufferTooShort

Input buffer was shorter than the smallest valid encoding for the type.

Fields

§need: usize

Bytes required to proceed.

§have: usize

Bytes actually available.

§what: &'static str

Human-readable name of the type or field being parsed.

§

LargesizeBufferTooShort

Box size was declared as 1 (triggers largesize) but fewer than 8 bytes available.

Fields

§need: usize

Bytes required for largesize.

§have: usize

Bytes actually available.

§

UuidBufferTooShort

Box type was ‘uuid’ but fewer than the required 16 bytes of usertype available.

Fields

§need: usize

Bytes required for usertype.

§have: usize

Bytes actually available.

§

BoxSizeUnderflow

A box claimed a size smaller than its header, which is impossible.

Fields

§size: u64

Declared size.

§header_size: usize

Minimum header bytes.

§

OutputBufferTooSmall

Write buffer passed to serialize_into was smaller than serialized_len().

Fields

§need: usize

Required size.

§have: usize

Actual size.

§

InvalidValue

A field had an invalid or reserved value.

Fields

§field: &'static str

Name of the field.

§value: u64

The parsed value.

§reason: &'static str

Human-readable explanation.

§

UnexpectedBox

A box did not carry the four-CC the parser expected.

Fields

§expected: &'static str

The four-CC (or description) the parser required.

§

InvalidInput(&'static str)

A caller-supplied argument violated a documented precondition (e.g. an empty track list or a non-positive segment duration passed to the Segmenter).

§

UnsupportedCodec

A CodecConfig has no ISOBMFF/fMP4 carriage in this crate (e.g. the WebM-native VP8 / Vorbis codecs, which are carried in the IR for {WebM} → IR → {WebM} and inspection only).

Fields

§codec: &'static str

The codec name (e.g. "VP8", "Vorbis").

§

TooManyElementaryStreams

One program’s set of elementary streams does not fit the PES stream_id families (ISO/IEC 13818-1 Table 2-22).

The video family is 0xE0..=0xEF and the audio family 0xC0..=0xDF, so at most 16 video and 32 audio elementary streams can be numbered in one program. A 17th video stream would take 0xF0 (ECM_stream) and a 33rd audio stream 0xE0 — inside the video range — so the muxer refuses rather than mislabelling the stream (TsMux output, audit r05-W22).

Fields

§family: &'static str

The stream_id family that overflowed ("video" or "audio").

§max: u8

The family’s size (16 video, 32 audio).

§

UnsupportedCencScheme

A CENC protection scheme (CencScheme) this crate has no cipher implementation for was handed to the encrypt or decrypt path.

CencScheme is #[non_exhaustive] and defined in broadcast-common (issue #878), so a scheme ISO/IEC 23001-7 defines but this crate does not implement (cens, cbc1) can reach a cipher-dispatch site here. Those sites reject rather than fall back to a different cipher: guessing would silently produce garbage plaintext (decrypt) or content protected under a scheme the manifest does not advertise (encrypt).

Fields

§scheme: CencScheme

The scheme that could not be applied.

§

UnsupportedMkvCodec

A CodecConfig has no Matroska CodecID mapping in MkvMux (e.g. Vvc/Flac/Ac4/ MpegH/Mpeg2Video/MpegAudio/Dts/Subtitle/Data — see that module’s docs for the mapped set). Distinct from Error::UnsupportedCodec (that variant’s message names the ISOBMFF/fMP4 carriage this variant is not about).

Fields

§codec: &'static str

The codec name (e.g. "VVC", "FLAC", "Subtitle").

§

Ps(Error)

The MPEG-1/2 Program Stream framing could not be parsed (PsDemux input — ISO/IEC 13818-1 §2.5, via mpeg_ps).

§

EmsgSerialize(Error)

An emsg (Event Message Box, ISO/IEC 23009-1 §5.10.3.3) could not be serialized (e.g. the box would exceed the 4-byte size field range).

§

UnsupportedSampleEntry

A demuxed ISOBMFF sample entry (stsd entry, ISO/IEC 14496-12:2015 §8.5.2) describes a codec this crate has no CodecConfig reconstruction for — e.g. a proprietary or as-yet-unimplemented FourCC (Fmp4Demux, media plane step 2d). Once a genuine gap (not merely undecoded metadata: stpp/wvtt/ac-4 all reconstruct), the track is rejected rather than silently dropped, so the caller learns which sample entry it was.

Fields

§fourcc: String

The rejected sample entry’s four-CC, decoded lossily as text (a FourCC is nominally ASCII but not guaranteed for an unrecognised box).

§

UnmuxableDataTrack

A fMP4/CMAF mux entry point (build_init_segment and every packager built on it — CmafMux, ProgressiveMux, Segmenter, LlSegmenter, LlHlsSegmenter) was given a CodecConfig::Data track (issue #557/#576: an opaque PMT-carried elementary stream with no ISOBMFF sample entry in this crate) — CMAF/fMP4 output cannot carry it. Names the offending track (media plane step 2d; applied uniformly to every mux entry point in media plane step-2 fix wave 1, B2-B4) so the caller can pre-filter it out (e.g. with Media::select_tracks_by) rather than have it silently vanish from the output.

Fields

§track_id: u32

The offending track’s TrackSpec::track_id.

§stream_type: u8

The track’s preserved PMT stream_type (ISO/IEC 13818-1 Table 2-34).

§

UnmuxableSubtitleTrack

A fMP4/CMAF mux entry point (see Error::UnmuxableDataTrack for the full list) was given a CodecConfig::Subtitle track (B1, media plane step-2 fix wave 1): reconstructing the stpp/ wvtt sample entry needs more than the format tag this crate carries (TODO(#753)), so CMAF/fMP4 output cannot carry it yet. Names the offending track so the caller can pre-filter it out (e.g. with Media::select_tracks_by) rather than have the whole package call fail opaquely.

Fields

§track_id: u32

The offending track’s TrackSpec::track_id.

§format: SubtitleFormat

The subtitle wire format the track carries.

§

BufferCapExceeded

A streaming reassembly buffer (e.g. rtp_stream’s per-track access-unit buffer) grew past its configured cap while waiting for a completion signal that never arrived (a dropped final FU-A fragment, a marker bit that never comes, or any other malformed/hostile input) — issue #663 P5.2, audit-ingest #4. The partial data was dropped rather than grown without bound; the buffer’s owner has already reset its internal state, so the caller may simply continue feeding new input (it will resync at the next natural boundary) or treat this as a recoverable per-connection error, at its discretion.

Also returned by ProgressiveDemux’s Stage adapter (issue B7, media plane step 2 fix wave 3) when feed would grow its whole-file buffer past the max_bytes bound supplied at construction — there this buffer has no partial-unit resync point to drop and continue from, so the caller should treat it as fatal for that Stage instance rather than keep feeding.

Fields

§what: &'static str

Human-readable name of the buffer that overflowed.

§cap: usize

The configured cap, in bytes.

§

FieldOverflow(FieldOverflow)

A length or count did not fit the wire field it is written to (#1129): a serializer that narrowed a usize with as u8/as u16/as u32 (or masked it) would have silently wrapped and emitted a misframed box or section; this is returned instead.

§

UnsupportedFeature(&'static str)

The input needs a feature this crate does not implement yet.

Distinct from Error::UnsupportedCodec/Error::UnsupportedCencScheme (which name a specific codec/scheme this crate has no handling for at all): this variant is for a partially supported wire feature where silently ignoring the unimplemented part would produce a plausible but wrong result rather than an obvious failure. E.g. CENC ‘seig’ sample-group key rotation (ISO/IEC 23001-7 §4.1/Annex A: per-sample-group KID override via sgpd/sbgp) — decrypting such content with only the track’s default tenc.default_KID produces garbage for every sample whose group overrides the key, with no structural signal that anything went wrong (issue #990).

§

HlsAttrValue(Error)

An #EXT-X-KEY attribute value (URI/KEYFORMAT/KEYFORMATVERSIONS, ExtXKey::to_tag) could not be represented as an RFC 8216 §4.2 quoted-string (contains ", CR or LF) — issue #1140 / audit r05-W10: a key-server URL assembled from request data previously went straight into the tag unvalidated, an attribute-list-injection vector.

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for CliError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for FlvError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<FieldOverflow> for Error

Source§

fn from(source: FieldOverflow) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.