pub struct Decoder { /* private fields */ }
Expand description
An OpenH264 decoder.
Implementations§
source§impl Decoder
impl Decoder
sourcepub fn with_config(config: DecoderConfig) -> Result<Self, Error>
pub fn with_config(config: DecoderConfig) -> Result<Self, Error>
Create a decoder with the provided configuration.
sourcepub fn decode(&mut self, packet: &[u8]) -> Result<Option<DecodedYUV<'_>>, Error>
pub fn decode(&mut self, packet: &[u8]) -> Result<Option<DecodedYUV<'_>>, Error>
Decodes a series of H.264 NAL packets and returns the latest picture.
This function can be called with:
- only a complete SPS / PPS header (usually the first some 30 bytes of a H.264 stream)
- the headers and series of complete frames
- new frames after previous headers and frames were successfully decoded.
In each case, it will return Some(decoded) image in YUV format if an image was available, or None if more data needs to be provided.
§Errors
The function returns an error if the bitstream was corrupted.
sourcepub unsafe fn raw_api(&mut self) -> &mut DecoderRawAPI
pub unsafe fn raw_api(&mut self) -> &mut DecoderRawAPI
Obtain the raw API for advanced use cases.
When resorting to this call, please consider filing an issue / PR.
§Safety
You must not set parameters the decoder relies on, we recommend checking the source.
§Example
use openh264::decoder::{DecoderConfig, Decoder};
let config = DecoderConfig::default();
let mut decoder = Decoder::with_config(config)?;
unsafe {
let _ = decoder.raw_api();
};
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 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