use crate::VideoFormat;
pub(super) const VBI_HD_MIN_PIXEL_WIDTH: u32 = 1280;
#[derive(thiserror::Error, Clone, Copy, Debug, Eq, PartialEq)]
pub enum VideoVBIError {
#[error("Format and/or pixel_width is not supported")]
Unsupported,
#[error("Not enough space left in the current line")]
NotEnoughSpace,
#[error("Not enough data left in the current line")]
NotEnoughData,
#[error("Insufficient line buffer length {found}. Expected: {expected}")]
InsufficientLineBufLen { found: usize, expected: usize },
}
pub(super) fn line_buffer_len(format: VideoFormat, width: u32) -> usize {
skip_assert_initialized!();
match format {
VideoFormat::V210 => (width as usize).div_ceil(48) * 128,
VideoFormat::Uyvy => {
(width as usize * 2).next_multiple_of(4)
}
_ => unreachable!(),
}
}