ff_encode/video/codec_options/
av1.rs1#[derive(Debug, Clone)]
5pub struct Av1Options {
6 pub cpu_used: u8,
8 pub tile_rows: u8,
10 pub tile_cols: u8,
12 pub usage: Av1Usage,
14}
15
16impl Default for Av1Options {
17 fn default() -> Self {
18 Self {
19 cpu_used: 4,
20 tile_rows: 0,
21 tile_cols: 0,
22 usage: Av1Usage::VoD,
23 }
24 }
25}
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
29pub enum Av1Usage {
30 #[default]
32 VoD,
33 RealTime,
35}
36
37impl Av1Usage {
38 pub(in crate::video) fn as_str(self) -> &'static str {
39 match self {
40 Self::VoD => "vod",
41 Self::RealTime => "realtime",
42 }
43 }
44}
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn av1_usage_should_return_correct_str() {
52 assert_eq!(Av1Usage::VoD.as_str(), "vod");
53 assert_eq!(Av1Usage::RealTime.as_str(), "realtime");
54 }
55
56 #[test]
57 fn av1_options_default_should_have_vod_usage() {
58 let opts = Av1Options::default();
59 assert_eq!(opts.cpu_used, 4);
60 assert_eq!(opts.tile_rows, 0);
61 assert_eq!(opts.tile_cols, 0);
62 assert_eq!(opts.usage, Av1Usage::VoD);
63 }
64}