Trait VideoEncoder

Source
pub trait VideoEncoder<Handle> {
    // Required methods
    fn tune(&mut self, tunings: Tunings) -> EncodeResult<()>;
    fn encode(
        &mut self,
        meta: FrameMetadata,
        handle: Handle,
    ) -> Result<(), EncodeError>;
    fn drain(&mut self) -> EncodeResult<()>;
    fn poll(&mut self) -> EncodeResult<Option<CodedBitstreamBuffer>>;
}
Expand description

Generic video encoder interface.

Required Methods§

Source

fn tune(&mut self, tunings: Tunings) -> EncodeResult<()>

Changes dynamic parameters (aka Tunings) of the encoded stream. The change may not be effective right away. Depending on the used prediction structure, the Predictor may choose to delay the change until entire or a some part of the structure had been encoded.

Note: Currently changing the variant of RateControl is not supported.

Source

fn encode( &mut self, meta: FrameMetadata, handle: Handle, ) -> Result<(), EncodeError>

Enqueues the frame for encoding. The implementation will drop the handle after it is no longer be needed. The encoder is not required to immediately start processing the frame and yield output bitstream. It is allowed to hold frames until certain conditions are met eg. for specified prediction structures or referencing in order to further optimize the compression rate of the bitstream.

Source

fn drain(&mut self) -> EncodeResult<()>

Drains the encoder. This means that encoder is required to finish processing of all the frames in the internal queue and yield output bitstream by the end of the call. The output bitstream then can be polled using Self::poll function.

Drain does not enforce the flush of the internal state, ie. the enqueued frame handles do not have to be returned to user (dropped) and key frame is not enforced on the next frame.

Source

fn poll(&mut self) -> EncodeResult<Option<CodedBitstreamBuffer>>

Polls on the encoder for the available output bitstream with compressed frames that where submitted with Self::encode.

The call may also trigger a further processing aside of returning output. Therefore it recommended that this function is called frequently.

Implementors§

Source§

impl<Codec, Handle, Backend> VideoEncoder<Handle> for StatelessEncoder<Codec, Handle, Backend>
where Codec: StatelessCodec<Backend>, Backend: StatelessVideoEncoderBackend<Codec> + StatelessEncoderBackendImport<Handle, Backend::Picture>, Self: StatelessEncoderExecute<Codec, Handle, Backend>,

Source§

impl<Handle, Backend> VideoEncoder<Handle> for StatefulEncoder<Handle, Backend>
where Backend: StatefulVideoEncoderBackend<Handle>,