pub struct VideoPacketFormat { /* private fields */ }Expand description
The codec, geometry and timing of compressed video, independent of any one frame’s bytes.
§Examples
use grafton_ndi::{
advanced::{VideoCodec, VideoPacketFormat},
FrameRate, StreamTier,
};
let format = VideoPacketFormat::new(VideoCodec::Hevc, 1920, 1080)?
.with_frame_rate(FrameRate::new(60_000, 1001)?)
.with_tier(StreamTier::Program);
assert_eq!(format.frame_rate(), FrameRate::new(60_000, 1001)?);
assert!(VideoPacketFormat::new(VideoCodec::Hevc, 0, 1080).is_err());Implementations§
Source§impl VideoPacketFormat
impl VideoPacketFormat
Sourcepub fn new(codec: VideoCodec, width: u32, height: u32) -> Result<Self>
pub fn new(codec: VideoCodec, width: u32, height: u32) -> Result<Self>
A progressive program-tier format at 60 frames per second with square
pixels. Adjust it with the with_* methods.
§Errors
Error::InvalidInput unless both dimensions are in 1..=i32::MAX,
the range the SDK can carry.
Sourcepub fn with_frame_rate(self, frame_rate: FrameRate) -> Self
pub fn with_frame_rate(self, frame_rate: FrameRate) -> Self
The same format at frame_rate.
Sourcepub fn with_picture_aspect_ratio(self, ratio: PictureAspectRatio) -> Self
pub fn with_picture_aspect_ratio(self, ratio: PictureAspectRatio) -> Self
The same format with the validated displayed picture aspect ratio.
PictureAspectRatio::SQUARE_PIXELS asks the SDK to derive it from
the pixel dimensions.
Sourcepub fn with_tier(self, tier: StreamTier) -> Self
pub fn with_tier(self, tier: StreamTier) -> Self
The same format on the program or preview stream.
Sourcepub fn with_scan_type(self, scan_type: ScanType) -> Self
pub fn with_scan_type(self, scan_type: ScanType) -> Self
The same format with scan type scan_type.
Sourcepub fn with_protected(self, protected: bool) -> Self
pub fn with_protected(self, protected: bool) -> Self
The same format, marked as a protected stream or not.
Sourcepub fn codec(self) -> VideoCodec
pub fn codec(self) -> VideoCodec
The codec.
Sourcepub fn frame_rate(self) -> FrameRate
pub fn frame_rate(self) -> FrameRate
The frame rate.
Sourcepub fn picture_aspect_ratio(self) -> PictureAspectRatio
pub fn picture_aspect_ratio(self) -> PictureAspectRatio
The picture aspect ratio; 0.0 means square pixels.
Sourcepub fn tier(self) -> StreamTier
pub fn tier(self) -> StreamTier
The stream this format belongs to.
Sourcepub fn is_protected(self) -> bool
pub fn is_protected(self) -> bool
Whether the stream is protected.