pub struct CodecCapabilities {Show 15 fields
pub decode: bool,
pub encode: bool,
pub media_type: MediaType,
pub intra_only: bool,
pub lossy: bool,
pub lossless: bool,
pub hardware_accelerated: bool,
pub implementation: String,
pub max_width: Option<u32>,
pub max_height: Option<u32>,
pub max_bitrate: Option<u64>,
pub max_sample_rate: Option<u32>,
pub max_channels: Option<u16>,
pub priority: i32,
pub accepted_pixel_formats: Vec<PixelFormat>,
}Expand description
What an implementation can do plus how it ranks vs alternatives.
Fields§
§decode: boolDecoding supported by this implementation.
encode: boolEncoding supported by this implementation.
media_type: MediaTypeMedia type this implementation handles (audio, video, …).
intra_only: boolEvery coded unit is independently decodable (no inter-frame prediction).
lossy: boolSupports lossy compression.
lossless: boolSupports lossless compression. lossy and lossless may both
be set for codecs that offer both modes.
hardware_accelerated: boolHardware-accelerated implementation (VAAPI/NVENC/QSV/VideoToolbox/…).
implementation: StringShort identifier for this implementation, e.g. “flac_sw”, “h264_qsv”.
max_width: Option<u32>Restrictions — None means “no constraint”.
max_height: Option<u32>Maximum supported frame height in pixels; None = unconstrained.
max_bitrate: Option<u64>Maximum supported bit rate in bits per second; None =
unconstrained.
max_sample_rate: Option<u32>Maximum supported audio sample rate in Hz; None = unconstrained.
max_channels: Option<u16>Maximum supported audio channel count; None = unconstrained.
priority: i32Lower numbers are preferred. HW impls should be ~10, SW impls ~100.
accepted_pixel_formats: Vec<PixelFormat>Pixel formats this implementation accepts (video only). An empty
Vec means “any format” — resolution won’t filter on it. When
populated, the registry can skip impls whose accepted set does not
include the format requested by the caller.
Implementations§
Source§impl CodecCapabilities
impl CodecCapabilities
Sourcepub fn audio(implementation: impl Into<String>) -> Self
pub fn audio(implementation: impl Into<String>) -> Self
Construct a software audio decoder/encoder capability set with sensible defaults — adjust fields after creation.
Sourcepub fn video(implementation: impl Into<String>) -> Self
pub fn video(implementation: impl Into<String>) -> Self
Construct a software video decoder/encoder capability set with sensible defaults — adjust fields after creation.
Sourcepub fn flag_string(&self) -> String
pub fn flag_string(&self) -> String
6-character capability flag string (see the module docs for the
column layout). Useful for oxideav list-style
output.
Sourcepub fn with_decode(self) -> Self
pub fn with_decode(self) -> Self
Mark this implementation as supporting decode.
Sourcepub fn with_encode(self) -> Self
pub fn with_encode(self) -> Self
Mark this implementation as supporting encode.
Sourcepub fn with_intra_only(self, v: bool) -> Self
pub fn with_intra_only(self, v: bool) -> Self
Set the intra-frame-only flag.
Sourcepub fn with_lossy(self, v: bool) -> Self
pub fn with_lossy(self, v: bool) -> Self
Set the lossy-compression flag.
Sourcepub fn with_lossless(self, v: bool) -> Self
pub fn with_lossless(self, v: bool) -> Self
Set the lossless-compression flag.
Sourcepub fn with_hardware(self, v: bool) -> Self
pub fn with_hardware(self, v: bool) -> Self
Set the hardware-accelerated flag.
Sourcepub fn with_priority(self, p: i32) -> Self
pub fn with_priority(self, p: i32) -> Self
Set the registry ranking priority (lower is preferred; HW ~10, SW ~100).
Sourcepub fn with_max_size(self, w: u32, h: u32) -> Self
pub fn with_max_size(self, w: u32, h: u32) -> Self
Constrain the maximum frame size to w × h pixels.
Sourcepub fn with_max_bitrate(self, br: u64) -> Self
pub fn with_max_bitrate(self, br: u64) -> Self
Constrain the maximum bit rate (bits per second).
Sourcepub fn with_max_sample_rate(self, sr: u32) -> Self
pub fn with_max_sample_rate(self, sr: u32) -> Self
Constrain the maximum audio sample rate (Hz).
Sourcepub fn with_max_channels(self, ch: u16) -> Self
pub fn with_max_channels(self, ch: u16) -> Self
Constrain the maximum audio channel count.
Sourcepub fn with_pixel_format(self, fmt: PixelFormat) -> Self
pub fn with_pixel_format(self, fmt: PixelFormat) -> Self
Add one accepted pixel format. Appends — call multiple times to list several.
Sourcepub fn with_pixel_formats(self, fmts: Vec<PixelFormat>) -> Self
pub fn with_pixel_formats(self, fmts: Vec<PixelFormat>) -> Self
Replace the accepted pixel-format set wholesale.
Source§impl CodecCapabilities
impl CodecCapabilities
Sourcepub fn fits_params(&self, p: &CodecParameters, for_encode: bool) -> bool
pub fn fits_params(&self, p: &CodecParameters, for_encode: bool) -> bool
Whether this implementation’s max-* restrictions are compatible
with the requested codec parameters. for_encode is reserved
for restrictions that apply asymmetrically. Used by the
registry’s make_decoder / make_encoder walker and by
out-of-tree selection layers (e.g. oxideav-pipeline’s
CodecPreferences filter).
Trait Implementations§
Source§impl Clone for CodecCapabilities
impl Clone for CodecCapabilities
Source§fn clone(&self) -> CodecCapabilities
fn clone(&self) -> CodecCapabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more