#[derive(Debug, Clone)]
pub struct H265Options {
pub profile: H265Profile,
pub tier: H265Tier,
pub level: Option<u32>,
pub preset: Option<String>,
pub x265_params: Option<String>,
}
impl Default for H265Options {
fn default() -> Self {
Self {
profile: H265Profile::Main,
tier: H265Tier::Main,
level: None,
preset: None,
x265_params: None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum H265Profile {
#[default]
Main,
Main10,
}
impl H265Profile {
pub(in crate::video) fn as_str(self) -> &'static str {
match self {
Self::Main => "main",
Self::Main10 => "main10",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum H265Tier {
#[default]
Main,
High,
}
impl H265Tier {
pub(in crate::video) fn as_str(self) -> &'static str {
match self {
Self::Main => "main",
Self::High => "high",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn h265_profile_should_return_correct_str() {
assert_eq!(H265Profile::Main.as_str(), "main");
assert_eq!(H265Profile::Main10.as_str(), "main10");
}
#[test]
fn h265_tier_should_return_correct_str() {
assert_eq!(H265Tier::Main.as_str(), "main");
assert_eq!(H265Tier::High.as_str(), "high");
}
#[test]
fn h265_options_default_should_have_main_profile() {
let opts = H265Options::default();
assert_eq!(opts.profile, H265Profile::Main);
assert_eq!(opts.tier, H265Tier::Main);
assert_eq!(opts.level, None);
assert!(opts.preset.is_none());
assert!(opts.x265_params.is_none());
}
}