pub struct SampleAspectRatio {
pub num: u32,
pub den: u32,
}Expand description
Reduced pixel-width to pixel-height ratio.
Fields§
§num: u32Ratio numerator.
den: u32Ratio denominator, never zero.
Implementations§
Source§impl SampleAspectRatio
impl SampleAspectRatio
Sourcepub fn new(num: u64, den: u64) -> Option<Self>
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.
Sourcepub fn of_display(visible: (u32, u32), displayed: (u32, u32)) -> Option<Self>
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.