pub struct VideoData { /* private fields */ }
Expand description
Describes a video frame
Implementations§
Source§impl VideoData
impl VideoData
Sourcepub 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
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
Sourcepub fn width(&self) -> u32
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.
Sourcepub fn four_cc(&self) -> FourCCVideoType
pub fn four_cc(&self) -> FourCCVideoType
The FourCC pixel format for this buffer.
See FourCCVideoType
for details on possible values
Sourcepub fn frame_rate_n(&self) -> u32
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);
Sourcepub fn frame_rate_d(&self) -> u32
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);
Sourcepub fn frame_rate(&self) -> f32
pub fn frame_rate(&self) -> f32
The framerate of the current frame.
Sourcepub fn picture_aspect_ratio(&self) -> f32
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.
Sourcepub fn frame_format_type(&self) -> FrameFormatType
pub fn frame_format_type(&self) -> FrameFormatType
The frame format type of a video
Sourcepub fn timecode(&self) -> i64
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
Sourcepub fn p_data(&self) -> *mut u8
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()
Sourcepub fn line_stride_in_bytes(&self) -> Option<u32>
pub fn line_stride_in_bytes(&self) -> Option<u32>
This is the inter-line stride of the video data, in bytes.
Sourcepub fn data_size_in_bytes(&self) -> Option<u32>
pub fn data_size_in_bytes(&self) -> Option<u32>
The size of the p_data buffer in bytes.
Sourcepub fn metadata(&self) -> String
pub fn metadata(&self) -> String
A per frame metadata stream that should be XML
It is sent and received with the frame.
Sourcepub fn timestamp(&self) -> Option<i64>
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.