pub trait VideoEncoderExtManual: Sealed + IsA<VideoEncoder> + 'static {
Show 16 methods // Provided methods fn allocate_output_frame( &self, frame: &mut VideoCodecFrame<'_>, size: usize ) -> Result<FlowSuccess, FlowError> { ... } fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame<'_>> { ... } fn frames(&self) -> Vec<VideoCodecFrame<'_>> { ... } fn oldest_frame(&self) -> Option<VideoCodecFrame<'_>> { ... } fn allocator(&self) -> (Option<Allocator>, AllocationParams) { ... } fn finish_subframe( &self, frame: &VideoCodecFrame<'_> ) -> Result<FlowSuccess, FlowError> { ... } fn latency(&self) -> (ClockTime, Option<ClockTime>) { ... } fn set_latency( &self, min_latency: ClockTime, max_latency: impl Into<Option<ClockTime>> ) { ... } fn output_state(&self) -> Option<VideoCodecState<'static, Readable>> { ... } fn set_output_state( &self, caps: Caps, reference: Option<&VideoCodecState<'_, Readable>> ) -> Result<VideoCodecState<'_, InNegotiation<'_>>, FlowError> { ... } fn negotiate<'a>( &'a self, output_state: VideoCodecState<'a, InNegotiation<'a>> ) -> Result<(), FlowError> { ... } fn set_headers(&self, headers: impl IntoIterator<Item = Buffer>) { ... } fn sink_pad(&self) -> &Pad { ... } fn src_pad(&self) -> &Pad { ... } fn input_segment(&self) -> Segment { ... } fn output_segment(&self) -> Segment { ... }
}

Provided Methods§

source

fn allocate_output_frame( &self, frame: &mut VideoCodecFrame<'_>, size: usize ) -> Result<FlowSuccess, FlowError>

Helper function that allocates a buffer to hold an encoded video frame for self’s current VideoCodecState. Subclass should already have configured video state and set src pad caps.

The buffer allocated here is owned by the frame and you should only keep references to the frame, not the buffer.

§frame

a VideoCodecFrame

§size

size of the buffer

§Returns

gst::FlowReturn::Ok if an output buffer could be allocated

source

fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame<'_>>

Get a pending unfinished VideoCodecFrame

§frame_number

system_frame_number of a frame

§Returns

pending unfinished VideoCodecFrame identified by frame_number.

source

fn frames(&self) -> Vec<VideoCodecFrame<'_>>

Get all pending unfinished VideoCodecFrame

§Returns

pending unfinished VideoCodecFrame.

source

fn oldest_frame(&self) -> Option<VideoCodecFrame<'_>>

Get the oldest unfinished pending VideoCodecFrame

§Returns

oldest unfinished pending VideoCodecFrame

source

fn allocator(&self) -> (Option<Allocator>, AllocationParams)

Lets VideoEncoder sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after use it.

§Returns
§allocator

the gst::Allocator used

§params

the gst::AllocationParams of allocator

source

fn finish_subframe( &self, frame: &VideoCodecFrame<'_> ) -> Result<FlowSuccess, FlowError>

If multiple subframes are produced for one input frame then use this method for each subframe, except for the last one. Before calling this function, you need to fill frame->output_buffer with the encoded buffer to push.

You must call VideoEncoderExt::finish_frame() for the last sub-frame to tell the encoder that the frame has been fully encoded.

This function will change the metadata of frame and frame->output_buffer will be pushed downstream.

§frame

a VideoCodecFrame being encoded

§Returns

a gst::FlowReturn resulting from pushing the buffer downstream.

source

fn latency(&self) -> (ClockTime, Option<ClockTime>)

Query the configured encoding latency. Results will be returned via min_latency and max_latency.

§Returns
§min_latency

address of variable in which to store the configured minimum latency, or None

§max_latency

address of variable in which to store the configured maximum latency, or None

source

fn set_latency( &self, min_latency: ClockTime, max_latency: impl Into<Option<ClockTime>> )

Informs baseclass of encoding latency. If the provided values changed from previously provided ones, this will also post a LATENCY message on the bus so the pipeline can reconfigure its global latency.

§min_latency

minimum latency

§max_latency

maximum latency

source

fn output_state(&self) -> Option<VideoCodecState<'static, Readable>>

Get the current VideoCodecState

§Returns

VideoCodecState describing format of video data.

source

fn set_output_state( &self, caps: Caps, reference: Option<&VideoCodecState<'_, Readable>> ) -> Result<VideoCodecState<'_, InNegotiation<'_>>, FlowError>

Creates a new VideoCodecState with the specified caps as the output state for the encoder. Any previously set output state on self will be replaced by the newly created one.

The specified caps should not contain any resolution, pixel-aspect-ratio, framerate, codec-data, …. Those should be specified instead in the returned VideoCodecState.

If the subclass wishes to copy over existing fields (like pixel aspect ratio, or framerate) from an existing VideoCodecState, it can be provided as a reference.

If the subclass wishes to override some fields from the output state (like pixel-aspect-ratio or framerate) it can do so on the returned VideoCodecState.

The new output state will only take effect (set on pads and buffers) starting from the next call to VideoEncoderExt::finish_frame().

§caps

the gst::Caps to use for the output

§reference

An optional reference VideoCodecState

§Returns

the newly configured output state.

source

fn negotiate<'a>( &'a self, output_state: VideoCodecState<'a, InNegotiation<'a>> ) -> Result<(), FlowError>

Negotiate with downstream elements to currently configured VideoCodecState. Unmark GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if negotiate fails.

§Returns

true if the negotiation succeeded, else false.

source

fn set_headers(&self, headers: impl IntoIterator<Item = Buffer>)

Set the codec headers to be sent downstream whenever requested.

§headers

a list of gst::Buffer containing the codec header

source

fn sink_pad(&self) -> &Pad

source

fn src_pad(&self) -> &Pad

source

fn input_segment(&self) -> Segment

source

fn output_segment(&self) -> Segment

Object Safety§

This trait is not object safe.

Implementors§