1use crate::VideoFormat;
2pub(super) const VBI_HD_MIN_PIXEL_WIDTH: u32 = 1280;
34// rustdoc-stripper-ignore-next
5/// Video Vertical Blanking Interval related Errors.
6#[derive(thiserror::Error, Clone, Copy, Debug, Eq, PartialEq)]
7pub enum VideoVBIError {
8#[error("Format and/or pixel_width is not supported")]
9Unsupported,
1011#[error("Not enough space left in the current line")]
12NotEnoughSpace,
1314#[error("Not enough data left in the current line")]
15NotEnoughData,
1617#[error("Insufficient line buffer length {found}. Expected: {expected}")]
18InsufficientLineBufLen { found: usize, expected: usize },
19}
2021// rustdoc-stripper-ignore-next
22/// Returns the buffer length needed to store the line.
23pub(super) fn line_buffer_len(format: VideoFormat, width: u32) -> usize {
24skip_assert_initialized!();
25// Taken from gst-plugins-base/gst-libs/gst/video/video-info.c:fill_planes
26match format {
27 VideoFormat::V210 => (width as usize).div_ceil(48) * 128,
28 VideoFormat::Uyvy => {
29// round up width to the next multiple of 4
30(width as usize * 2).next_multiple_of(4)
31 }
32_ => unreachable!(),
33 }
34}