pub struct AvCodecContext(*mut AVCodecContext);
Expand description

A codec context from which decoding can be performed.

Tuple Fields§

§0: *mut AVCodecContext

Implementations§

source§

impl AvCodecContext

source

fn init(&mut self, codec: *const AVCodec) -> Result<(), AvCodecOpenError>

Internal helper for DecoderContextBuilder to initialize the context.

source

pub fn try_send_packet( &mut self, packet: &AvPacket<'_> ) -> Result<bool, AvError>

Send a packet to be decoded by the codec.

Returns true if the packet has been accepted and will be decoded, false if the codec can not accept frames at the moment - in this case try_receive_frame must be called before the packet can be submitted again.

Error codes are the same as those returned by avcodec_send_packet with the exception of EAGAIN which is converted into Ok(false) as it is not actually an error.

source

pub fn try_receive_frame( &mut self, frame: &mut AvFrame ) -> Result<TryReceiveResult, AvError>

Attempt to write a decoded frame in frame if the codec has enough data to do so.

Returned Received if frame has been filled with the next decoded frame, TryAgain if no frame could be returned at that time (in which case try_send_packet should be called to submit more input to decode), or FlushCompleted to signal that a previous flush triggered by calling the flush method has completed.

Error codes are the same as those returned by avcodec_receive_frame with the exception of EAGAIN and EOF which are handled as TryAgain and FlushCompleted respectively.

source

pub fn try_send_frame(&mut self, frame: &AvFrame) -> Result<bool, AvError>

Send a frame to be encoded by the codec.

Returns true if the frame has been accepted and will be encoded, false if the codec can not accept input at the moment - in this case try_receive_frame must be called before the frame can be submitted again.

Error codes are the same as those returned by avcodec_send_frame with the exception of EAGAIN which is converted into Ok(false) as it is not actually an error.

source

pub fn try_receive_packet( &mut self, packet: &mut AvPacket<'_> ) -> Result<TryReceiveResult, AvError>

Attempt to write an encoded frame in packet if the codec has enough data to do so.

Returned Received if packet has been filled with encoded data, TryAgain if no packet could be returned at that time (in which case try_send_frame should be called to submit more input to decode), or FlushCompleted to signal that a previous flush triggered by calling the flush method has completed.

Error codes are the same as those returned by avcodec_receive_packet with the exception of EAGAIN and EOF which are handled as TryAgain and FlushCompleted respectively.

source

pub fn reset(&mut self)

Reset the internal codec state/flush internal buffers. Should be called e.g. when seeking or switching to a different stream.

source

pub fn flush_decoder(&mut self) -> Result<(), AvError>

Ask the context to start flushing, i.e. to process all pending input packets and produce frames for them.

The flush process is complete when try_receive_frame returns FlushCompleted,

source

pub fn flush_encoder(&mut self) -> Result<(), AvError>

Ask the context to start flushing, i.e. to process all pending input frames and produce packets for them.

The flush process is complete when try_receive_packet returns FlushCompleted,

source

pub fn set_time_base(&mut self, time_base: AVRational)

Set the time base for this context.

source

pub fn set_bit_rate(&mut self, bit_rate: u64)

Set the bit rate for this context.

source

pub fn set_max_bit_rate(&mut self, bit_rate: u64)

Set the max bit rate (rc_max_rate) for this context.

Trait Implementations§

source§

impl AsRef<AVCodecContext> for AvCodecContext

source§

fn as_ref(&self) -> &AVCodecContext

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Drop for AvCodecContext

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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>,

§

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>,

§

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.