pub struct BorrowedVideoFrameBuilder<'buf> { /* private fields */ }Expand description
Builder for a BorrowedVideoFrame, reached through
BorrowedVideoFrame::builder. No pixels or metadata are copied.
Implementations§
Source§impl<'buf> BorrowedVideoFrameBuilder<'buf>
impl<'buf> BorrowedVideoFrameBuilder<'buf>
Sourcepub fn line_stride_bytes(self, stride: usize) -> Self
pub fn line_stride_bytes(self, stride: usize) -> Self
Set the first-plane stride in bytes, following the
video stride rules.
Use Self::clear_line_stride_bytes for the packed stride.
Sourcepub fn clear_line_stride_bytes(self) -> Self
pub fn clear_line_stride_bytes(self) -> Self
Reset the first-plane stride override to the packed stride.
Sourcepub fn frame_rate(self, frame_rate: FrameRate) -> Self
pub fn frame_rate(self, frame_rate: FrameRate) -> Self
Set the frame rate.
Sourcepub fn picture_aspect_ratio(self, ratio: PictureAspectRatio) -> Self
pub fn picture_aspect_ratio(self, ratio: PictureAspectRatio) -> Self
Set a finite nonnegative aspect ratio; zero selects square pixels.
Sourcepub fn scan_type(self, scan_type: ScanType) -> Self
pub fn scan_type(self, scan_type: ScanType) -> Self
Select progressive, interlaced, or field scanning.
Sourcepub fn metadata(self, metadata: &'buf CStr) -> Self
pub fn metadata(self, metadata: &'buf CStr) -> Self
Borrow NUL-terminated UTF-8 metadata, validated when built.
Sourcepub fn clear_metadata(self) -> Self
pub fn clear_metadata(self) -> Self
Remove the optional metadata override.
Sourcepub fn allow_send_from_padding_and_tail(self, allow: bool) -> Self
pub fn allow_send_from_padding_and_tail(self, allow: bool) -> Self
Allow direct sending from caller padding and trailing memory.
Defaults to false. Where UYVY/UYVA sending needs tail room, the
default path packs active rows and zeroes the tail. Setting this to
true permits sending directly if the supplied buffer is large enough
to include the required room after the frame. The SDK may encode row
padding and trailing bytes into the picture: only opt in when their
contents are suitable for transmission. All such bytes must be
initialized and stable throughout the send. Insufficient room still
causes a packed copy. Formats with zero tail room send directly either way.
Sourcepub fn build(self) -> Result<BorrowedVideoFrame<'buf>>
pub fn build(self) -> Result<BorrowedVideoFrame<'buf>>
Validate dimensions, stride, initialized slice extent, headers, and metadata.
Successful construction allocates nothing and never loads or queries an NDI runtime: whether the runtime can send the pixel format is checked when the frame is sent. The input slices remain borrowed.
§Errors
Invalid layout/header values, a buffer smaller than the layout, or
metadata exceeding the 4 MiB cap return Error::InvalidFrame;
invalid metadata UTF-8 returns Error::InvalidUtf8.