diff options
author | metamuffin <metamuffin@disroot.org> | 2023-05-16 10:53:39 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-05-16 10:53:39 +0200 |
commit | 542107bae31efeefe0e8072bfb05eef12171ce52 (patch) | |
tree | 3c6afc6454dd584c997762abeed6f864fd3c9bb1 | |
parent | d015e8245291247ba5907fa90720d027fde0cd07 (diff) | |
download | jellything-542107bae31efeefe0e8072bfb05eef12171ce52.tar jellything-542107bae31efeefe0e8072bfb05eef12171ce52.tar.bz2 jellything-542107bae31efeefe0e8072bfb05eef12171ce52.tar.zst |
first correct output by hardcoding offsets
-rw-r--r-- | matroska/src/block.rs | 2 | ||||
-rw-r--r-- | remuxer/src/lib.rs | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/matroska/src/block.rs b/matroska/src/block.rs index c887a91..676b042 100644 --- a/matroska/src/block.rs +++ b/matroska/src/block.rs @@ -59,7 +59,7 @@ impl Block { match self.discardable { true => 0b1, false => 0b0, - } | match self.invisible { + } | match self.keyframe { true => 0b10000000, false => 0b00000000, } | match self.invisible { diff --git a/remuxer/src/lib.rs b/remuxer/src/lib.rs index c0a4c69..34991e2 100644 --- a/remuxer/src/lib.rs +++ b/remuxer/src/lib.rs @@ -114,6 +114,7 @@ impl RemuxerContext { ])))?; output.write_tag(&MatroskaTag::Segment(Master::Start))?; + let segment_offset = output.position(); output.write_tag(&MatroskaTag::Info(Master::Collected(vec![ MatroskaTag::TimestampScale(1_000_000), @@ -172,7 +173,7 @@ impl RemuxerContext { + vint_length(cluster_content_size as u64) // size varint + cluster_content_size; clusters.push(ClusterLayout { - position: gp, + position: gp + 7860, // TODO this needs calculation timestamp: cluster_pts, source_offsets, blocks: std::mem::take(&mut cluster), @@ -225,10 +226,11 @@ impl RemuxerContext { .collect(), )))?; - let segment_start_position = output.position(); + let first_cluster_offset = output.position(); + eprintln!("{}", first_cluster_offset - segment_offset); let mut skip = 0; for (i, cluster) in segment_layout.iter().enumerate() { - if (cluster.position + segment_start_position) > range.start { + if (cluster.position + first_cluster_offset) > range.start { break; } skip = i; @@ -278,7 +280,7 @@ impl RemuxerContext { ); { let cue_error = - cluster.position as i64 - (output.position() - segment_start_position) as i64; + cluster.position as i64 - (output.position() - segment_offset) as i64; if cue_error != 0 { warn!("calculation was {} bytes off", cue_error); } |