pub struct Decoder { /* private fields */ }Expand description
Safe AV1 decoder instance
This is the main entry point for decoding AV1 video. It wraps the internal
rav1d decoder with a safe, type-safe interface.
§Example
use rav1d_safe::src::managed::Decoder;
let mut decoder = Decoder::new()?;
let obu_data = b"...";
if let Some(frame) = decoder.decode(obu_data)? {
println!("Decoded {}x{}", frame.width(), frame.height());
}Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn with_settings(settings: Settings) -> Result<Self>
pub fn with_settings(settings: Settings) -> Result<Self>
Create a decoder with custom settings
Sourcepub fn decode(&mut self, data: &[u8]) -> Result<Option<Frame>>
pub fn decode(&mut self, data: &[u8]) -> Result<Option<Frame>>
Decode AV1 OBU data from a byte slice
Returns Ok(None) if more data is needed (the decoder is waiting for more input).
Returns Ok(Some(frame)) when a frame is successfully decoded.
§Example
let mut decoder = Decoder::new()?;
let data = b"..."; // AV1 OBU data
match decoder.decode(data)? {
Some(frame) => {
println!("Got frame: {}x{}", frame.width(), frame.height());
}
None => {
println!("Need more data");
}
}Sourcepub fn get_frame(&mut self) -> Result<Option<Frame>>
pub fn get_frame(&mut self) -> Result<Option<Frame>>
Try to get a decoded frame without sending new data.
After calling decode(), the decoder may have buffered
additional frames (e.g. from a raw OBU stream containing multiple temporal
units). Call this in a loop until it returns Ok(None) to drain them.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl !RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnsafeUnpin for Decoder
impl !UnwindSafe for Decoder
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
Mutably borrows from an owned value. Read more