#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum Sampling {
All,
EveryNth(u64),
EverySec(f64),
KeyframesOnly,
UniformN(u32),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PixelLayout {
Rgb24,
Rgba32,
Gray8,
}
impl PixelLayout {
pub fn bytes_per_pixel(self) -> usize {
match self {
PixelLayout::Rgb24 => 3,
PixelLayout::Rgba32 => 4,
PixelLayout::Gray8 => 1,
}
}
pub(crate) fn ffmpeg_format_name(self) -> &'static str {
match self {
PixelLayout::Rgb24 => "rgb24",
PixelLayout::Rgba32 => "rgba",
PixelLayout::Gray8 => "gray",
}
}
pub(crate) fn av_pixel_format(self) -> ffmpeg_sys_next::AVPixelFormat {
use ffmpeg_sys_next::AVPixelFormat::{AV_PIX_FMT_GRAY8, AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA};
match self {
PixelLayout::Rgb24 => AV_PIX_FMT_RGB24,
PixelLayout::Rgba32 => AV_PIX_FMT_RGBA,
PixelLayout::Gray8 => AV_PIX_FMT_GRAY8,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum YuvMatrix {
Bt601,
Bt709,
}
impl YuvMatrix {
pub(crate) fn in_color_matrix(self) -> &'static str {
match self {
YuvMatrix::Bt601 => "bt601",
YuvMatrix::Bt709 => "bt709",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum YuvRange {
Limited,
Full,
}
impl YuvRange {
pub(crate) fn in_range(self) -> &'static str {
match self {
YuvRange::Limited => "tv",
YuvRange::Full => "pc",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[non_exhaustive]
pub enum ColorPolicy {
#[default]
Tagged,
TaggedOrResolutionGuess,
Force {
matrix: YuvMatrix,
range: YuvRange,
},
}