pub trait VideoEncoderExt: IsA<VideoEncoder> + 'static {
Show 16 methods
// Provided methods
fn allocate_output_buffer(&self, size: usize) -> Buffer { ... }
fn drop_frame(&self, frame: VideoCodecFrame<'_>) { ... }
fn finish_frame(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError> { ... }
fn max_encode_time(&self, frame: &VideoCodecFrame<'_>) -> ClockTimeDiff { ... }
fn min_force_key_unit_interval(&self) -> Option<ClockTime> { ... }
fn is_qos_enabled(&self) -> bool { ... }
fn merge_tags(&self, tags: Option<&TagList>, mode: TagMergeMode) { ... }
fn proxy_getcaps(&self, caps: Option<&Caps>, filter: Option<&Caps>) -> Caps { ... }
fn release_frame(&self, frame: VideoCodecFrame<'_>) { ... }
fn set_min_force_key_unit_interval(
&self,
interval: impl Into<Option<ClockTime>>,
) { ... }
fn set_min_pts(&self, min_pts: impl Into<Option<ClockTime>>) { ... }
fn set_qos_enabled(&self, enabled: bool) { ... }
fn is_qos(&self) -> bool { ... }
fn set_qos(&self, qos: bool) { ... }
fn connect_min_force_key_unit_interval_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
Sourcefn allocate_output_buffer(&self, size: usize) -> Buffer
fn allocate_output_buffer(&self, size: usize) -> Buffer
Helper function that allocates a buffer to hold an encoded video frame
for self
’s current VideoCodecState
.
§size
size of the buffer
§Returns
allocated buffer
Sourcefn drop_frame(&self, frame: VideoCodecFrame<'_>)
fn drop_frame(&self, frame: VideoCodecFrame<'_>)
Removes frame
from the list of pending frames, releases it
and posts a QoS message with the frame’s details on the bus.
Similar to calling finish_frame()
without a buffer
attached to frame
, but this function additionally stores events
from frame
as pending, to be pushed out alongside the next frame
submitted via finish_frame()
.
§frame
Sourcefn finish_frame(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError>
fn finish_frame( &self, frame: VideoCodecFrame<'_>, ) -> Result<FlowSuccess, FlowError>
frame
must have a valid encoded data buffer, whose metadata fields
are then appropriately set according to frame data or no buffer at
all if the frame should be dropped.
It is subsequently pushed downstream or provided to pre_push
.
In any case, the frame is considered finished and released.
If frame
does not have a buffer attached, it will be dropped, and
a QoS message will be posted on the bus. Events from frame
will be
pushed out immediately.
After calling this function the output buffer of the frame is to be considered read-only. This function will also change the metadata of the buffer.
§frame
an encoded VideoCodecFrame
§Returns
a gst::FlowReturn
resulting from sending data downstream
Sourcefn max_encode_time(&self, frame: &VideoCodecFrame<'_>) -> ClockTimeDiff
fn max_encode_time(&self, frame: &VideoCodecFrame<'_>) -> ClockTimeDiff
Determines maximum possible encoding time for frame
that will
allow it to encode and arrive in time (as determined by QoS events).
In particular, a negative result means encoding in time is no longer possible
and should therefore occur as soon/skippy as possible.
If no QoS events have been received from downstream, or if
qos
is disabled this function returns G_MAXINT64
.
§frame
§Returns
max decoding time.
Sourcefn min_force_key_unit_interval(&self) -> Option<ClockTime>
fn min_force_key_unit_interval(&self) -> Option<ClockTime>
Returns the minimum force-keyunit interval, see set_min_force_key_unit_interval()
for more details.
§Returns
the minimum force-keyunit interval
Sourcefn is_qos_enabled(&self) -> bool
fn is_qos_enabled(&self) -> bool
Sets the video encoder tags and how they should be merged with any
upstream stream tags. This will override any tags previously-set
with merge_tags()
.
Note that this is provided for convenience, and the subclass is not required to use this and can still do tag handling on its own.
MT safe.
§tags
a gst::TagList
to merge, or NULL to unset
previously-set tags
§mode
the gst::TagMergeMode
to use, usually gst::TagMergeMode::Replace
Sourcefn release_frame(&self, frame: VideoCodecFrame<'_>)
fn release_frame(&self, frame: VideoCodecFrame<'_>)
Removes frame
from list of pending frames and releases it, similar
to calling finish_frame()
without a buffer attached
to the frame, but does not post a QoS message or do any additional
processing. Events from frame
are moved to the pending events list.
§frame
Sourcefn set_min_force_key_unit_interval(
&self,
interval: impl Into<Option<ClockTime>>,
)
fn set_min_force_key_unit_interval( &self, interval: impl Into<Option<ClockTime>>, )
Sets the minimum interval for requesting keyframes based on force-keyunit
events. Setting this to 0 will allow to handle every event, setting this to
GST_CLOCK_TIME_NONE
causes force-keyunit events to be ignored.
§interval
minimum interval
Sourcefn set_min_pts(&self, min_pts: impl Into<Option<ClockTime>>)
fn set_min_pts(&self, min_pts: impl Into<Option<ClockTime>>)
Request minimal value for PTS passed to handle_frame.
For streams with reordered frames this can be used to ensure that there is enough time to accommodate first DTS, which may be less than first PTS
§min_pts
minimal PTS that will be passed to handle_frame
Sourcefn set_qos_enabled(&self, enabled: bool)
fn set_qos_enabled(&self, enabled: bool)
fn is_qos(&self) -> bool
fn set_qos(&self, qos: bool)
fn connect_min_force_key_unit_interval_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.