Skip to main content

CodecId

Enum CodecId 

Source
#[non_exhaustive]
pub enum CodecId {
Show 20 variants None, H264, Hevc, Opus, Avif, Png, Jpeg, Gif, Webp, Pcm, Vorbis, Flac, Jxl, Aac, Vp9, Av2, Mp3, RawVideo, Subrip, WebVtt,
}
Expand description

Identifier for a specific codec (the what, independent of any particular encoder/decoder implementation).

Marked #[non_exhaustive]: we add codecs over time, and external matchers must handle the open-ended set.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

Sentinel for “no/unknown codec”.

§

H264

H.264 / AVC video.

§

Hevc

H.265 / HEVC video. Decode only.

§

Opus

Opus audio.

§

Avif

AVIF still image (an AV1 intra frame in a HEIF box).

§

Png

PNG still image (DEFLATE-compressed RGB/RGBA).

§

Jpeg

JPEG still image (a.k.a. MJPEG).

§

Gif

GIF image (first frame; palette-based).

§

Webp

WebP image (VP8 / VP8L).

§

Pcm

Linear PCM audio (uncompressed; layout in the stream’s sample format).

§

Vorbis

Vorbis audio (Ogg Vorbis).

§

Flac

FLAC lossless audio.

§

Jxl

JPEG XL image.

§

Aac

AAC audio (Advanced Audio Coding).

§

Vp9

VP9 video.

§

Av2

AV2 video (AOMedia’s successor to AV1). Decode only.

§

Mp3

MP3 audio (MPEG-1/2 Audio Layer III).

§

RawVideo

Raw uncompressed video (planar/packed pixels; layout in the stream’s pixel format). The video analog of CodecId::Pcm.

§

Subrip

SubRip subtitle (.srt): plain-text cues with HH:MM:SS,mmm timing.

§

WebVtt

WebVTT subtitle (.vtt): plain-text cues with HH:MM:SS.mmm timing.

Implementations§

Source§

impl CodecId

Source

pub fn name(self) -> &'static str

Short canonical name, matching the token used on the ffmpeg command line (-c:v h264, -c:a opus, …).

Source

pub fn media_type(self) -> MediaType

The media category this codec produces.

Source

pub fn sample_format_from_name(name: &str) -> Option<SampleFormat>

The sample format a codec NAME pins, when the name carries one.

CodecId is deliberately format-agnostic — pcm_s16le and pcm_f32le are both CodecId::Pcm — but for raw PCM the name IS the format, and dropping it means -c:a pcm_s16le silently writes whatever the decoder happened to emit. Compressed codecs return None: their sample format is an internal detail, not something the CLI name selects.

Source

pub fn from_name(name: &str) -> Option<CodecId>

Look up a codec id from its canonical CLI name.

Trait Implementations§

Source§

impl Clone for CodecId

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 CodecId

Source§

impl Debug for CodecId

Source§

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

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

impl Default for CodecId

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for CodecId

Source§

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

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

impl Eq for CodecId

Source§

impl Hash for CodecId

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 CodecId

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 CodecId

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<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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.