pub struct Decoder<T: DecodedHandle> {
parser: Parser,
blocking_mode: BlockingMode,
backend: Box<dyn StatelessDecoderBackend<Handle = T>>,
negotiation_status: NegotiationStatus,
coded_resolution: Resolution,
ready_queue: Vec<T>,
current_display_order: u64,
last_picture: Option<T>,
golden_ref_picture: Option<T>,
alt_ref_picture: Option<T>,
}
Fields
parser: Parser
A parser to extract bitstream data and build frame data in turn
blocking_mode: BlockingMode
Whether the decoder should block on decode operations.
backend: Box<dyn StatelessDecoderBackend<Handle = T>>
The backend used for hardware acceleration.
negotiation_status: NegotiationStatus
Keeps track of whether the decoded format has been negotiated with the backend.
coded_resolution: Resolution
The current resolution
ready_queue: Vec<T>
A queue with the pictures that are ready to be sent to the client.
current_display_order: u64
A monotonically increasing counter used to tag pictures in display order
last_picture: Option<T>
The picture used as the last reference picture.
golden_ref_picture: Option<T>
The picture used as the golden reference picture.
alt_ref_picture: Option<T>
The picture used as the alternate reference picture.
Implementations
sourceimpl Decoder<VADecodedHandle>
impl Decoder<VADecodedHandle>
pub fn new_vaapi(
display: Rc<Display>,
blocking_mode: BlockingMode
) -> Result<Self>
sourceimpl<T: DecodedHandle + DynDecodedHandle + 'static> Decoder<T>
impl<T: DecodedHandle + DynDecodedHandle + 'static> Decoder<T>
sourcepub(crate) fn new(
backend: Box<dyn StatelessDecoderBackend<Handle = T>>,
blocking_mode: BlockingMode
) -> Result<Self>
pub(crate) fn new(
backend: Box<dyn StatelessDecoderBackend<Handle = T>>,
blocking_mode: BlockingMode
) -> Result<Self>
Create a new codec backend for VP8.
sourcefn replace_reference(reference: &mut Option<T>, handle: &T)
fn replace_reference(reference: &mut Option<T>, handle: &T)
Replace a reference frame with handle
.
fn update_references(
header: &Header,
decoded_handle: &T,
last_picture: &mut Option<T>,
golden_ref_picture: &mut Option<T>,
alt_ref_picture: &mut Option<T>
) -> Result<()>
fn block_on_one(&mut self) -> Result<()>
sourcefn get_ready_frames(&mut self) -> Vec<T>
fn get_ready_frames(&mut self) -> Vec<T>
Returns the ready handles.
sourcefn handle_frame(
&mut self,
frame: Frame<&[u8]>,
timestamp: u64,
queued_parser_state: Option<Parser>
) -> Result<T>
fn handle_frame(
&mut self,
frame: Frame<&[u8]>,
timestamp: u64,
queued_parser_state: Option<Parser>
) -> Result<T>
Handle a single frame.
fn negotiation_possible(&self, frame: &Frame<impl AsRef<[u8]>>) -> bool
Trait Implementations
sourceimpl<T: DecodedHandle + DynDecodedHandle + 'static> VideoDecoder for Decoder<T>
impl<T: DecodedHandle + DynDecodedHandle + 'static> VideoDecoder for Decoder<T>
sourcefn decode(
&mut self,
timestamp: u64,
bitstream: &[u8]
) -> VideoDecoderResult<Vec<Box<dyn DynDecodedHandle>>>
fn decode(
&mut self,
timestamp: u64,
bitstream: &[u8]
) -> VideoDecoderResult<Vec<Box<dyn DynDecodedHandle>>>
Decode the
bitstream
represented by timestamp
. Returns zero or more
decoded handles representing the decoded data. Read moresourcefn flush(&mut self) -> Result<Vec<Box<dyn DynDecodedHandle>>>
fn flush(&mut self) -> Result<Vec<Box<dyn DynDecodedHandle>>>
Flush the decoder i.e. finish processing all queued decode requests and
emit frames for them. Read more
sourcefn negotiation_possible(&self) -> bool
fn negotiation_possible(&self) -> bool
Whether negotiation of the decoded format is possible. In particular, a
decoder will indicate that negotiation is possible after enough metadata
is collected from parsing the bitstream through calls to the
decode()
method. Read moresourcefn num_resources_left(&self) -> Option<usize>
fn num_resources_left(&self) -> Option<usize>
Gets the number of output resources left in the backend after accounting
for any buffers that might be queued in the decoder. Read more
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. Read more
sourcefn poll(
&mut self,
blocking_mode: BlockingMode
) -> VideoDecoderResult<Vec<Box<dyn DynDecodedHandle>>>
fn poll(
&mut self,
blocking_mode: BlockingMode
) -> VideoDecoderResult<Vec<Box<dyn DynDecodedHandle>>>
Polls the decoder, emitting frames for all queued decode requests. This
is similar to flush, but it does not change the state of the decoded
picture buffer nor does it reset any internal state. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for Decoder<T>
impl<T> !Send for Decoder<T>
impl<T> !Sync for Decoder<T>
impl<T> Unpin for Decoder<T>where
T: Unpin,
impl<T> !UnwindSafe for Decoder<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more