]> git.nihav.org Git - nihav.git/commitdiff
avimux: fix written information for paletted format
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 8 Feb 2023 16:36:49 +0000 (17:36 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 8 Feb 2023 16:36:49 +0000 (17:36 +0100)
nihav-commonfmt/src/muxers/avi.rs

index 5e98ed998e3673e109e2aabd97199083fabaf7c7..0977aac61e1127d4a7af33a98e1b1bdaf3f7ab36 100644 (file)
@@ -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);