diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-05 21:22:00 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-05 21:22:00 +0100 |
commit | 8e4ec0943973b96addbe01f4c02f91cf04d081a7 (patch) | |
tree | 0773eb5048703adae45538050ab3dffad29b01da /evc/src/header.rs | |
parent | 96e316ea16b7b915e02735457d5ac7495d3db305 (diff) | |
download | video-codec-experiments-8e4ec0943973b96addbe01f4c02f91cf04d081a7.tar video-codec-experiments-8e4ec0943973b96addbe01f4c02f91cf04d081a7.tar.bz2 video-codec-experiments-8e4ec0943973b96addbe01f4c02f91cf04d081a7.tar.zst |
more code
Diffstat (limited to 'evc/src/header.rs')
-rw-r--r-- | evc/src/header.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/evc/src/header.rs b/evc/src/header.rs index 2b2725c..e5f008d 100644 --- a/evc/src/header.rs +++ b/evc/src/header.rs @@ -1,4 +1,23 @@ +use crate::ser::{Ser, Sink, Source}; +#[derive(Debug, Clone)] pub struct Header { - + pub resolution: (usize, usize), + pub frame_count: usize, +} + +impl Ser for Header { + fn write(&self, sink: &mut impl std::io::Write) -> std::io::Result<()> { + sink.put([0x5eu8, 0xb1u8, 0xc3u8, 0x08u8])?; + sink.put((self.resolution, self.frame_count))?; + Ok(()) + } + + fn read(source: &mut impl std::io::Read) -> std::io::Result<Self> { + source.get::<[u8; 4]>()?; + Ok(Self { + resolution: source.get()?, + frame_count: source.get()?, + }) + } } |