Skip to main content

SampleAspectRatio

Struct SampleAspectRatio 

Source
pub struct SampleAspectRatio {
    pub num: u32,
    pub den: u32,
}
Expand description

Reduced pixel-width to pixel-height ratio.

Fields§

§num: u32

Ratio numerator.

§den: u32

Ratio denominator, never zero.

Implementations§

Source§

impl SampleAspectRatio

Source

pub fn new(num: u64, den: u64) -> Option<Self>

The ratio num:den in lowest terms, or None for a ratio with a zero term, which declares nothing (FFmpeg writes an unknown ratio as 0/1) or does not fit.

Source

pub fn of_display(visible: (u32, u32), displayed: (u32, u32)) -> Option<Self>

The ratio of the pixels of a visible picture shown at displayed size (width, height), as a WebCodecs frame’s display size says it.

A display size is the stored size with one side stretched by the ratio and rounded to whole pixels, so it cannot say the ratio exactly (128x96 of 4:3 pixels shows 171x96, not 170 2/3). The ratio is the simplest fraction that rounds to that size, which is the declared one wherever a declared ratio’s terms are small (4:3, 64:45, 10:11), and otherwise within half a displayed pixel of the size.

Source

pub fn square_pixel_size(self, width: u32, height: u32) -> (u32, u32)

The size a stored width x height picture of these pixels is shown at in square pixels, as a browser demuxer reports it: the side the pixels are longer along stretched, rounded half up.

Trait Implementations§

Source§

impl Clone for SampleAspectRatio

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 SampleAspectRatio

Source§

impl Debug for SampleAspectRatio

Source§

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

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

impl Default for SampleAspectRatio

Source§

fn default() -> Self

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

impl Eq for SampleAspectRatio

Source§

impl PartialEq for SampleAspectRatio

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 SampleAspectRatio

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