Skip to main content

BorrowedVideoFrameBuilder

Struct BorrowedVideoFrameBuilder 

Source
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>

Source

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.

Source

pub fn clear_line_stride_bytes(self) -> Self

Reset the first-plane stride override to the packed stride.

Source

pub fn frame_rate(self, frame_rate: FrameRate) -> Self

Set the frame rate.

Source

pub fn picture_aspect_ratio(self, ratio: PictureAspectRatio) -> Self

Set a finite nonnegative aspect ratio; zero selects square pixels.

Source

pub fn scan_type(self, scan_type: ScanType) -> Self

Select progressive, interlaced, or field scanning.

Source

pub fn timecode(self, timecode: Timecode) -> Self

Set the timecode.

Source

pub fn metadata(self, metadata: &'buf CStr) -> Self

Borrow NUL-terminated UTF-8 metadata, validated when built.

Source

pub fn clear_metadata(self) -> Self

Remove the optional metadata override.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<'buf> Clone for BorrowedVideoFrameBuilder<'buf>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'buf> Copy for BorrowedVideoFrameBuilder<'buf>

Source§

impl Debug for BorrowedVideoFrameBuilder<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.