#[derive(Debug, Clone)]
pub struct Av1Options {
pub cpu_used: u8,
pub tile_rows: u8,
pub tile_cols: u8,
pub usage: Av1Usage,
}
impl Default for Av1Options {
fn default() -> Self {
Self {
cpu_used: 4,
tile_rows: 0,
tile_cols: 0,
usage: Av1Usage::VoD,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Av1Usage {
#[default]
VoD,
RealTime,
}
impl Av1Usage {
pub(in crate::video) fn as_str(self) -> &'static str {
match self {
Self::VoD => "vod",
Self::RealTime => "realtime",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn av1_usage_should_return_correct_str() {
assert_eq!(Av1Usage::VoD.as_str(), "vod");
assert_eq!(Av1Usage::RealTime.as_str(), "realtime");
}
#[test]
fn av1_options_default_should_have_vod_usage() {
let opts = Av1Options::default();
assert_eq!(opts.cpu_used, 4);
assert_eq!(opts.tile_rows, 0);
assert_eq!(opts.tile_cols, 0);
assert_eq!(opts.usage, Av1Usage::VoD);
}
}