Trait gstreamer_video::prelude::VideoDecoderExt
source · pub trait VideoDecoderExt:
IsA<VideoDecoder>
+ Sealed
+ 'static {
Show 45 methods
// Provided methods
fn add_to_frame(&self, n_bytes: i32) { ... }
fn allocate_output_buffer(&self) -> Result<Buffer, BoolError> { ... }
fn drop_frame(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError> { ... }
fn drop_subframe(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError> { ... }
fn finish_frame(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError> { ... }
fn finish_subframe(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError> { ... }
fn buffer_pool(&self) -> Option<BufferPool> { ... }
fn estimate_rate(&self) -> i32 { ... }
fn max_decode_time(&self, frame: &VideoCodecFrame<'_>) -> ClockTimeDiff { ... }
fn max_errors(&self) -> i32 { ... }
fn needs_format(&self) -> bool { ... }
fn needs_sync_point(&self) -> bool { ... }
fn is_packetized(&self) -> bool { ... }
fn pending_frame_size(&self) -> usize { ... }
fn qos_proportion(&self) -> f64 { ... }
fn is_subframe_mode(&self) -> bool { ... }
fn have_frame(&self) -> Result<FlowSuccess, FlowError> { ... }
fn have_last_subframe(
&self,
frame: &VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError> { ... }
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 request_sync_point(
&self,
frame: &VideoCodecFrame<'_>,
flags: VideoDecoderRequestSyncPointFlags,
) { ... }
fn set_estimate_rate(&self, enabled: bool) { ... }
fn set_max_errors(&self, num: i32) { ... }
fn set_needs_format(&self, enabled: bool) { ... }
fn set_needs_sync_point(&self, enabled: bool) { ... }
fn set_packetized(&self, packetized: bool) { ... }
fn set_subframe_mode(&self, subframe_mode: bool) { ... }
fn set_use_default_pad_acceptcaps(&self, use_: bool) { ... }
fn automatic_request_sync_point_flags(
&self,
) -> VideoDecoderRequestSyncPointFlags { ... }
fn set_automatic_request_sync_point_flags(
&self,
automatic_request_sync_point_flags: VideoDecoderRequestSyncPointFlags,
) { ... }
fn is_automatic_request_sync_points(&self) -> bool { ... }
fn set_automatic_request_sync_points(
&self,
automatic_request_sync_points: bool,
) { ... }
fn is_discard_corrupted_frames(&self) -> bool { ... }
fn set_discard_corrupted_frames(&self, discard_corrupted_frames: bool) { ... }
fn min_force_key_unit_interval(&self) -> u64 { ... }
fn set_min_force_key_unit_interval(&self, min_force_key_unit_interval: u64) { ... }
fn is_qos(&self) -> bool { ... }
fn set_qos(&self, qos: bool) { ... }
fn connect_automatic_request_sync_point_flags_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_automatic_request_sync_points_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_discard_corrupted_frames_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_max_errors_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
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 add_to_frame(&self, n_bytes: i32)
fn add_to_frame(&self, n_bytes: i32)
Removes next n_bytes
of input data and adds it to currently parsed frame.
§n_bytes
the number of bytes to add
sourcefn allocate_output_buffer(&self) -> Result<Buffer, BoolError>
fn allocate_output_buffer(&self) -> Result<Buffer, BoolError>
Helper function that allocates a buffer to hold a video frame for self
’s
current VideoCodecState
.
You should use VideoDecoderExtManual::allocate_output_frame()
instead of this
function, if possible at all.
§Returns
allocated buffer, or NULL if no buffer could be allocated (e.g. when downstream is flushing or shutting down)
sourcefn drop_frame(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError>
fn drop_frame( &self, frame: VideoCodecFrame<'_>, ) -> Result<FlowSuccess, FlowError>
Similar to finish_frame()
, but drops frame
in any
case and posts a QoS message with the frame’s details on the bus.
In any case, the frame is considered finished and released.
§frame
the VideoCodecFrame
to drop
§Returns
a gst::FlowReturn
, usually GST_FLOW_OK.
sourcefn drop_subframe(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError>
fn drop_subframe( &self, frame: VideoCodecFrame<'_>, ) -> Result<FlowSuccess, FlowError>
Drops input data. The frame is not considered finished until the whole frame is finished or dropped by the subclass.
§frame
the VideoCodecFrame
§Returns
a gst::FlowReturn
, usually GST_FLOW_OK.
sourcefn finish_frame(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError>
fn finish_frame( &self, frame: VideoCodecFrame<'_>, ) -> Result<FlowSuccess, FlowError>
frame
should have a valid decoded data buffer, whose metadata fields
are then appropriately set according to frame data and pushed downstream.
If no output data is provided, frame
is considered skipped.
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
a decoded VideoCodecFrame
§Returns
a gst::FlowReturn
resulting from sending data downstream
sourcefn finish_subframe(
&self,
frame: VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError>
fn finish_subframe( &self, frame: VideoCodecFrame<'_>, ) -> Result<FlowSuccess, FlowError>
Indicate that a subframe has been finished to be decoded
by the subclass. This method should be called for all subframes
except the last subframe where finish_frame()
should be called instead.
§frame
the VideoCodecFrame
§Returns
a gst::FlowReturn
, usually GST_FLOW_OK.
sourcefn buffer_pool(&self) -> Option<BufferPool>
fn buffer_pool(&self) -> Option<BufferPool>
§Returns
the instance of the gst::BufferPool
used
by the decoder; free it after use it
sourcefn estimate_rate(&self) -> i32
fn estimate_rate(&self) -> i32
§Returns
currently configured byte to time conversion setting
sourcefn max_decode_time(&self, frame: &VideoCodecFrame<'_>) -> ClockTimeDiff
fn max_decode_time(&self, frame: &VideoCodecFrame<'_>) -> ClockTimeDiff
sourcefn max_errors(&self) -> i32
fn max_errors(&self) -> i32
§Returns
currently configured decoder tolerated error count.
sourcefn needs_format(&self) -> bool
fn needs_format(&self) -> bool
sourcefn needs_sync_point(&self) -> bool
fn needs_sync_point(&self) -> bool
sourcefn is_packetized(&self) -> bool
fn is_packetized(&self) -> bool
Queries whether input data is considered packetized or not by the base class.
§Returns
TRUE if input data is considered packetized.
sourcefn pending_frame_size(&self) -> usize
fn pending_frame_size(&self) -> usize
Returns the number of bytes previously added to the current frame
by calling add_to_frame()
.
§Returns
The number of bytes pending for the current frame
sourcefn qos_proportion(&self) -> f64
fn qos_proportion(&self) -> f64
§Returns
The current QoS proportion.
sourcefn is_subframe_mode(&self) -> bool
fn is_subframe_mode(&self) -> bool
Queries whether input data is considered as subframes or not by the base class. If FALSE, each input buffer will be considered as a full frame.
§Returns
TRUE if input data is considered as sub frames.
sourcefn have_frame(&self) -> Result<FlowSuccess, FlowError>
fn have_frame(&self) -> Result<FlowSuccess, FlowError>
Gathers all data collected for currently parsed frame, gathers corresponding
metadata and passes it along for further processing, i.e. handle_frame
.
§Returns
sourcefn have_last_subframe(
&self,
frame: &VideoCodecFrame<'_>,
) -> Result<FlowSuccess, FlowError>
fn have_last_subframe( &self, frame: &VideoCodecFrame<'_>, ) -> Result<FlowSuccess, FlowError>
Indicates that the last subframe has been processed by the decoder
in frame
. This will release the current frame in video decoder
allowing to receive new frames from upstream elements. This method
must be called in the subclass handle_frame
callback.
§frame
the VideoCodecFrame
to update
§Returns
a gst::FlowReturn
, usually GST_FLOW_OK.
Sets the audio decoder tags and how they should be merged with any
upstream stream tags. This will override any tags previously-set
with gst_audio_decoder_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<'_>)
Similar to drop_frame()
, but simply releases frame
without any processing other than removing it from list of pending frames,
after which it is considered finished and released.
§frame
the VideoCodecFrame
to release
sourcefn request_sync_point(
&self,
frame: &VideoCodecFrame<'_>,
flags: VideoDecoderRequestSyncPointFlags,
)
fn request_sync_point( &self, frame: &VideoCodecFrame<'_>, flags: VideoDecoderRequestSyncPointFlags, )
Allows the VideoDecoder
subclass to request from the base class that
a new sync should be requested from upstream, and that frame
was the frame
when the subclass noticed that a new sync point is required. A reason for
the subclass to do this could be missing reference frames, for example.
The base class will then request a new sync point from upstream as long as
the time that passed since the last one is exceeding
min-force-key-unit-interval
.
The subclass can signal via flags
how the frames until the next sync point
should be handled:
- If
VideoDecoderRequestSyncPointFlags::DISCARD_INPUT
is selected then all following input frames until the next sync point are discarded. This can be useful if the lack of a sync point will prevent all further decoding and the decoder implementation is not very robust in handling missing references frames. - If
VideoDecoderRequestSyncPointFlags::CORRUPT_OUTPUT
is selected then all output frames followingframe
are marked as corrupted viaGST_BUFFER_FLAG_CORRUPTED
. Corrupted frames can be automatically dropped by the base class, seediscard-corrupted-frames
. Subclasses can manually mark frames as corrupted viaVideoCodecFrameFlags::CORRUPTED
before callingfinish_frame()
.
§frame
§flags
sourcefn set_estimate_rate(&self, enabled: bool)
fn set_estimate_rate(&self, enabled: bool)
Allows baseclass to perform byte to time estimated conversion.
§enabled
whether to enable byte to time conversion
sourcefn set_max_errors(&self, num: i32)
fn set_max_errors(&self, num: i32)
Sets numbers of tolerated decoder errors, where a tolerated one is then only warned about, but more than tolerated will lead to fatal error. You can set -1 for never returning fatal errors. Default is set to GST_VIDEO_DECODER_MAX_ERRORS.
The ‘-1’ option was added in 1.4
§num
max tolerated errors
sourcefn set_needs_format(&self, enabled: bool)
fn set_needs_format(&self, enabled: bool)
Configures decoder format needs. If enabled, subclass needs to be negotiated with format caps before it can process any data. It will then never be handed any data before it has been configured. Otherwise, it might be handed data without having been configured and is then expected being able to do so either by default or based on the input data.
§enabled
new state
sourcefn set_needs_sync_point(&self, enabled: bool)
fn set_needs_sync_point(&self, enabled: bool)
Configures whether the decoder requires a sync point before it starts outputting data in the beginning. If enabled, the base class will discard all non-sync point frames in the beginning and after a flush and does not pass it to the subclass.
If the first frame is not a sync point, the base class will request a sync point via the force-key-unit event.
§enabled
new state
sourcefn set_packetized(&self, packetized: bool)
fn set_packetized(&self, packetized: bool)
Allows baseclass to consider input data as packetized or not. If the
input is packetized, then the parse
method will not be called.
§packetized
whether the input data should be considered as packetized.
sourcefn set_subframe_mode(&self, subframe_mode: bool)
fn set_subframe_mode(&self, subframe_mode: bool)
If this is set to TRUE, it informs the base class that the subclass can receive the data at a granularity lower than one frame.
Note that in this mode, the subclass has two options. It can either
require the presence of a GST_VIDEO_BUFFER_FLAG_MARKER to mark the
end of a frame. Or it can operate in such a way that it will decode
a single frame at a time. In this second case, every buffer that
arrives to the element is considered part of the same frame until
finish_frame()
is called.
In either case, the same VideoCodecFrame
will be passed to the
GstVideoDecoderClass:handle_frame vmethod repeatedly with a
different GstVideoCodecFrame:input_buffer every time until the end of the
frame has been signaled using either method.
This method must be called during the decoder subclass set_format
call.
§subframe_mode
whether the input data should be considered as subframes.
sourcefn set_use_default_pad_acceptcaps(&self, use_: bool)
fn set_use_default_pad_acceptcaps(&self, use_: bool)
Lets VideoDecoder
sub-classes decide if they want the sink pad
to use the default pad query handler to reply to accept-caps queries.
By setting this to true it is possible to further customize the default
handler with GST_PAD_SET_ACCEPT_INTERSECT
and
GST_PAD_SET_ACCEPT_TEMPLATE
§use_
if the default pad accept-caps query handling should be used
sourcefn automatic_request_sync_point_flags(
&self,
) -> VideoDecoderRequestSyncPointFlags
fn automatic_request_sync_point_flags( &self, ) -> VideoDecoderRequestSyncPointFlags
GstVideoDecoderRequestSyncPointFlags to use for the automatically
requested sync points if automatic-request-sync-points
is enabled.
sourcefn set_automatic_request_sync_point_flags(
&self,
automatic_request_sync_point_flags: VideoDecoderRequestSyncPointFlags,
)
fn set_automatic_request_sync_point_flags( &self, automatic_request_sync_point_flags: VideoDecoderRequestSyncPointFlags, )
GstVideoDecoderRequestSyncPointFlags to use for the automatically
requested sync points if automatic-request-sync-points
is enabled.
sourcefn is_automatic_request_sync_points(&self) -> bool
fn is_automatic_request_sync_points(&self) -> bool
If set to true
the decoder will automatically request sync points when
it seems like a good idea, e.g. if the first frames are not key frames or
if packet loss was reported by upstream.
sourcefn set_automatic_request_sync_points(&self, automatic_request_sync_points: bool)
fn set_automatic_request_sync_points(&self, automatic_request_sync_points: bool)
If set to true
the decoder will automatically request sync points when
it seems like a good idea, e.g. if the first frames are not key frames or
if packet loss was reported by upstream.
sourcefn is_discard_corrupted_frames(&self) -> bool
fn is_discard_corrupted_frames(&self) -> bool
If set to true
the decoder will discard frames that are marked as
corrupted instead of outputting them.
sourcefn set_discard_corrupted_frames(&self, discard_corrupted_frames: bool)
fn set_discard_corrupted_frames(&self, discard_corrupted_frames: bool)
If set to true
the decoder will discard frames that are marked as
corrupted instead of outputting them.
sourcefn min_force_key_unit_interval(&self) -> u64
fn min_force_key_unit_interval(&self) -> u64
Minimum interval between force-key-unit events sent upstream by the
decoder. Setting this to 0 will cause every event to be handled, setting
this to GST_CLOCK_TIME_NONE
will cause every event to be ignored.
See gst_video_event_new_upstream_force_key_unit()
for more details about
force-key-unit events.
sourcefn set_min_force_key_unit_interval(&self, min_force_key_unit_interval: u64)
fn set_min_force_key_unit_interval(&self, min_force_key_unit_interval: u64)
Minimum interval between force-key-unit events sent upstream by the
decoder. Setting this to 0 will cause every event to be handled, setting
this to GST_CLOCK_TIME_NONE
will cause every event to be ignored.
See gst_video_event_new_upstream_force_key_unit()
for more details about
force-key-unit events.
sourcefn is_qos(&self) -> bool
fn is_qos(&self) -> bool
If set to true
the decoder will handle QoS events received
from downstream elements.
This includes dropping output frames which are detected as late
using the metrics reported by those events.
sourcefn set_qos(&self, qos: bool)
fn set_qos(&self, qos: bool)
If set to true
the decoder will handle QoS events received
from downstream elements.
This includes dropping output frames which are detected as late
using the metrics reported by those events.