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 + 47) / 48) * 128,
28 VideoFormat::Uyvy => {
29// round up width to the next multiple of 4
30 // FIXME: {integer}::next_multiple_of was stabilised in rustc 1.73.0
31((width as usize * 2) + 3) & !3
32}
33_ => unreachable!(),
34 }
35}