From 6570edcc7ac76986030f5225dcfb1957962b8671 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 5 Oct 2021 15:58:47 +0200 Subject: [PATCH 1/1] avi: take into account the original orientation for raw video --- nihav-commonfmt/src/demuxers/avi.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nihav-commonfmt/src/demuxers/avi.rs b/nihav-commonfmt/src/demuxers/avi.rs index 3e372e0..3e49be0 100644 --- a/nihav-commonfmt/src/demuxers/avi.rs +++ b/nihav-commonfmt/src/demuxers/avi.rs @@ -424,7 +424,7 @@ fn parse_strf_vids(dmx: &mut AVIDemuxer, strmgr: &mut StreamManager, size: usize let format = if bitcount > 8 { RGB24_FORMAT } else { PAL8_FORMAT }; let mut vhdr = NAVideoInfo::new(width as usize, if flip { -height as usize } else { height as usize}, flip, format); vhdr.bits = (planes as u8) * (bitcount as u8); - let cname = if find_raw_fmt(&compression, planes, bitcount, &mut vhdr) { + let cname = if find_raw_fmt(&compression, planes, bitcount, flip, &mut vhdr) { "rawvideo-ms" } else { match register::find_codec_from_avi_fourcc(&compression) { @@ -454,7 +454,7 @@ fn parse_strf_vids(dmx: &mut AVIDemuxer, strmgr: &mut StreamManager, size: usize Ok(size) } -fn find_raw_fmt(compr: &[u8; 4], planes: u16, bitcount: u16, vhdr: &mut NAVideoInfo) -> bool { +fn find_raw_fmt(compr: &[u8; 4], planes: u16, bitcount: u16, flip: bool, vhdr: &mut NAVideoInfo) -> bool { match compr { &[0, 0, 0, 0] | b"DIB " => { if planes != 1 { @@ -469,7 +469,7 @@ fn find_raw_fmt(compr: &[u8; 4], planes: u16, bitcount: u16, vhdr: &mut NAVideoI }; if let Ok(fmt) = NAPixelFormaton::from_str(fmt_name) { vhdr.format = fmt; - vhdr.flipped = true; + vhdr.flipped = !flip; true } else { false -- 2.39.5