Struct VideoData

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

Describes a video frame

Implementations§

Source§

impl VideoData

Source

pub fn new() -> Self

Create an empty video frame

Source

pub fn from_buffer( width: i32, height: i32, fourcc: FourCCVideoType, framerate_numerator: i32, framerate_denominator: i32, frame_format: FrameFormatType, timecode: i64, stride: i32, metadata: Option<&CStr>, buffer: &mut [u8], ) -> Self

Create VideoData from a raw memory buffer, with custom settings

Source

pub fn width(&self) -> u32

The width of the frame expressed in pixels.

Note that, because data is internally all considered in 4:2:2 formats, image width values should be divisible by two.

Source

pub fn height(&self) -> u32

The height of the frame expressed in pixels.

Source

pub fn four_cc(&self) -> FourCCVideoType

The FourCC pixel format for this buffer.

See FourCCVideoType for details on possible values

Source

pub fn frame_rate_n(&self) -> u32

The numerator of the framerate of the current frame.

The framerate is specified as a numerator and denominator, such that the following is valid:

let frame_rate = (frame_rate_N as f32) / (frame_rate_D as f32);
Source

pub fn frame_rate_d(&self) -> u32

The denominator of the framerate of the current frame.

The framerate is specified as a numerator and denominator, such that the following is valid:

let frame_rate = (frame_rate_N as f32) / (frame_rate_D as f32);
Source

pub fn frame_rate(&self) -> f32

The framerate of the current frame.

Source

pub fn picture_aspect_ratio(&self) -> f32

The SDK defines picture aspect ratio (as opposed to pixel aspect ratios).

When the aspect ratio is 0.0 it is interpreted as xres/yres, or square pixel; for most modern video types this is a default that can be used.

Source

pub fn frame_format_type(&self) -> FrameFormatType

The frame format type of a video

Source

pub fn timecode(&self) -> i64

The timecode of this frame in 100 ns intervals.

This is generally not used internally by the SDK but is passed through to applications, which may interpret it as they wish. See Send for details

Source

pub fn p_data(&self) -> *mut u8

The video data itself laid out linearly in memory

The memory is laid out in the FourCC format returned by four_cc(). The number of bytes defined between lines is specified in line_stride_in_bytes()

Source

pub fn line_stride_in_bytes(&self) -> Option<u32>

This is the inter-line stride of the video data, in bytes.

Source

pub fn data_size_in_bytes(&self) -> Option<u32>

The size of the p_data buffer in bytes.

Source

pub fn metadata(&self) -> String

A per frame metadata stream that should be XML

It is sent and received with the frame.

Source

pub fn timestamp(&self) -> Option<i64>

A per-frame timestamp filled in by the NDI SDK using a high precision clock.

This is only valid when receiving a frame. It represents the time (in 100 ns intervals measured in UTC time, since the Unix Time Epoch 1/1/1970 00:00 of the exact moment that the frame was submitted by the sending side If this value is None then this value is not available.

Trait Implementations§

Source§

impl Debug for VideoData

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for VideoData

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for VideoData

Source§

impl Sync for VideoData

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.