aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/lib.rs1
-rw-r--r--common/src/seek_index.rs33
-rw-r--r--remuxer/src/seek_index.rs33
-rw-r--r--web/script/player/track/mse.ts1
4 files changed, 29 insertions, 39 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs
index 00f07b6..4480db5 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -9,7 +9,6 @@ pub mod config;
pub mod helpers;
pub mod r#impl;
pub mod jhls;
-pub mod seek_index;
pub mod stream;
pub mod user;
diff --git a/common/src/seek_index.rs b/common/src/seek_index.rs
deleted file mode 100644
index 20cf394..0000000
--- a/common/src/seek_index.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- This file is part of jellything (https://codeberg.org/metamuffin/jellything)
- which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
- Copyright (C) 2025 metamuffin <metamuffin.org>
-*/
-use bincode::{Decode, Encode};
-
-pub const SEEK_INDEX_VERSION: u32 = 0x5eef1de4;
-
-#[derive(Debug, Clone, Decode, Encode)]
-pub struct SeekIndex {
- pub version: u32,
- pub blocks: Vec<BlockIndex>,
- pub keyframes: Vec<usize>,
-}
-
-#[derive(Debug, Clone, Decode, Encode)]
-pub struct BlockIndex {
- pub pts: u64,
- // pub duration: Option<u64>,
- pub source_off: u64, // points to start of SimpleBlock or BlockGroup (not the Block inside it)
- pub size: usize,
-}
-
-impl Default for SeekIndex {
- fn default() -> Self {
- Self {
- version: SEEK_INDEX_VERSION,
- blocks: Vec::new(),
- keyframes: Vec::new(),
- }
- }
-}
diff --git a/remuxer/src/seek_index.rs b/remuxer/src/seek_index.rs
index bd351d9..7296d93 100644
--- a/remuxer/src/seek_index.rs
+++ b/remuxer/src/seek_index.rs
@@ -4,10 +4,8 @@
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use anyhow::{Context, Result};
-use jellybase::{
- cache::cache_memory,
- common::seek_index::{BlockIndex, SeekIndex},
-};
+use bincode::{Decode, Encode};
+use jellybase::cache::cache_memory;
use jellymatroska::{
block::Block,
read::EbmlReader,
@@ -17,6 +15,33 @@ use jellymatroska::{
use log::{debug, info, trace, warn};
use std::{collections::BTreeMap, fs::File, io::BufReader, path::Path, sync::Arc};
+pub const SEEK_INDEX_VERSION: u32 = 0x5eef1de4;
+
+#[derive(Debug, Clone, Decode, Encode)]
+pub struct SeekIndex {
+ pub version: u32,
+ pub blocks: Vec<BlockIndex>,
+ pub keyframes: Vec<usize>,
+}
+
+#[derive(Debug, Clone, Decode, Encode)]
+pub struct BlockIndex {
+ pub pts: u64,
+ // pub duration: Option<u64>,
+ pub source_off: u64, // points to start of SimpleBlock or BlockGroup (not the Block inside it)
+ pub size: usize,
+}
+
+impl Default for SeekIndex {
+ fn default() -> Self {
+ Self {
+ version: SEEK_INDEX_VERSION,
+ blocks: Vec::new(),
+ keyframes: Vec::new(),
+ }
+ }
+}
+
pub fn get_seek_index(path: &Path) -> anyhow::Result<Arc<BTreeMap<u64, Arc<SeekIndex>>>> {
cache_memory(&["seekindex", path.to_str().unwrap()], move || {
info!("generating seek index for {path:?}");
diff --git a/web/script/player/track/mse.ts b/web/script/player/track/mse.ts
index 6bb77e0..5565a6b 100644
--- a/web/script/player/track/mse.ts
+++ b/web/script/player/track/mse.ts
@@ -156,7 +156,6 @@ export class MSEPlayerTrack extends PlayerTrack {
this.source_buffer.changeType(track_to_content_type(this.active_format.value!.format, this.active_format.value!.container));
// this.source_buffer.timestampOffset = this.active_format.value?.format.remux ? 0 : frag.start
this.source_buffer.timestampOffset = 0
- console.log(`append track at ${this.source_buffer.timestampOffset} ${this.trackinfo.kind} ${this.track_index}`);
this.source_buffer.appendBuffer(frag.buf);
}
}