X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-commonfmt%2Fsrc%2Fmuxers%2Favi.rs;h=2c541188be6a653315fb3c50cf60a7bd7c54fb0f;hb=0a0456a8355d0bd06c8f8612bfd3326868a6b25f;hp=296b778937b78db0e27be25830e3b330fad8af2b;hpb=68e5a4ca64f5f0a08e9a46048f03e47b68d4c21f;p=nihav.git diff --git a/nihav-commonfmt/src/muxers/avi.rs b/nihav-commonfmt/src/muxers/avi.rs index 296b778..2c54118 100644 --- a/nihav-commonfmt/src/muxers/avi.rs +++ b/nihav-commonfmt/src/muxers/avi.rs @@ -15,7 +15,7 @@ struct AVIStream { strh_pos: u64, nframes: u32, is_video: bool, - max_size: u32, + max_size: u32, } struct AVIMuxer<'a> { @@ -61,6 +61,8 @@ fn write_chunk_hdr(bw: &mut ByteWriter, stype: StreamType, str_no: u32) -> Muxer } impl<'a> MuxCore<'a> for AVIMuxer<'a> { + #[allow(clippy::unreadable_literal)] + #[allow(clippy::cast_lossless)] fn create(&mut self, strmgr: &StreamManager) -> MuxerResult<()> { if strmgr.get_num_streams() == 0 { return Err(MuxerError::InvalidArgument); @@ -184,6 +186,7 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { // unimplemented!(); self.bw.write_u32le(0)?; // total colors self.bw.write_u32le(0)?; // important colors +println!("pal?"); } else { self.bw.write_u32le(0)?; // total colors self.bw.write_u32le(0)?; // important colors @@ -253,6 +256,9 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { write_chunk_hdr(&mut self.bw, str.get_media_type(), str_num as u32)?; self.bw.write_u32le(chunk_len)?; self.bw.write_buf(pkt.get_buffer().as_slice())?; + if (self.bw.tell() & 1) != 0 { + self.bw.write_byte(0)?; + } Ok(()) } fn flush(&mut self) -> MuxerResult<()> { @@ -260,7 +266,7 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { } fn end(&mut self) -> MuxerResult<()> { patch_size(&mut self.bw, self.data_pos)?; - if self.index.len() > 0 { + if !self.index.is_empty() { self.bw.write_buf(b"idx1")?; self.bw.write_u32le((self.index.len() * 16) as u32)?; for item in self.index.iter() {