From c905da8d6d7d7f3069f97bf264b32e4366ea964a Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 8 Feb 2023 17:36:49 +0100 Subject: [PATCH] avimux: fix written information for paletted format --- nihav-commonfmt/src/muxers/avi.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nihav-commonfmt/src/muxers/avi.rs b/nihav-commonfmt/src/muxers/avi.rs index 5e98ed9..0977aac 100644 --- a/nihav-commonfmt/src/muxers/avi.rs +++ b/nihav-commonfmt/src/muxers/avi.rs @@ -172,8 +172,13 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { self.bw.write_u32le(0)?; self.bw.write_u32le(vinfo.width as u32)?; self.bw.write_u32le(vinfo.height as u32)?; - self.bw.write_u16le(vinfo.format.components as u16)?; - self.bw.write_u16le(vinfo.format.get_total_depth() as u16)?; + if !vinfo.format.palette { + self.bw.write_u16le(vinfo.format.components as u16)?; + self.bw.write_u16le(vinfo.format.get_total_depth() as u16)?; + } else { + self.bw.write_u16le(1)?; + self.bw.write_u16le(8)?; + } let fcc = find_avi_fourcc(str.get_info().get_name()); if fcc.is_none() { return Err(MuxerError::UnsupportedFormat); -- 2.39.5