diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-13 20:01:01 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-13 20:01:01 +0100 |
commit | 82eedf3594bf21c8b780580050a95f0bdb5fd667 (patch) | |
tree | 7189b1e46546b963eb44a09920918c76b16e0880 /evc/src/format | |
parent | 4f9ff288cfd66dc33cf66ae9085075f7a242685b (diff) | |
download | video-codec-experiments-82eedf3594bf21c8b780580050a95f0bdb5fd667.tar video-codec-experiments-82eedf3594bf21c8b780580050a95f0bdb5fd667.tar.bz2 video-codec-experiments-82eedf3594bf21c8b780580050a95f0bdb5fd667.tar.zst |
minor changes
Diffstat (limited to 'evc/src/format')
-rw-r--r-- | evc/src/format/header.rs | 8 | ||||
-rw-r--r-- | evc/src/format/ser.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/evc/src/format/header.rs b/evc/src/format/header.rs index 371b4ba..ecbae89 100644 --- a/evc/src/format/header.rs +++ b/evc/src/format/header.rs @@ -1,6 +1,6 @@ use crate::{ - helpers::vector::Vec2, format::ser::{Ser, Sink, Source}, + helpers::vector::Vec2, }; #[derive(Debug, Clone, PartialEq, Copy)] @@ -14,15 +14,15 @@ pub const MAGIC: [u8; 4] = [0x5eu8, 0xb1u8, 0xc3u8, 0x08u8]; impl Ser for Header { fn write(&self, sink: &mut impl std::io::Write) -> anyhow::Result<()> { sink.put(MAGIC)?; - sink.put((self.resolution, self.frame_count))?; + sink.put((Into::<Vec2<u16>>::into(self.resolution), self.frame_count))?; Ok(()) } fn read(source: &mut impl std::io::Read) -> anyhow::Result<Self> { assert_eq!(source.get::<[u8; 4]>()?, MAGIC); - let (resolution, frame_count) = source.get()?; + let (resolution, frame_count): (Vec2<u16>, usize) = source.get()?; Ok(Self { - resolution, + resolution: resolution.into(), frame_count, }) } diff --git a/evc/src/format/ser.rs b/evc/src/format/ser.rs index 995ca75..f063377 100644 --- a/evc/src/format/ser.rs +++ b/evc/src/format/ser.rs @@ -151,7 +151,7 @@ impl Ser for u16 { fn write(&self, sink: &mut impl Write) -> anyhow::Result<()> { Ok(sink .write_all(&unsafe { std::mem::transmute_copy::<_, [u8; 2]>(self) }) - .context("write 16")?) + .context("write u16")?) } fn read(source: &mut impl Read) -> anyhow::Result<Self> { let mut buf = [0u8; 2]; |