DecoderInput

Struct DecoderInput 

Source
pub struct DecoderInput { /* private fields */ }
Expand description

Instance of this type is used to push input data for the decoder.

Implementations§

Source§

impl DecoderInput

Source

pub fn start_worker_threads(&mut self, num_threads: u32) -> Result<()>

Initialize background decoding threads.

If this function is not called, all decoding is done in the main thread (no multi-threading).

Source

pub fn push_data( &mut self, data: &[u8], pts: i64, user_data: usize, ) -> Result<()>

Push more data into the decoder.

Tha data must be a raw h265 bytestream with startcodes. The PTS (presentation time stamp) is assigned to all NALs whose start-code 0x000001 is contained in the data. The bytestream must contain all stuffing-bytes. This function only pushes data into the decoder, nothing will be decoded.

Source

pub fn push_end_of_nal(&mut self)

Indicate that the push_data method has just received data until the end of a NAL. The remaining pending input data is put into a NAL package and forwarded to the decoder.

Source

pub fn push_end_of_frame(&mut self)

Indicate that the push_data method has just received data until the end of a frame.

All data pending at the decoder input will be pushed into the decoder, and the decoded picture is pushed to the output queue.

Source

pub fn push_nal( &mut self, data: &[u8], pts: i64, user_data: usize, ) -> Result<()>

Push a complete NAL unit without startcode into the decoder.

The data must still contain all stuffing-bytes. This function only pushes data into the decoder, nothing will be decoded.

Source

pub fn flush_data(&mut self) -> Result<()>

Indicate the end-of-stream.

All data pending at the decoder input will be pushed into the decoder, and the decoded picture queue will be completely emptied.

Source

pub fn number_of_input_bytes_pending(&self) -> usize

Return the number of bytes pending at the decoder input.

Can be used to avoid overflowing the decoder with too much data.

Source

pub fn number_of_nal_units_pending(&self) -> usize

Return the number of NAL units pending at the decoder input.

Can be used to avoid overflowing the decoder with too much data.

Source

pub fn decode(&mut self) -> Result<DecodeResult>

Do some decoding.

Returns status whether it did perform some decoding or why it could not do so.

The result can be one of the following values:

There are a few errors that indicate that this method should be called again (possibly after resolving the indicated problem).

Source

pub fn decode_data(&mut self, data: &[u8]) -> Result<()>

👎Deprecated: you should use push_data or push_nal and decode methods instead.

Push more data into the decoder.

The data must be raw h265 bytestream. All complete images in the data will be decoded, hence, do not push too much data at once to prevent image buffer overflows. The end of a picture can only be detected when the succeeding start-code is read from the data. If you want to flush the data and force decoding of the data so far (e.g. at the end of a file), call decode_data() with an empty slice as the data argument.

Source

pub fn reset(&mut self)

Clear decoder state. Call this when skipping in the stream.

Source

pub fn get_warning(&self) -> Result<()>

Source

pub fn highest_tid(&self) -> u32

Returns the maximum layer ID in the stream.

Note that the maximum layer ID can change throughout the stream.

Source

pub fn current_tid(&self) -> u32

Returns an ID of the currently decoded temporal substream.

Source

pub fn set_limit_tid(&mut self, max_tid: u32)

Limits decoding to a maximum temporal layer (TID).

Source

pub fn set_framerate_ratio(&mut self, percent: u8)

It is used for a fine-grained selection of the frame-rate.

A percentage of 100% will decode all frames in all temporal layers. A lower percentage will drop approximately as many frames. Note that this is only accurate if the frames are distributed evenly among the layers. Otherwise, the mapping is non-linear.

The TID limit has a higher precedence than the framerate ratio. Hence, setting a higher framerate ratio will decode at TID limit without dropping.

Source

pub fn change_framerate(&mut self, more_vs_less: i8) -> u32

Increase or decrease the output frame-rate to some discrete preferable value. Currently, these are non-dropped decoding at various TID layers.

The more_vs_less argument can be one of [-1, 0, 1].

Returns the corresponding framerate ratio.

Source

pub fn set_parameter_i32(&mut self, param: ParamI32, val: i32)

Set an integer decoding parameter.

Source

pub fn set_parameter_bool(&mut self, param: ParamBool, val: bool)

Set a bool decoding parameter.

Source

pub fn set_acceleration(&mut self, val: Acceleration)

Set acceleration method, default: Acceleration::Auto

Source

pub fn get_parameter_bool(&self, param: ParamBool) -> bool

Get a bool decoding parameter.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.