From: Kostya Shishkov Date: Fri, 6 Mar 2026 16:34:31 +0000 (+0100) Subject: avi: take palette from bitmapinfo extradata if it happens to be there X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=368d7e889ec333937bca3170e098ad07749204c4;p=nihav.git avi: take palette from bitmapinfo extradata if it happens to be there --- diff --git a/nihav-commonfmt/src/demuxers/avi.rs b/nihav-commonfmt/src/demuxers/avi.rs index 3c6a5cc..957b551 100644 --- a/nihav-commonfmt/src/demuxers/avi.rs +++ b/nihav-commonfmt/src/demuxers/avi.rs @@ -147,6 +147,17 @@ impl AVIStream { self.pal = Some(PalInfo { pal: Arc::new(pal), changed: true }); } } + } else if header.colors > 0 { + if let Some(ref buf) = header.extradata { + let mut pal = [0u8; 1024]; + for (dpal, spal) in pal.chunks_mut(4).take(header.colors).zip(buf.chunks(4)) { + dpal[0] = spal[2]; + dpal[1] = spal[1]; + dpal[2] = spal[0]; + dpal[3] = 0; + } + self.pal = Some(PalInfo { pal: Arc::new(pal), changed: true }); + } } if is_mvi { if let Some(ref mut dta) = edata {