From 7769ca01cbfffd4c12d5e77953bb851bf0dfac91 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 23 Oct 2020 12:11:13 +0200 Subject: [PATCH] avi: 8-bit audio is unsigned --- nihav-commonfmt/src/demuxers/avi.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nihav-commonfmt/src/demuxers/avi.rs b/nihav-commonfmt/src/demuxers/avi.rs index eb927e7..d99bfc9 100644 --- a/nihav-commonfmt/src/demuxers/avi.rs +++ b/nihav-commonfmt/src/demuxers/avi.rs @@ -456,7 +456,8 @@ fn parse_strf_auds(dmx: &mut AVIDemuxer, strmgr: &mut StreamManager, size: usize let block_align = dmx.src.read_u16le()?; let bits_per_sample = dmx.src.read_u16le()?; - let soniton = NASoniton::new(bits_per_sample as u8, SONITON_FLAG_SIGNED); + let signed = bits_per_sample > 8; + let soniton = NASoniton::new(bits_per_sample as u8, if signed { SONITON_FLAG_SIGNED } else { 0 }); let ahdr = NAAudioInfo::new(samplespersec, channels as u8, soniton, block_align as usize); let edata = if size > 16 { let edata_size = dmx.src.read_u16le()? as usize; -- 2.39.5