Skip to main content

VideoConverter

Struct VideoConverter 

Source
pub struct VideoConverter { /* private fields */ }
Expand description

Native V210/P216 conversion helpers retained with their selected runtime.

Both exports are resolved before construction succeeds. Operations use caller-owned initialized storage and do not allocate pixel buffers. Borrowed P216 inputs retain their original validated row and plane strides.

Implementations§

Source§

impl VideoConverter

Source

pub fn new(ndi: &Ndi) -> Result<Self>

Resolve both native utility functions from one initialized runtime.

§Errors

Returns Error::UnsupportedCapability when the runtime does not provide both native V210/P216 conversion functions.

Source

pub fn v210_to_p216( &self, layout: V210Layout, source: &[u32], destination: &mut VideoFrame, ) -> Result<()>

Unpack V210 into an existing P216 frame with matching dimensions.

source contains native 32-bit V210 words and complete row storage. Only samples are replaced: destination timecode, timestamps, metadata and frame headers remain unchanged. P216 samples contain the ten bits shifted left by six. Extra source words and row padding are ignored.

§Errors

Error::InvalidFrame when destination is not a P216 frame of the layout’s dimensions, or source is shorter than the layout’s storage. destination is then unchanged.

Source

pub fn p216_to_v210( &self, source: &(impl VideoSource + ?Sized), layout: V210Layout, destination: &mut [u32], ) -> Result<()>

Pack P216 into reusable V210 storage, discarding each sample’s low six bits.

Active output words are initialized to zero before the native call because the SDK preserves unused bits through read/modify/write operations. Their two unused high bits therefore remain zero. Row padding and extra trailing words are unchanged. V210 utility buffers carry no frame metadata.

Accepts owned, captured, FrameSync and external borrowed VideoSource inputs, including padded P216 planes. The native utility reads the original active rows with their validated stride; no intermediate pixel copy or wrapper allocation is made. The source borrow lasts through the call.

§Errors

Error::InvalidFrame when source is not a P216 frame of the layout’s dimensions, or destination is shorter than the layout’s storage. destination is then unchanged.

Trait Implementations§

Source§

impl Debug for VideoConverter

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> 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, 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.