Skip to main content

DurationSource

Enum DurationSource 

Source
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

Source

pub const fn is_from_pts(&self) -> bool

Returns true if this value is of type FromPts. Returns false otherwise

Source

pub const fn is_from_stream(&self) -> bool

Returns true if this value is of type FromStream. Returns false otherwise

Source

pub const fn is_from_bitrate(&self) -> bool

Returns true if this value is of type FromBitrate. Returns false otherwise

Source

pub const fn is_unknown(&self) -> bool

Returns true if this value is of type Unknown. Returns false otherwise

Trait Implementations§

Source§

impl Clone for DurationSource

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DurationSource

Source§

impl Debug for DurationSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DurationSource

Source§

impl Hash for DurationSource

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DurationSource

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DurationSource

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.