av_decoders/error.rs
1use thiserror::Error;
2
3/// Errors that can occur during video decoding operations.
4#[derive(Debug, Clone, Error)]
5pub enum DecoderError {
6 /// End of video stream reached (not necessarily an error).
7 #[error("end of video file reached")]
8 EndOfFile,
9
10 /// Failed to open or read the input file.
11 #[error("failed to open input file ({cause})")]
12 FileReadError {
13 /// The underlying cause of the error.
14 cause: String,
15 },
16
17 /// VapourSynth script execution error (requires `vapoursynth` feature).
18 #[cfg(feature = "vapoursynth")]
19 #[error("Vapoursynth script error ({cause})")]
20 VapoursynthScriptError {
21 /// The underlying cause of the error.
22 cause: String,
23 },
24
25 /// VapourSynth internal/core error (requires `vapoursynth` feature).
26 #[cfg(feature = "vapoursynth")]
27 #[error("Vapoursynth internal error ({cause})")]
28 VapoursynthInternalError {
29 /// The underlying cause of the error.
30 cause: String,
31 },
32
33 /// Failed to set VapourSynth script arguments (requires `vapoursynth` feature).
34 #[cfg(feature = "vapoursynth")]
35 #[error("error setting Vapoursynth script args ({cause})")]
36 VapoursynthArgsError {
37 /// The underlying cause of the error.
38 cause: String,
39 },
40
41 /// FFmpeg internal error (requires `ffmpeg` feature).
42 #[cfg(feature = "ffmpeg")]
43 #[error("FFMpeg internal error ({cause})")]
44 FfmpegInternalError {
45 /// The underlying cause of the error.
46 cause: String,
47 },
48
49 /// FFMS2 internal error (requires `ffms2` feature).
50 #[cfg(feature = "ffms2")]
51 #[error("FFMS2 internal error ({cause})")]
52 Ffms2InternalError {
53 /// The underlying cause of the error.
54 cause: String,
55 },
56
57 /// Catch-all for decoding problems not covered by other variants.
58 #[error("internal decoder error ({cause})")]
59 GenericDecodeError {
60 /// The underlying cause of the error.
61 cause: String,
62 },
63
64 /// No decodeable video stream found in the input file.
65 #[error("no decodeable video stream found in file")]
66 NoVideoStream,
67
68 /// No suitable decoder available; consider enabling `ffmpeg` or `vapoursynth`.
69 #[error(
70 "no decoder found which can decode this file--perhaps you need to enable the ffmpeg or vapoursynth feature"
71 )]
72 NoDecoder,
73
74 /// The active decoder backend does not support the called function.
75 #[error("this function is not supported by the decoder in use")]
76 UnsupportedDecoder,
77
78 /// Variable-format streams are not supported.
79 #[error("variable format clips are not currently supported")]
80 VariableFormat,
81
82 /// Variable-resolution streams are not supported.
83 #[error("variable resolution clips are not currently supported")]
84 VariableResolution,
85
86 /// Variable-framerate streams are not supported.
87 #[error("variable framerate clips are not currently supported")]
88 VariableFramerate,
89
90 /// Unsupported chroma subsampling (`x`, `y` are horizontal/vertical factors).
91 #[error("unsupported chroma subsampling ({x}, {y})")]
92 UnsupportedChromaSubsampling {
93 /// Horizontal chroma subsampling factor.
94 x: usize,
95 /// Vertical chroma subsampling factor.
96 y: usize,
97 },
98
99 /// Unsupported pixel format or codec.
100 #[error("unsupported video format {fmt}")]
101 UnsupportedFormat {
102 /// The format identifier that triggered the error.
103 fmt: String,
104 },
105}