Trait gstreamer_base::prelude::BaseParseExt
source · pub trait BaseParseExt: IsA<BaseParse> + Sealed + 'static {
Show 15 methods
// Provided methods
fn add_index_entry(
&self,
offset: u64,
ts: ClockTime,
key: bool,
force: bool,
) -> bool { ... }
fn drain(&self) { ... }
fn merge_tags(&self, tags: Option<&TagList>, mode: TagMergeMode) { ... }
fn set_average_bitrate(&self, bitrate: u32) { ... }
fn set_has_timing_info(&self, has_timing: bool) { ... }
fn set_infer_ts(&self, infer_ts: bool) { ... }
fn set_latency(
&self,
min_latency: ClockTime,
max_latency: impl Into<Option<ClockTime>>,
) { ... }
fn set_min_frame_size(&self, min_size: u32) { ... }
fn set_passthrough(&self, passthrough: bool) { ... }
fn set_pts_interpolation(&self, pts_interpolate: bool) { ... }
fn set_syncable(&self, syncable: bool) { ... }
fn set_ts_at_offset(&self, offset: usize) { ... }
fn is_disable_passthrough(&self) -> bool { ... }
fn set_disable_passthrough(&self, disable_passthrough: bool) { ... }
fn connect_disable_passthrough_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Provided Methods§
sourcefn add_index_entry(
&self,
offset: u64,
ts: ClockTime,
key: bool,
force: bool,
) -> bool
fn add_index_entry( &self, offset: u64, ts: ClockTime, key: bool, force: bool, ) -> bool
Adds an entry to the index associating offset
to ts
. It is recommended
to only add keyframe entries. force
allows to bypass checks, such as
whether the stream is (upstream) seekable, another entry is already “close”
to the new entry, etc.
§offset
offset of entry
§ts
timestamp associated with offset
§key
whether entry refers to keyframe
§force
add entry disregarding sanity checks
§Returns
gboolean
indicating whether entry was added
sourcefn drain(&self)
fn drain(&self)
Drains the adapter until it is empty. It decreases the min_frame_size to match the current adapter size and calls chain method until the adapter is emptied or chain returns with error.
Sets the parser subclass’s 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.
§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_average_bitrate(&self, bitrate: u32)
fn set_average_bitrate(&self, bitrate: u32)
Optionally sets the average bitrate detected in media (if non-zero), e.g. based on metadata, as it will be posted to the application.
By default, announced average bitrate is estimated. The average bitrate
is used to estimate the total duration of the stream and to estimate
a seek position, if there’s no index and the format is syncable
(see set_syncable()
).
§bitrate
average bitrate in bits/second
sourcefn set_has_timing_info(&self, has_timing: bool)
fn set_has_timing_info(&self, has_timing: bool)
Set if frames carry timing information which the subclass can (generally) parse and provide. In particular, intrinsic (rather than estimated) time can be obtained following a seek.
§has_timing
whether frames carry timing information
sourcefn set_infer_ts(&self, infer_ts: bool)
fn set_infer_ts(&self, infer_ts: bool)
sourcefn set_latency(
&self,
min_latency: ClockTime,
max_latency: impl Into<Option<ClockTime>>,
)
fn set_latency( &self, min_latency: ClockTime, max_latency: impl Into<Option<ClockTime>>, )
Sets the minimum and maximum (which may likely be equal) latency introduced by the parsing process. If there is such a latency, which depends on the particular parsing of the format, it typically corresponds to 1 frame duration.
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 parse latency
§max_latency
maximum parse latency
sourcefn set_min_frame_size(&self, min_size: u32)
fn set_min_frame_size(&self, min_size: u32)
Subclass can use this function to tell the base class that it needs to
be given buffers of at least min_size
bytes.
§min_size
Minimum size in bytes of the data that this base class should give to subclass.
sourcefn set_passthrough(&self, passthrough: bool)
fn set_passthrough(&self, passthrough: bool)
Set if the nature of the format or configuration does not allow (much)
parsing, and the parser should operate in passthrough mode (which only
applies when operating in push mode). That is, incoming buffers are
pushed through unmodified, i.e. no GstBaseParseClass::handle_frame
will be invoked, but GstBaseParseClass::pre_push_frame
will still be
invoked, so subclass can perform as much or as little is appropriate for
passthrough semantics in GstBaseParseClass::pre_push_frame
.
§passthrough
true
if parser should run in passthrough mode
sourcefn set_pts_interpolation(&self, pts_interpolate: bool)
fn set_pts_interpolation(&self, pts_interpolate: bool)
By default, the base class will guess PTS timestamps using a simple interpolation (previous timestamp + duration), which is incorrect for data streams with reordering, where PTS can go backward. Sub-classes implementing such formats should disable PTS interpolation.
§pts_interpolate
true
if parser should interpolate PTS timestamps
sourcefn set_syncable(&self, syncable: bool)
fn set_syncable(&self, syncable: bool)
Set if frame starts can be identified. This is set by default and determines whether seeking based on bitrate averages is possible for a format/stream.
§syncable
set if frame starts can be identified
sourcefn set_ts_at_offset(&self, offset: usize)
fn set_ts_at_offset(&self, offset: usize)
This function should only be called from a handle_frame
implementation.
BaseParse
creates initial timestamps for frames by using the last
timestamp seen in the stream before the frame starts. In certain
cases, the correct timestamps will occur in the stream after the
start of the frame, but before the start of the actual picture data.
This function can be used to set the timestamps based on the offset
into the frame data that the picture starts.
§offset
offset into current buffer
sourcefn is_disable_passthrough(&self) -> bool
fn is_disable_passthrough(&self) -> bool
If set to true
, baseparse will unconditionally force parsing of the
incoming data. This can be required in the rare cases where the incoming
side-data (caps, pts, dts, …) is not trusted by the user and wants to
force validation and parsing of the incoming data.
If set to false
, decision of whether to parse the data or not is up to
the implementation (standard behaviour).
sourcefn set_disable_passthrough(&self, disable_passthrough: bool)
fn set_disable_passthrough(&self, disable_passthrough: bool)
If set to true
, baseparse will unconditionally force parsing of the
incoming data. This can be required in the rare cases where the incoming
side-data (caps, pts, dts, …) is not trusted by the user and wants to
force validation and parsing of the incoming data.
If set to false
, decision of whether to parse the data or not is up to
the implementation (standard behaviour).