pub struct CodecConstraints {
pub codec: String,
pub profile: String,
pub level: String,
pub max_width: u32,
pub max_height: u32,
pub max_fps: f32,
pub max_bitrate_kbps: u32,
pub max_sample_rate: u32,
pub bit_depths: Vec<u8>,
pub color_spaces: Vec<String>,
}Expand description
A codec-agnostic constraints record used for profile/level validation.
Callers obtain pre-filled instances via the associated constructor functions
(e.g., CodecConstraints::av1_main) and then call
CodecConstraints::validate_video or CodecConstraints::validate_audio
to collect any violations.
Fields§
§codec: StringCodec name (e.g., "AV1", "VP9", "Opus", "FLAC").
profile: StringProfile name (e.g., "Main", "Profile 0", "Audio").
level: StringLevel name (e.g., "4.0", "N/A").
max_width: u32Maximum picture width in pixels (0 = unlimited).
max_height: u32Maximum picture height in pixels (0 = unlimited).
max_fps: f32Maximum frames per second (0.0 = unlimited).
max_bitrate_kbps: u32Maximum video / audio bitrate in kbps (0 = unlimited).
max_sample_rate: u32Maximum audio sample rate in Hz (0 = unlimited).
bit_depths: Vec<u8>Supported bit depths (empty = all).
color_spaces: Vec<String>Supported colour space names (empty = all).
Implementations§
Source§impl CodecConstraints
impl CodecConstraints
Sourcepub fn vp9_profile0() -> Self
pub fn vp9_profile0() -> Self
Constraints for VP9 Profile 0 (4:2:0, 8-bit).
Sourcepub fn opus_audio() -> Self
pub fn opus_audio() -> Self
Constraints for Opus Audio profile.
Sourcepub fn flac_standard() -> Self
pub fn flac_standard() -> Self
Constraints for FLAC lossless audio.
Sourcepub fn validate_video(
constraints: &Self,
width: u32,
height: u32,
fps: f32,
bitrate_kbps: u32,
) -> Result<(), Vec<String>>
pub fn validate_video( constraints: &Self, width: u32, height: u32, fps: f32, bitrate_kbps: u32, ) -> Result<(), Vec<String>>
Validate video stream parameters against constraints.
Returns Ok(()) when all constraints are satisfied, or
Err(violations) with a list of human-readable violation messages.
Sourcepub fn validate_audio(
constraints: &Self,
sample_rate: u32,
channels: u8,
bitrate_kbps: u32,
) -> Result<(), Vec<String>>
pub fn validate_audio( constraints: &Self, sample_rate: u32, channels: u8, bitrate_kbps: u32, ) -> Result<(), Vec<String>>
Validate audio stream parameters against constraints.
Returns Ok(()) when all constraints are satisfied, or
Err(violations) with a list of human-readable violation messages.
Trait Implementations§
Source§impl Clone for CodecConstraints
impl Clone for CodecConstraints
Source§fn clone(&self) -> CodecConstraints
fn clone(&self) -> CodecConstraints
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CodecConstraints
impl RefUnwindSafe for CodecConstraints
impl Send for CodecConstraints
impl Sync for CodecConstraints
impl Unpin for CodecConstraints
impl UnsafeUnpin for CodecConstraints
impl UnwindSafe for CodecConstraints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more