diff options
author | metamuffin <metamuffin@disroot.org> | 2023-01-17 18:31:41 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-01-17 18:31:41 +0100 |
commit | 843f9e65f009e5fc5f712b4bee5902ec3676d334 (patch) | |
tree | d8e53188e79a709348d69303db89032c339ae9e0 /matroska/src/block.rs | |
parent | e65619de86080d72bf81ba72311dce5325976478 (diff) | |
download | jellything-843f9e65f009e5fc5f712b4bee5902ec3676d334.tar jellything-843f9e65f009e5fc5f712b4bee5902ec3676d334.tar.bz2 jellything-843f9e65f009e5fc5f712b4bee5902ec3676d334.tar.zst |
non-seekable mkv almost works
Diffstat (limited to 'matroska/src/block.rs')
-rw-r--r-- | matroska/src/block.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/matroska/src/block.rs b/matroska/src/block.rs index b0d6f6b..dd5b340 100644 --- a/matroska/src/block.rs +++ b/matroska/src/block.rs @@ -1,4 +1,4 @@ -use crate::read::ReadExt; +use crate::{read::ReadExt, write::write_vint}; use anyhow::Result; use std::io::Cursor; @@ -40,4 +40,21 @@ impl Block { timestamp_off, }) } + pub fn dump(&self) -> Vec<u8> { + let mut out = vec![]; + write_vint(&mut out, self.track).unwrap(); + out.extend(self.timestamp_off.to_be_bytes().into_iter()); + out.push( + match self.invisible { + true => 0b10000, + false => 0b00000, + } | match self.lacing { + Some(LacingType::Xiph) => 0b0100, + Some(LacingType::Ebml) => 0b1000, + Some(LacingType::FixedSize) => 0b1100, + None => 0b0000, + }, + ); + out + } } |