Expand description
AV1 decoding through a native Rust API.
Import Decoder, Settings, Frame, and Planes directly from this
crate. Default features select checked Rust SIMD; Rust callers do not need
the optional C FFI or assembly features.
Feed raw AV1 OBU data, such as packets emitted by zenrav1e. For complete AVIF
files and RGB output, use zenavif, which wraps this decoder with container
handling and color conversion. Decoded Frame values expose borrowed YUV
plane views and own the storage that keeps those views alive.
use rav1d_safe::{Decoder, Frame};
fn decode_still(obu: &[u8]) -> rav1d_safe::Result<Vec<Frame>> {
let mut decoder = Decoder::new()?;
let mut frames = Vec::new();
if let Some(frame) = decoder.decode(obu)? {
frames.push(frame);
}
frames.extend(decoder.flush()?);
Ok(frames)
}Re-exports§
pub use src::managed::ColorInfo;pub use src::managed::ColorPrimaries;pub use src::managed::ColorRange;pub use src::managed::ContentLightLevel;pub use src::managed::CpuLevel;pub use src::managed::DecodeFrameType;pub use src::managed::Decoder;pub use src::managed::Error;pub use src::managed::Frame;pub use src::managed::InloopFilters;pub use src::managed::MasteringDisplay;pub use src::managed::MatrixCoefficients;pub use src::managed::PixelLayout;pub use src::managed::PlaneView8;pub use src::managed::PlaneView16;pub use src::managed::Planes;pub use src::managed::Planes8;pub use src::managed::Planes16;pub use src::managed::Result;pub use src::managed::Settings;pub use src::managed::Strictness;pub use src::managed::TransferCharacteristics;pub use src::managed::enabled_features;