pub enum DurationSource {
FromPts,
FromStream,
FromBitrate,
Unknown,
}Expand description
How the demuxing library came by a container-level duration, in the library’s own three words and no others.
The arms are libavformat’s AVDurationEstimationMethod, verbatim.
Each names what libavformat did to produce the figure; none says
that a header declares it, and none should be read as if it did.
Which to trust, and how far, is the consumer’s call — this type
reports and does not rank.
The figure these arms account for is a length, and a
MeasuredEnd is an endpoint on a track’s timeline: different
quantities, which this type does not set against each other.
Carried by ContainerDuration, so the account travels with the
figure.
Variants§
FromPts
AVFMT_DURATION_FROM_PTS. libavformat’s words: “Duration
accurately estimated from PTSes”.
libavformat estimated the duration from packet timestamps — for an MPEG program or transport stream, the ones at the tail of the file. An estimate made from timestamps, and one libavformat itself calls accurate. This arm’s value is zero, which is also what the field holds until libavformat sets it, so the label alone does not prove that packets were read.
FromStream
AVFMT_DURATION_FROM_STREAM. libavformat’s words: “Duration
estimated from a stream with a known duration”.
libavformat took the figure from a stream’s duration or from the container’s own duration field, and the label does not say which: it is reported for Matroska too, where the figure is the container’s own field and no stream has one. It is not a declaration by the file — a format’s reader may compute a stream’s duration from other fields rather than read it, and this label covers that as well.
FromBitrate
AVFMT_DURATION_FROM_BITRATE. libavformat’s words: “Duration
estimated from bitrate (less accurate)”.
libavformat divided the file’s size by a bitrate, and says itself that this is the less accurate way: it is exact only for a constant bitrate over a file that is all media.
Unknown
An account this build cannot name: libavformat recorded a method it has no word for here, or the backend has a figure and no account of how it was reached. Nothing is claimed about the figure, and it is not folded into an estimate.
Implementations§
Source§impl DurationSource
impl DurationSource
Sourcepub const fn is_from_pts(&self) -> bool
pub const fn is_from_pts(&self) -> bool
Returns true if this value is of type FromPts. Returns false otherwise
Sourcepub const fn is_from_stream(&self) -> bool
pub const fn is_from_stream(&self) -> bool
Returns true if this value is of type FromStream. Returns false otherwise
Sourcepub const fn is_from_bitrate(&self) -> bool
pub const fn is_from_bitrate(&self) -> bool
Returns true if this value is of type FromBitrate. Returns false otherwise
Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if this value is of type Unknown. Returns false otherwise