Skip to main content

ContainerFormat

Struct ContainerFormat 

Source
pub struct ContainerFormat { /* private fields */ }
Expand description

The container identification libavformat made for a session.

§This is the DEMUXER’s identity, not a filename’s

It is AVInputFormat’s own words — what libavformat concluded from the bytes, having probed them. That is precisely what a content-addressed row wants and what an extension cannot give: the same bytes at movie.mov and movie.mp4 are one content, and this answers identically for both because it never looked at the path.

§One demuxer, several words — and name is the list

FFmpeg registers one demuxer per family, so its name is a comma-separated list of the short names that family handles: "mov,mp4,m4a,3gp,3g2,mj2" for the ISOBMFF demuxer, "matroska,webm" for Matroska. name is that string verbatim and names walks it.

The list does not narrow to one word, and this type does not pretend it does. libavformat identified the demuxer; which brand inside that family a file is — an .mp4 against an .m4a — is a question it did not answer and one nothing here can answer for it. A door that returned a single word would have had to pick, and a pick is the guess this whole seat exists to avoid.

§Crossing into a typed vocabulary

The words are FFmpeg’s own slugs, which is what makes them crossable: a consumer that wants mediaframe::container::Format tries names against its FromStr and takes what it recognises, deciding for itself what to do when a family offers several. This crate stays out of that decision — the fold belongs to whoever owns the vocabulary, and doing it here would put a second one somewhere a caller cannot see it.

§An open vocabulary

Never an enum. A container FFmpeg learns to demux in its next release names itself here with nothing to change on this side, which is the whole reason the identity is carried as text.

Implementations§

Source§

impl ContainerFormat

Source

pub const fn new(name: SmolStr, long_name: Option<SmolStr>) -> Self

Constructs a ContainerFormat from a demuxer’s short-name list and its optional description.

Public so a consumer can build the value in a test or a fake; a session builds its own from AVFormatContext.iformat.

Source

pub fn name(&self) -> &str

The demuxer’s short-name list, verbatim — "mov,mp4,m4a,3gp,3g2,mj2".

See names for the words in it.

Source

pub fn long_name(&self) -> Option<&str>

The demuxer’s human description — "QuickTime / MOV" — or None where the table carries none.

FFmpeg’s prose, for display. It is not stable across releases and nothing should key on it.

Source

pub fn names(&self) -> impl Iterator<Item = &str>

The short names in name, in the order the demuxer lists them.

Every FFmpeg name is a non-empty word or a comma list of them, so this yields at least one item for any format a session opened with.

Trait Implementations§

Source§

impl Clone for ContainerFormat

Source§

fn clone(&self) -> ContainerFormat

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 Debug for ContainerFormat

Source§

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

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

impl Eq for ContainerFormat

Source§

impl Hash for ContainerFormat

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 ContainerFormat

Source§

fn eq(&self, other: &ContainerFormat) -> 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 ContainerFormat

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more