Skip to main content

ImageFrameExtra

Struct ImageFrameExtra 

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

Per-ImageFrame extras — cover art, an embedded thumbnail, a poster frame.

One seat, deliberately. This household is minimal at birth because a still image’s AVFrame carries almost nothing a motion frame’s does: no picture type, no field order, no best-effort timestamp, no SAR worth a seat. What it does carry is side data, and that is what is here.

EXIF orientation takes a seat here, read off the frame’s AV_FRAME_DATA_DISPLAYMATRIX side data — see ImageOrientation for the measurement that establishes that road, and for why an earlier reading of libavcodec (which put orientation in AVFrame.metadata) was wrong about where it arrives.

An ICC profile arrives as side data too (AV_FRAME_DATA_ICC_PROFILE) and does not get a seat: it is a payload, not a fact — kilobytes of colour transform this crate has no vocabulary for and no business parsing. Self::side_data carries it unparsed and whole for a consumer that does. That is the line: a fact a picture cannot be displayed correctly without is typed; a payload only a specialist reads rides raw.

Implementations§

Source§

impl ImageFrameExtra

Source

pub const fn new() -> Self

Constructs an ImageFrameExtra with no orientation and no side data.

Source

pub const fn orientation(&self) -> Option<ImageOrientation>

How the picture should be turned for display, when the file said.

None means the frame carried no display matrix — the ordinary case for a still with no EXIF orientation tag, and also what an out-of-range tag produces, because libavcodec emits no matrix for one. A malformed matrix (not nine int32_t) is None too. In every one of those cases the raw entry, if there was one, is still in Self::side_data.

A consumer that ignores this displays a sideways photograph.

Source

pub fn side_data(&self) -> &[SideDataEntry]

Returns the raw side-data entries from AVFrame.side_dataAV_FRAME_DATA_ICC_PROFILE and the display matrix among them.

Source

pub const fn with_orientation(self, value: Option<ImageOrientation>) -> Self

Sets the orientation (consuming builder).

Source

pub fn with_side_data(self, value: Vec<SideDataEntry>) -> Self

Sets the side-data list (consuming builder).

Source

pub const fn set_orientation( &mut self, value: Option<ImageOrientation>, ) -> &mut Self

Sets the orientation in place.

Source

pub fn set_side_data(&mut self, value: Vec<SideDataEntry>) -> &mut Self

Sets the side-data list in place.

Trait Implementations§

Source§

impl Clone for ImageFrameExtra

Source§

fn clone(&self) -> ImageFrameExtra

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 ImageFrameExtra

Source§

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

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

impl Default for ImageFrameExtra

Source§

fn default() -> ImageFrameExtra

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

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