Trait gstreamer_video::prelude::VideoEncoderExt
source · pub trait VideoEncoderExt:
IsA<VideoEncoder>
+ Sealed
+ 'static {
Show 14 methods
// Provided methods
fn allocate_output_buffer(&self, size: usize) -> Buffer { ... }
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 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 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.
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 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