Trait cros_codecs::decoders::VideoDecoder
source · pub trait VideoDecoder {
// Required methods
fn decode(
&mut self,
timestamp: u64,
bitstream: &[u8]
) -> Result<(), DecodeError>;
fn flush(&mut self);
fn num_resources_left(&self) -> usize;
fn num_resources_total(&self) -> usize;
fn coded_resolution(&self) -> Option<Resolution>;
fn next_event(&mut self) -> Option<DecoderEvent<'_>>;
}
Expand description
Stateless video decoder interface.
A stateless decoder differs from a stateful one in that its input and output queues are not operating independently: a new decode unit can only be processed if there is already an output resource available to receive its decoded content.
Therefore decode
can refuse work if there is no output resource available at the time of
calling, in which case the caller is responsible for calling decode
again with the same
parameters after processing at least one pending output frame and returning it to the decoder.
Required Methods§
sourcefn decode(
&mut self,
timestamp: u64,
bitstream: &[u8]
) -> Result<(), DecodeError>
fn decode( &mut self, timestamp: u64, bitstream: &[u8] ) -> Result<(), DecodeError>
Try to decode the bitstream
represented by timestamp
.
This method will return DecodeError::CheckEvents
if processing cannot take place until
pending events are handled. This could either be because a change of output format has
been detected that the client should acknowledge, or because there are no available output
resources and dequeueing and returning pending frames will fix that. After the cause has
been addressed, the client is responsible for calling this method again with the same data.
sourcefn flush(&mut self)
fn flush(&mut self)
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
.
sourcefn num_resources_left(&self) -> usize
fn num_resources_left(&self) -> usize
Gets the number of output resources left in the backend.
sourcefn num_resources_total(&self) -> usize
fn num_resources_total(&self) -> usize
Gets the number of output resources allocated by the backend.
sourcefn coded_resolution(&self) -> Option<Resolution>
fn coded_resolution(&self) -> Option<Resolution>
Returns the current coded resolution of the bitstream being processed. This may be None if we have not read the stream parameters yet.
sourcefn next_event(&mut self) -> Option<DecoderEvent<'_>>
fn next_event(&mut self) -> Option<DecoderEvent<'_>>
Returns the next event, if there is any pending.