Skip to main content

av_drift_detector/
error.rs

1use std::path::PathBuf;
2
3/// Errors returned by av-drift-detector.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    #[error("invalid frame rate `{0}`")]
7    InvalidFrameRate(String),
8
9    #[error("invalid time `{0}` (use seconds, `250ms`, or HH:MM:SS.mmm)")]
10    InvalidTime(String),
11
12    #[error("invalid option: {0}")]
13    InvalidOption(String),
14
15    #[error("{path}: no {kind} stream found")]
16    MissingStream { path: PathBuf, kind: &'static str },
17
18    #[error("unsupported: {0}")]
19    Unsupported(String),
20
21    #[error(
22        "could not determine the test pattern's frame rate from the video; pass it explicitly (--fps)"
23    )]
24    UnknownFrameRate,
25
26    #[error("QR code: {0}")]
27    Qr(String),
28
29    /// Running the `ffmpeg` or `ffprobe` program failed (the `ffmpeg-cli` feature).
30    #[cfg(feature = "ffmpeg-cli")]
31    #[error("{0}")]
32    FfmpegCommand(String),
33
34    #[cfg(feature = "ffmpeg")]
35    #[error("ffmpeg: {0}")]
36    Ffmpeg(#[from] ffmpeg_next::Error),
37
38    #[error(transparent)]
39    Io(#[from] std::io::Error),
40}
41
42pub type Result<T, E = Error> = std::result::Result<T, E>;