aboutsummaryrefslogtreecommitdiff
path: root/common/src/seek_index.rs
blob: 20cf394bd4e7d7d9e304a085734ea005d728da0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
    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(),
        }
    }
}