av_metrics/
lib.rs

1//! `av_metrics` is a collection of quality metrics for audio and video files.
2//! Currently only includes video metrics. Audio metrics will likely be added
3//! in the future.
4
5#![allow(clippy::cast_lossless)]
6#![allow(clippy::needless_range_loop)]
7#![allow(clippy::unreadable_literal)]
8#![allow(clippy::wrong_self_convention)]
9#![deny(missing_docs)]
10
11#[macro_use]
12extern crate itertools;
13#[macro_use]
14extern crate thiserror;
15
16pub mod video;
17
18/// Possible errors that may occur during processing of a metric.
19///
20/// This enum may be added to in the future and should not be assumed to be exhaustive.
21#[derive(Debug, Error)]
22pub enum MetricsError {
23    /// Indicates an input file could not be read for some reason.
24    #[error("Could not read input file: {reason}")]
25    MalformedInput {
26        #[doc(hidden)]
27        reason: &'static str,
28    },
29    /// Indicates an input file could be read, but is not supported by the current metric.
30    #[error("Input type not supported: {reason}")]
31    UnsupportedInput {
32        #[doc(hidden)]
33        reason: &'static str,
34    },
35    /// Indicates two inputs did not have matching formats or resolutions.
36    #[error("Input videos must have matching formats: {reason}")]
37    InputMismatch {
38        #[doc(hidden)]
39        reason: &'static str,
40    },
41    /// Indicates the impossibility to process the two videos.
42    #[error("Could not process the two videos: {reason}")]
43    VideoError {
44        #[doc(hidden)]
45        reason: String,
46    },
47    /// Indicates the impossibility to send two frames in order to be processed.
48    #[error("Could not send two frames to be processed: {reason}")]
49    SendError {
50        #[doc(hidden)]
51        reason: String,
52    },
53    /// Indicates the impossibility to process two frames.
54    #[error("Could not process two frames: {reason}")]
55    ProcessError {
56        #[doc(hidden)]
57        reason: String,
58    },
59    /// Placeholder
60    #[doc(hidden)]
61    #[error("Unreachable")]
62    NonExhaustive,
63}