pub struct DecoderInput { /* private fields */ }Expand description
Instance of this type is used to push input data for the decoder.
Implementations§
Source§impl DecoderInput
impl DecoderInput
Sourcepub fn start_worker_threads(&mut self, num_threads: u32) -> Result<()>
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).
Sourcepub fn push_data(
&mut self,
data: &[u8],
pts: i64,
user_data: usize,
) -> Result<()>
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.
Sourcepub fn push_end_of_nal(&mut self)
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.
Sourcepub fn push_end_of_frame(&mut self)
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.
Sourcepub fn push_nal(
&mut self,
data: &[u8],
pts: i64,
user_data: usize,
) -> Result<()>
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.
Sourcepub fn flush_data(&mut self) -> Result<()>
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.
Sourcepub fn number_of_input_bytes_pending(&self) -> usize
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.
Sourcepub fn number_of_nal_units_pending(&self) -> usize
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.
Sourcepub fn decode(&mut self) -> Result<DecodeResult>
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:
DecodeResult::Done- decoding was finished;DecodeResult::CallAgain- the decoding process isn’t yet finished, and theDecoderInput::decode()method must be called again.
There are a few errors that indicate that this method should be called again (possibly after resolving the indicated problem).
DeError::ErrorImageBufferFull- the decoded picture buffer is full, extract some images before continuing;DeError::ErrorWaitingForInputData- insert more data before continuing.
Sourcepub fn decode_data(&mut self, data: &[u8]) -> Result<()>
👎Deprecated: you should use push_data or push_nal and decode methods instead.
pub fn decode_data(&mut self, data: &[u8]) -> Result<()>
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.
pub fn get_warning(&self) -> Result<()>
Sourcepub fn highest_tid(&self) -> u32
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.
Sourcepub fn current_tid(&self) -> u32
pub fn current_tid(&self) -> u32
Returns an ID of the currently decoded temporal substream.
Sourcepub fn set_limit_tid(&mut self, max_tid: u32)
pub fn set_limit_tid(&mut self, max_tid: u32)
Limits decoding to a maximum temporal layer (TID).
Sourcepub fn set_framerate_ratio(&mut self, percent: u8)
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.
Sourcepub fn change_framerate(&mut self, more_vs_less: i8) -> u32
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.
Sourcepub fn set_parameter_i32(&mut self, param: ParamI32, val: i32)
pub fn set_parameter_i32(&mut self, param: ParamI32, val: i32)
Set an integer decoding parameter.
Sourcepub fn set_parameter_bool(&mut self, param: ParamBool, val: bool)
pub fn set_parameter_bool(&mut self, param: ParamBool, val: bool)
Set a bool decoding parameter.
Sourcepub fn set_acceleration(&mut self, val: Acceleration)
pub fn set_acceleration(&mut self, val: Acceleration)
Set acceleration method, default: Acceleration::Auto
Sourcepub fn get_parameter_bool(&self, param: ParamBool) -> bool
pub fn get_parameter_bool(&self, param: ParamBool) -> bool
Get a bool decoding parameter.