]> git.nihav.org Git - nihav.git/commitdiff
avimux: fix palette writing in the video stream header
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 14 Mar 2023 10:32:11 +0000 (11:32 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 14 Mar 2023 10:32:11 +0000 (11:32 +0100)
nihav-commonfmt/src/muxers/avi.rs

index fad358cf2356604b0cdff092185d17647a3e3562..02283e484e3bae82350fb2dfdb4d21e76339f002 100644 (file)
@@ -256,7 +256,12 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> {
                 if let NASideData::Palette(_, ref pal) = sdata {
                     let cur_pos = self.bw.tell();
                     self.bw.seek(SeekFrom::Start(u64::from(self.pal_pos[str_num])))?;
-                    self.bw.write_buf(pal.as_ref())?;
+                    for quad in pal.chunks(4) {
+                        self.bw.write_byte(quad[2])?;
+                        self.bw.write_byte(quad[1])?;
+                        self.bw.write_byte(quad[0])?;
+                        self.bw.write_byte(0)?;
+                    }
                     self.bw.seek(SeekFrom::Start(cur_pos))?;
                     self.pal_pos[str_num] = 0;
                     break;