pub struct StatelessDecoder<C, B>where
    C: StatelessCodec,
    B: StatelessDecoderBackend<C::FormatInfo>,{ /* private fields */ }
Expand description

A struct that serves as a basis to implement a stateless decoder.

A stateless decoder is defined by three generic parameters:

  • A codec, represented by a type that implements StatelessCodec. This type defines the codec-specific decoder state and other codec properties.
  • A backend, i.e. an interface to talk to the hardware that accelerates decoding. An example is the VAAPI backend that uses VAAPI for acceleration. The backend will typically itself be typed against a memory decriptor, defining how memory is provided for decoded frames.

So for instance, a decoder for the H264 codec, using VAAPI for acceleration with self-managed memory, will have the following type:

let decoder: StatelessDecoder<H264, VaapiBackend<()>>;

This struct just manages the high-level decoder state as well as the queue of decoded frames. All the rest is left to codec-specific code.

Implementations§

source§

impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H264, VaapiBackend<(), M>>

source

pub fn new_vaapi<S>(display: Rc<Display>, blocking_mode: BlockingMode) -> Selfwhere M: From<S>, S: From<M>,

source§

impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H265, VaapiBackend<BackendData, M>>

source

pub fn new_vaapi<S>(display: Rc<Display>, blocking_mode: BlockingMode) -> Selfwhere M: From<S>, S: From<M>,

source§

impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp8, VaapiBackend<(), M>>

source

pub fn new_vaapi<S>(display: Rc<Display>, blocking_mode: BlockingMode) -> Selfwhere M: From<S>, S: From<M>,

source§

impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp9, VaapiBackend<(), M>>

source

pub fn new_vaapi<S>(display: Rc<Display>, blocking_mode: BlockingMode) -> Selfwhere M: From<S>, S: From<M>,

source§

impl<C, B> StatelessDecoder<C, B>where C: StatelessCodec, B: StatelessDecoderBackend<C::FormatInfo>, C::DecoderState<B>: Default,

source

pub fn new(backend: B, blocking_mode: BlockingMode) -> Self

Trait Implementations§

source§

impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Header>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<Vp8, B>where B: StatelessVp8DecoderBackend, B::Handle: Clone + 'static,

source§

fn decode( &mut self, timestamp: u64, bitstream: &[u8] ) -> Result<usize, DecodeError>

Try to decode the bitstream represented by timestamp. Read more
source§

fn flush(&mut self) -> Result<(), DecodeError>

Flush the decoder i.e. finish processing all pending decode requests and make sure the resulting frames are ready to be retrieved via next_event. Read more
source§

fn next_event( &mut self ) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>

Returns the next event, if there is any pending.
source§

fn surface_pool( &mut self ) -> &mut dyn SurfacePool<<B::Handle as DecodedHandle>::Descriptor>

Returns the surface pool in use with the decoder. Useful to add new frames as decode. targets.
source§

fn stream_info(&self) -> Option<&StreamInfo>

source§

impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Header>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<Vp9, B>where B: StatelessVp9DecoderBackend, B::Handle: Clone + 'static,

source§

fn decode( &mut self, timestamp: u64, bitstream: &[u8] ) -> Result<usize, DecodeError>

Try to decode the bitstream represented by timestamp. Read more
source§

fn flush(&mut self) -> Result<(), DecodeError>

Flush the decoder i.e. finish processing all pending decode requests and make sure the resulting frames are ready to be retrieved via next_event. Read more
source§

fn next_event( &mut self ) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>

Returns the next event, if there is any pending.
source§

fn surface_pool( &mut self ) -> &mut dyn SurfacePool<<B::Handle as DecodedHandle>::Descriptor>

Returns the surface pool in use with the decoder. Useful to add new frames as decode. targets.
source§

fn stream_info(&self) -> Option<&StreamInfo>

source§

impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Sps>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<H264, B>where B: StatelessH264DecoderBackend, B::Handle: Clone + 'static,

source§

fn decode( &mut self, timestamp: u64, bitstream: &[u8] ) -> Result<usize, DecodeError>

Try to decode the bitstream represented by timestamp. Read more
source§

fn flush(&mut self) -> Result<(), DecodeError>

Flush the decoder i.e. finish processing all pending decode requests and make sure the resulting frames are ready to be retrieved via next_event. Read more
source§

fn next_event( &mut self ) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>

Returns the next event, if there is any pending.
source§

fn surface_pool( &mut self ) -> &mut dyn SurfacePool<<B::Handle as DecodedHandle>::Descriptor>

Returns the surface pool in use with the decoder. Useful to add new frames as decode. targets.
source§

fn stream_info(&self) -> Option<&StreamInfo>

source§

impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Sps>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<H265, B>where B: StatelessH265DecoderBackend, B::Handle: Clone + 'static,

source§

fn decode( &mut self, timestamp: u64, bitstream: &[u8] ) -> Result<usize, DecodeError>

Try to decode the bitstream represented by timestamp. Read more
source§

fn flush(&mut self) -> Result<(), DecodeError>

Flush the decoder i.e. finish processing all pending decode requests and make sure the resulting frames are ready to be retrieved via next_event. Read more
source§

fn next_event( &mut self ) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>

Returns the next event, if there is any pending.
source§

fn surface_pool( &mut self ) -> &mut dyn SurfacePool<<B::Handle as DecodedHandle>::Descriptor>

Returns the surface pool in use with the decoder. Useful to add new frames as decode. targets.
source§

fn stream_info(&self) -> Option<&StreamInfo>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.