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>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Av1, VaapiBackend<M>>
pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
Source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H264, VaapiBackend<M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H264, VaapiBackend<M>>
pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
Source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H265, VaapiBackend<M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H265, VaapiBackend<M>>
pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
Source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp8, VaapiBackend<M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp8, VaapiBackend<M>>
pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
Source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp9, VaapiBackend<M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp9, VaapiBackend<M>>
pub fn new_vaapi<S>( display: Rc<Display>, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
Source§impl<C, B> StatelessDecoder<C, B>where
C: StatelessCodec,
B: StatelessDecoderBackend + StatelessDecoderBackendPicture<C> + TryFormat<C>,
C::DecoderState<B::Handle, B::Picture>: Default,
impl<C, B> StatelessDecoder<C, B>where
C: StatelessCodec,
B: StatelessDecoderBackend + StatelessDecoderBackendPicture<C> + TryFormat<C>,
C::DecoderState<B::Handle, B::Picture>: Default,
pub fn new( backend: B, blocking_mode: BlockingMode, ) -> Result<Self, NewStatelessDecoderError>
Trait Implementations§
Source§impl<B> StatelessVideoDecoder for StatelessDecoder<Av1, B>
impl<B> StatelessVideoDecoder for StatelessDecoder<Av1, B>
Source§fn decode(
&mut self,
timestamp: u64,
bitstream: &[u8],
) -> Result<usize, DecodeError>
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 Handle = <B as StatelessDecoderBackend>::Handle
Type of the
DecodedHandle
s that decoded frames are returned into.Source§type FramePool = <B as StatelessDecoderBackend>::FramePool
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>
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 moreSource§fn frame_pool(&mut self, layer: PoolLayer) -> Vec<&mut B::FramePool>
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 morefn stream_info(&self) -> Option<&StreamInfo>
Source§fn next_event(&mut self) -> Option<DecoderEvent<'_, B::Handle>>
fn next_event(&mut self) -> Option<DecoderEvent<'_, B::Handle>>
Returns the next event, if there is any pending.
Source§fn poll_fd(&self) -> BorrowedFd<'_>
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>
fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
Transforms the decoder into a
StatelessVideoDecoder
trait object. Read moreSource§impl<B> StatelessVideoDecoder for StatelessDecoder<H264, B>
impl<B> StatelessVideoDecoder for StatelessDecoder<H264, B>
Source§type Handle = <B as StatelessDecoderBackend>::Handle
type Handle = <B as StatelessDecoderBackend>::Handle
Type of the
DecodedHandle
s that decoded frames are returned into.Source§type FramePool = <B as StatelessDecoderBackend>::FramePool
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>
fn decode( &mut self, timestamp: u64, bitstream: &[u8], ) -> Result<usize, DecodeError>
Attempts to decode
bitstream
if the current conditions allow it. Read moreSource§fn flush(&mut self) -> Result<(), DecodeError>
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 moreSource§fn next_event(&mut self) -> Option<DecoderEvent<'_, B::Handle>>
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>
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 morefn stream_info(&self) -> Option<&StreamInfo>
Source§fn poll_fd(&self) -> BorrowedFd<'_>
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>
fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
Transforms the decoder into a
StatelessVideoDecoder
trait object. Read moreSource§impl<B> StatelessVideoDecoder for StatelessDecoder<H265, B>
impl<B> StatelessVideoDecoder for StatelessDecoder<H265, B>
Source§type Handle = <B as StatelessDecoderBackend>::Handle
type Handle = <B as StatelessDecoderBackend>::Handle
Type of the
DecodedHandle
s that decoded frames are returned into.Source§type FramePool = <B as StatelessDecoderBackend>::FramePool
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>
fn decode( &mut self, timestamp: u64, bitstream: &[u8], ) -> Result<usize, DecodeError>
Attempts to decode
bitstream
if the current conditions allow it. Read moreSource§fn flush(&mut self) -> Result<(), DecodeError>
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 moreSource§fn next_event(&mut self) -> Option<DecoderEvent<'_, B::Handle>>
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>
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 morefn stream_info(&self) -> Option<&StreamInfo>
Source§fn poll_fd(&self) -> BorrowedFd<'_>
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>
fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
Transforms the decoder into a
StatelessVideoDecoder
trait object. Read moreSource§impl<B> StatelessVideoDecoder for StatelessDecoder<Vp8, B>
impl<B> StatelessVideoDecoder for StatelessDecoder<Vp8, B>
Source§type Handle = <B as StatelessDecoderBackend>::Handle
type Handle = <B as StatelessDecoderBackend>::Handle
Type of the
DecodedHandle
s that decoded frames are returned into.Source§type FramePool = <B as StatelessDecoderBackend>::FramePool
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>
fn decode( &mut self, timestamp: u64, bitstream: &[u8], ) -> Result<usize, DecodeError>
Attempts to decode
bitstream
if the current conditions allow it. Read moreSource§fn flush(&mut self) -> Result<(), DecodeError>
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 moreSource§fn next_event(&mut self) -> Option<DecoderEvent<'_, B::Handle>>
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>
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 morefn stream_info(&self) -> Option<&StreamInfo>
Source§fn poll_fd(&self) -> BorrowedFd<'_>
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>
fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
Transforms the decoder into a
StatelessVideoDecoder
trait object. Read moreSource§impl<B> StatelessVideoDecoder for StatelessDecoder<Vp9, B>
impl<B> StatelessVideoDecoder for StatelessDecoder<Vp9, B>
Source§type Handle = <B as StatelessDecoderBackend>::Handle
type Handle = <B as StatelessDecoderBackend>::Handle
Type of the
DecodedHandle
s that decoded frames are returned into.Source§type FramePool = <B as StatelessDecoderBackend>::FramePool
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>
fn decode( &mut self, timestamp: u64, bitstream: &[u8], ) -> Result<usize, DecodeError>
Attempts to decode
bitstream
if the current conditions allow it. Read moreSource§fn flush(&mut self) -> Result<(), DecodeError>
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 moreSource§fn next_event(&mut self) -> Option<DecoderEvent<'_, B::Handle>>
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>
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 morefn stream_info(&self) -> Option<&StreamInfo>
Source§fn poll_fd(&self) -> BorrowedFd<'_>
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>
fn into_trait_object( self, ) -> DynStatelessVideoDecoder<<Self::Handle as DecodedHandle>::Descriptor>
Transforms the decoder into a
StatelessVideoDecoder
trait object. Read moreAuto Trait Implementations§
impl<C, B> Freeze for StatelessDecoder<C, B>where
B: Freeze,
<C as StatelessCodec>::DecoderState<<B as StatelessDecoderBackend>::Handle, <B as StatelessDecoderBackendPicture<C>>::Picture>: Freeze,
<C as StatelessCodec>::FormatInfo: Freeze,
impl<C, B> RefUnwindSafe for StatelessDecoder<C, B>where
B: RefUnwindSafe,
<C as StatelessCodec>::DecoderState<<B as StatelessDecoderBackend>::Handle, <B as StatelessDecoderBackendPicture<C>>::Picture>: RefUnwindSafe,
<C as StatelessCodec>::FormatInfo: RefUnwindSafe,
<B as StatelessDecoderBackend>::Handle: RefUnwindSafe,
impl<C, B> Send for StatelessDecoder<C, B>where
B: Send,
<C as StatelessCodec>::DecoderState<<B as StatelessDecoderBackend>::Handle, <B as StatelessDecoderBackendPicture<C>>::Picture>: Send,
<C as StatelessCodec>::FormatInfo: Send,
<B as StatelessDecoderBackend>::Handle: Send,
impl<C, B> Sync for StatelessDecoder<C, B>where
B: Sync,
<C as StatelessCodec>::DecoderState<<B as StatelessDecoderBackend>::Handle, <B as StatelessDecoderBackendPicture<C>>::Picture>: Sync,
<C as StatelessCodec>::FormatInfo: Sync,
<B as StatelessDecoderBackend>::Handle: Sync,
impl<C, B> Unpin for StatelessDecoder<C, B>where
B: Unpin,
<C as StatelessCodec>::DecoderState<<B as StatelessDecoderBackend>::Handle, <B as StatelessDecoderBackendPicture<C>>::Picture>: Unpin,
<C as StatelessCodec>::FormatInfo: Unpin,
<B as StatelessDecoderBackend>::Handle: Unpin,
impl<C, B> UnwindSafe for StatelessDecoder<C, B>where
B: UnwindSafe,
<C as StatelessCodec>::DecoderState<<B as StatelessDecoderBackend>::Handle, <B as StatelessDecoderBackendPicture<C>>::Picture>: UnwindSafe,
<C as StatelessCodec>::FormatInfo: UnwindSafe,
<B as StatelessDecoderBackend>::Handle: UnwindSafe,
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