aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-09-30 18:15:16 +0200
committermetamuffin <metamuffin@disroot.org>2023-09-30 18:15:16 +0200
commitb15fb338de55df177948a7fdf9704efa4374816b (patch)
tree11272ac46e775ce9eb303e9a0d4ebdf6571c9555 /common
parent09c7eb30a583ebec6c25b8aa539512e4ae26e5e5 (diff)
downloadjellything-b15fb338de55df177948a7fdf9704efa4374816b.tar
jellything-b15fb338de55df177948a7fdf9704efa4374816b.tar.bz2
jellything-b15fb338de55df177948a7fdf9704efa4374816b.tar.zst
refactor common crate
Diffstat (limited to 'common')
-rw-r--r--common/src/lib.rs28
-rw-r--r--common/src/seek_index.rs32
2 files changed, 33 insertions, 27 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs
index d57d2c0..ec6e0df 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -7,8 +7,8 @@ pub mod config;
pub mod helpers;
pub mod r#impl;
pub mod stream;
+pub mod seek_index;
-use bincode::{Decode, Encode};
#[cfg(feature = "rocket")]
use rocket::{FromFormField, UriDisplayQuery};
use serde::{Deserialize, Serialize};
@@ -139,29 +139,3 @@ pub enum SourceTrackKind {
},
Subtitles,
}
-
-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 source_off: usize,
- pub size: usize,
-}
-
-impl Default for SeekIndex {
- fn default() -> Self {
- Self {
- version: SEEK_INDEX_VERSION,
- blocks: Vec::new(),
- keyframes: Vec::new(),
- }
- }
-}
diff --git a/common/src/seek_index.rs b/common/src/seek_index.rs
new file mode 100644
index 0000000..98afcca
--- /dev/null
+++ b/common/src/seek_index.rs
@@ -0,0 +1,32 @@
+/*
+ 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) 2023 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 source_off: usize,
+ pub size: usize,
+}
+
+impl Default for SeekIndex {
+ fn default() -> Self {
+ Self {
+ version: SEEK_INDEX_VERSION,
+ blocks: Vec::new(),
+ keyframes: Vec::new(),
+ }
+ }
+}