#[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
BufferTooShort
Input buffer was shorter than the smallest valid encoding for the type.
Fields
LargesizeBufferTooShort
Box size was declared as 1 (triggers largesize) but fewer than 8 bytes available.
UuidBufferTooShort
Box type was ‘uuid’ but fewer than the required 16 bytes of usertype available.
BoxSizeUnderflow
A box claimed a size smaller than its header, which is impossible.
OutputBufferTooSmall
Write buffer passed to serialize_into was smaller than serialized_len().
InvalidValue
A field had an invalid or reserved value.
Fields
UnexpectedBox
A box did not carry the four-CC the parser expected.
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).
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
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: CencSchemeThe 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).
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
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: u32The offending track’s TrackSpec::track_id.
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: u32The offending track’s TrackSpec::track_id.
format: SubtitleFormatThe 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
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 Error for Error
impl Error for Error
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()