From 843f9e65f009e5fc5f712b4bee5902ec3676d334 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 17 Jan 2023 18:31:41 +0100 Subject: non-seekable mkv almost works --- matroska/src/block.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'matroska/src') 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 { + 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 + } } -- cgit v1.2.3-70-g09d2