mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-27 04:46:54 -05:00
UI: improve aspect ratio handling
As written in the changelog: Live streams formerly worked around a Firefox pixel aspect ratio bug by forcing all videos to 16:9, which dramatically distorted 9:16 camera views. Playback didn't, so anamorphic videos looked correct on Chrome but slightly stretched on Firefox. Now both live streams and playback are fully correct on all browsers.
This commit is contained in:
@@ -29,6 +29,7 @@ libpasta = "0.1.2"
|
||||
log = "0.4"
|
||||
mylog = { git = "https://github.com/scottlamb/mylog" }
|
||||
nix = "0.22.0"
|
||||
num-rational = { version = "0.4.0", default-features = false, features = ["std"] }
|
||||
odds = { version = "0.4.0", features = ["std-vec"] }
|
||||
parking_lot = { version = "0.11.1", features = [] }
|
||||
pretty-hex = "0.2.1"
|
||||
|
||||
@@ -135,6 +135,16 @@ pub struct VideoSampleEntry {
|
||||
pub pasp_v_spacing: u16,
|
||||
}
|
||||
|
||||
impl VideoSampleEntry {
|
||||
/// Returns the aspect ratio as a minimized ratio.
|
||||
pub fn aspect(&self) -> num_rational::Ratio<u32> {
|
||||
num_rational::Ratio::new(
|
||||
u32::from(self.width) * u32::from(self.pasp_h_spacing),
|
||||
u32::from(self.height) * u32::from(self.pasp_v_spacing),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub struct VideoSampleEntryToInsert {
|
||||
pub data: Vec<u8>,
|
||||
|
||||
Reference in New Issue
Block a user