Struct StatelessDecoder

Source
pub struct StatelessDecoder<C, B>{ /* 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<Av1, VaapiBackend<M>>

Source

pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
where M: From<S>, S: From<M>,

Source§

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

Source

pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
where M: From<S>, S: From<M>,

Source§

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

Source

pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
where 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, ) -> Result<Self, NewStatelessDecoderError>
where 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, ) -> Result<Self, NewStatelessDecoderError>
where M: From<S>, S: From<M>,

Source§

impl<C, B> StatelessDecoder<C, B>

Source

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

Trait Implementations§

Source§

impl<B> StatelessVideoDecoder for StatelessDecoder<Av1, B>

Source§

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

Decode an AV1 stream.

bitstream should initially be submitted as a whole temporal unit, however a call to this method will only consume a single OBU. The caller must be careful to check the return value and resubmit the remainder if the whole bitstream has not been consumed.

Source§

type Handle = <B as StatelessDecoderBackend>::Handle

Type of the DecodedHandles that decoded frames are returned into.
Source§

type FramePool = <B as StatelessDecoderBackend>::FramePool

FramePool providing frames to decode into. Its descriptor must be the same as StatelessVideoDecoder::Handle.
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 frame_pool(&mut self, layer: PoolLayer) -> Vec<&mut B::FramePool>

Returns the frame pool for resolution in use with the decoder. If resolution is None, the pool of the highest resolution is returned. Read more
Source§

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

Source§

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

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

fn poll_fd(&self) -> BorrowedFd<'_>

Returns a file descriptor that signals POLLIN whenever an event is pending on this decoder.
Source§

fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
where Self: Sized + 'static, Self::FramePool: Sized + 'static, Self::Handle: 'static,

Transforms the decoder into a StatelessVideoDecoder trait object. Read more
Source§

impl<B> StatelessVideoDecoder for StatelessDecoder<H264, B>

Source§

type Handle = <B as StatelessDecoderBackend>::Handle

Type of the DecodedHandles that decoded frames are returned into.
Source§

type FramePool = <B as StatelessDecoderBackend>::FramePool

FramePool providing frames to decode into. Its descriptor must be the same as StatelessVideoDecoder::Handle.
Source§

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

Attempts to decode bitstream if the current conditions allow it. 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>>

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

fn frame_pool(&mut self, layer: PoolLayer) -> Vec<&mut B::FramePool>

Returns the frame pool for resolution in use with the decoder. If resolution is None, the pool of the highest resolution is returned. Read more
Source§

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

Source§

fn poll_fd(&self) -> BorrowedFd<'_>

Returns a file descriptor that signals POLLIN whenever an event is pending on this decoder.
Source§

fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
where Self: Sized + 'static, Self::FramePool: Sized + 'static, Self::Handle: 'static,

Transforms the decoder into a StatelessVideoDecoder trait object. Read more
Source§

impl<B> StatelessVideoDecoder for StatelessDecoder<H265, B>

Source§

type Handle = <B as StatelessDecoderBackend>::Handle

Type of the DecodedHandles that decoded frames are returned into.
Source§

type FramePool = <B as StatelessDecoderBackend>::FramePool

FramePool providing frames to decode into. Its descriptor must be the same as StatelessVideoDecoder::Handle.
Source§

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

Attempts to decode bitstream if the current conditions allow it. 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>>

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

fn frame_pool(&mut self, layer: PoolLayer) -> Vec<&mut B::FramePool>

Returns the frame pool for resolution in use with the decoder. If resolution is None, the pool of the highest resolution is returned. Read more
Source§

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

Source§

fn poll_fd(&self) -> BorrowedFd<'_>

Returns a file descriptor that signals POLLIN whenever an event is pending on this decoder.
Source§

fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
where Self: Sized + 'static, Self::FramePool: Sized + 'static, Self::Handle: 'static,

Transforms the decoder into a StatelessVideoDecoder trait object. Read more
Source§

impl<B> StatelessVideoDecoder for StatelessDecoder<Vp8, B>

Source§

type Handle = <B as StatelessDecoderBackend>::Handle

Type of the DecodedHandles that decoded frames are returned into.
Source§

type FramePool = <B as StatelessDecoderBackend>::FramePool

FramePool providing frames to decode into. Its descriptor must be the same as StatelessVideoDecoder::Handle.
Source§

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

Attempts to decode bitstream if the current conditions allow it. 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>>

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

fn frame_pool(&mut self, layer: PoolLayer) -> Vec<&mut B::FramePool>

Returns the frame pool for resolution in use with the decoder. If resolution is None, the pool of the highest resolution is returned. Read more
Source§

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

Source§

fn poll_fd(&self) -> BorrowedFd<'_>

Returns a file descriptor that signals POLLIN whenever an event is pending on this decoder.
Source§

fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
where Self: Sized + 'static, Self::FramePool: Sized + 'static, Self::Handle: 'static,

Transforms the decoder into a StatelessVideoDecoder trait object. Read more
Source§

impl<B> StatelessVideoDecoder for StatelessDecoder<Vp9, B>

Source§

type Handle = <B as StatelessDecoderBackend>::Handle

Type of the DecodedHandles that decoded frames are returned into.
Source§

type FramePool = <B as StatelessDecoderBackend>::FramePool

FramePool providing frames to decode into. Its descriptor must be the same as StatelessVideoDecoder::Handle.
Source§

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

Attempts to decode bitstream if the current conditions allow it. 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>>

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

fn frame_pool(&mut self, layer: PoolLayer) -> Vec<&mut B::FramePool>

Returns the frame pool for resolution in use with the decoder. If resolution is None, the pool of the highest resolution is returned. Read more
Source§

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

Source§

fn poll_fd(&self) -> BorrowedFd<'_>

Returns a file descriptor that signals POLLIN whenever an event is pending on this decoder.
Source§

fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
where Self: Sized + 'static, Self::FramePool: Sized + 'static, Self::Handle: 'static,

Transforms the decoder into a StatelessVideoDecoder trait object. Read more

Auto Trait Implementations§

§

impl<C, B> Freeze for StatelessDecoder<C, B>

§

impl<C, B> RefUnwindSafe for StatelessDecoder<C, B>

§

impl<C, B> Send for StatelessDecoder<C, B>

§

impl<C, B> Sync for StatelessDecoder<C, B>

§

impl<C, B> Unpin for StatelessDecoder<C, B>

§

impl<C, B> UnwindSafe for StatelessDecoder<C, B>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.