Struct cros_codecs::decoder::stateless::StatelessDecoder
source · 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>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H264, VaapiBackend<(), M>>
source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H265, VaapiBackend<BackendData, M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<H265, VaapiBackend<BackendData, M>>
source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp8, VaapiBackend<(), M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp8, VaapiBackend<(), M>>
source§impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp9, VaapiBackend<(), M>>
impl<M: SurfaceMemoryDescriptor + 'static> StatelessDecoder<Vp9, VaapiBackend<(), M>>
source§impl<C, B> StatelessDecoder<C, B>where
C: StatelessCodec,
B: StatelessDecoderBackend<C::FormatInfo>,
C::DecoderState<B>: Default,
impl<C, B> StatelessDecoder<C, B>where C: StatelessCodec, B: StatelessDecoderBackend<C::FormatInfo>, C::DecoderState<B>: Default,
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,
impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Header>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<Vp8, B>where B: StatelessVp8DecoderBackend, B::Handle: Clone + 'static,
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 next_event(
&mut self
) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>
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>
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.
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,
impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Header>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<Vp9, B>where B: StatelessVp9DecoderBackend, B::Handle: Clone + 'static,
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 next_event(
&mut self
) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>
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>
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.
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,
impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Sps>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<H264, B>where B: StatelessH264DecoderBackend, B::Handle: Clone + 'static,
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 next_event(
&mut self
) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>
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>
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.
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,
impl<B> StatelessVideoDecoder<<<B as StatelessDecoderBackend<Sps>>::Handle as DecodedHandle>::Descriptor> for StatelessDecoder<H265, B>where B: StatelessH265DecoderBackend, B::Handle: Clone + 'static,
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 next_event(
&mut self
) -> Option<DecoderEvent<'_, <B::Handle as DecodedHandle>::Descriptor>>
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>
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.
fn stream_info(&self) -> Option<&StreamInfo>
Auto Trait Implementations§
impl<C, B> RefUnwindSafe for StatelessDecoder<C, B>where B: RefUnwindSafe, <C as StatelessCodec>::DecoderState<B>: RefUnwindSafe, <C as StatelessCodec>::FormatInfo: RefUnwindSafe, <B as StatelessDecoderBackend<<C as StatelessCodec>::FormatInfo>>::Handle: RefUnwindSafe,
impl<C, B> Send for StatelessDecoder<C, B>where B: Send, <C as StatelessCodec>::DecoderState<B>: Send, <C as StatelessCodec>::FormatInfo: Send, <B as StatelessDecoderBackend<<C as StatelessCodec>::FormatInfo>>::Handle: Send,
impl<C, B> Sync for StatelessDecoder<C, B>where B: Sync, <C as StatelessCodec>::DecoderState<B>: Sync, <C as StatelessCodec>::FormatInfo: Sync, <B as StatelessDecoderBackend<<C as StatelessCodec>::FormatInfo>>::Handle: Sync,
impl<C, B> Unpin for StatelessDecoder<C, B>where B: Unpin, <C as StatelessCodec>::DecoderState<B>: Unpin, <C as StatelessCodec>::FormatInfo: Unpin, <B as StatelessDecoderBackend<<C as StatelessCodec>::FormatInfo>>::Handle: Unpin,
impl<C, B> UnwindSafe for StatelessDecoder<C, B>where B: UnwindSafe, <C as StatelessCodec>::DecoderState<B>: UnwindSafe, <C as StatelessCodec>::FormatInfo: UnwindSafe, <B as StatelessDecoderBackend<<C as StatelessCodec>::FormatInfo>>::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