#![allow(dead_code)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
pub enum FrameType {
#[default]
Key,
Inter,
}
impl FrameType {
#[must_use]
pub const fn is_keyframe(&self) -> bool {
matches!(self, Self::Key)
}
}
#[derive(Clone, Debug, Default)]
pub struct Vp9Frame {
pub frame_type: FrameType,
pub width: u32,
pub height: u32,
}
impl Vp9Frame {
#[must_use]
pub const fn new(frame_type: FrameType, width: u32, height: u32) -> Self {
Self {
frame_type,
width,
height,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_frame_type() {
assert!(FrameType::Key.is_keyframe());
assert!(!FrameType::Inter.is_keyframe());
}
#[test]
fn test_vp9_frame() {
let frame = Vp9Frame::new(FrameType::Key, 1920, 1080);
assert!(frame.frame_type.is_keyframe());
assert_eq!(frame.width, 1920);
assert_eq!(frame.height, 1080);
}
}