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,
reference_frames: [Option<T>; 8],
segmentation: [Segmentation; 8],
bit_depth: BitDepth,
profile: Profile,
}
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
reference_frames: [Option<T>; 8]
The reference frames in use.
segmentation: [Segmentation; 8]
Per-segment data.
bit_depth: BitDepth
Cached value for bit depth
profile: Profile
Cached value for profile
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(
reference_frames: &mut [Option<T>; 8],
picture: &T,
refresh_frame_flags: u8
) -> 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) -> Result<T>
fn handle_frame(&mut self, frame: &Frame<&[u8]>, timestamp: u64) -> Result<T>
Handle a single frame.
fn negotiation_possible(&self, frame: &Frame<impl AsRef<[u8]>>) -> bool
sourcefn clamp<U: PartialOrd>(x: U, low: U, high: U) -> U
fn clamp<U: PartialOrd>(x: U, low: U, high: U) -> U
A clamp such that min <= x <= max
sourcefn seg_feature_active(hdr: &Header, segment_id: u8, feature: u8) -> bool
fn seg_feature_active(hdr: &Header, segment_id: u8, feature: u8) -> bool
An implementation of seg_feature_active as per “6.4.9 Segmentation feature active syntax”
sourcefn get_qindex(hdr: &Header, segment_id: u8) -> i32
fn get_qindex(hdr: &Header, segment_id: u8) -> i32
An implementation of get_qindex as per “8.6.1 Dequantization functions”
sourcefn get_dc_quant(hdr: &Header, segment_id: u8, luma: bool) -> Result<i32>
fn get_dc_quant(hdr: &Header, segment_id: u8, luma: bool) -> Result<i32>
An implementation of get_dc_quant as per “8.6.1 Dequantization functions”
sourcefn get_ac_quant(hdr: &Header, segment_id: u8, luma: bool) -> Result<i32>
fn get_ac_quant(hdr: &Header, segment_id: u8, luma: bool) -> Result<i32>
An implementation of get_ac_quant as per “8.6.1 Dequantization functions”
sourcefn update_segmentation(
hdr: &Header,
segmentation: &mut [Segmentation; 8]
) -> Result<()>
fn update_segmentation(
hdr: &Header,
segmentation: &mut [Segmentation; 8]
) -> Result<()>
Update the state of the segmentation parameters after seeing a frame
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>>>
bitstream
represented by timestamp
. Returns zero or more
decoded handles representing the decoded data. Read moresourcefn flush(&mut self) -> VideoDecoderResult<Vec<Box<dyn DynDecodedHandle>>>
fn flush(&mut self) -> VideoDecoderResult<Vec<Box<dyn DynDecodedHandle>>>
sourcefn negotiation_possible(&self) -> bool
fn negotiation_possible(&self) -> bool
decode()
method. Read more