Skip to main content

UnsupportedPixelFormat

Struct UnsupportedPixelFormat 

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

Payload for ConvertError::UnsupportedPixelFormat.

The frame’s pixel format isn’t in the closed CPU-format set this crate supports for safe per-plane access.

§A compact tag, and why it is not a PixelFormat

This payload used to carry the vocabulary’s PixelFormat beside the raw id. mediaframe 0.11 widened that type’s text arm, which made this the biggest arm of ConvertError at 144 bytes — a cost every Result on the convert road pays on its success path. Boxing the format fixed the size and introduced a worse thing: an infallible allocation on the refusal path, so a container-selected unsupported format could abort the process precisely while the converter was trying to report it. An error that says “this is unsupported” must not depend on the allocator agreeing.

So the payload is a tag: the raw AVPixelFormat integer, and libavutil’s own name for it borrowed from the static descriptor table. Twenty-four bytes, no allocation, no lifetime that can dangle — the table outlives the process. The PixelFormat field is gone rather than boxed, and its own documentation is why that costs nothing: it said the vocabulary answer “is deliberately not made to carry the integer: raw and name are where the identity survives”. A caller that wants the vocabulary’s word for a raw id can ask for it; a caller reading an error wants to know which format was refused.

Implementations§

Source§

impl UnsupportedPixelFormat

Source

pub const fn new(raw: i32, name: Option<&'static str>) -> Self

Constructs an UnsupportedPixelFormat payload.

const again, and allocation-free: see the type’s own note.

Source

pub const fn raw(&self) -> i32

The raw AVFrame.format integer, exactly as FFmpeg wrote it.

Present at every tier — it costs one i32 — because it is the only field that is always available and always precise. Without it the message for the fall-through case says None and names nothing at all.

Source

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

FFmpeg’s own name for Self::raw (av_get_pix_fmt_name), when libavutil has one.

None for an integer libavutil does not describe — a corrupt read, or a format from a newer library than the one linked.

Trait Implementations§

Source§

impl Clone for UnsupportedPixelFormat

Source§

fn clone(&self) -> UnsupportedPixelFormat

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 UnsupportedPixelFormat

Source§

impl Debug for UnsupportedPixelFormat

Source§

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

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

impl Display for UnsupportedPixelFormat

Source§

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

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

impl Eq for UnsupportedPixelFormat

Source§

impl PartialEq for UnsupportedPixelFormat

Source§

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

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