aboutsummaryrefslogtreecommitdiff
path: root/common/src/jhls.rs
blob: 12fa2d6d787185c7d6713da6846efef7a6d855db (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
34
35
36
37
38
39
40
41
use bincode::{Decode, Encode};
/*
    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) 2024 metamuffin <metamuffin.org>
*/
use serde::{Deserialize, Serialize};
use std::ops::Range;

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct JhlsTrackIndex {
    pub extra_profiles: Vec<EncodingProfile>,
    pub segments: Vec<Range<f64>>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum EncodingProfile {
    Video {
        codec: String,
        preset: Option<u8>,
        bitrate: usize,
        width: Option<usize>,
    },
    Audio {
        codec: String,
        bitrate: usize,
        channels: Option<usize>,
        sample_rate: Option<f64>,
    },
    Subtitles {
        codec: String,
    },
}

#[derive(Debug, Serialize, Deserialize, Encode, Decode)]
pub struct SubtitleCue {
    pub start: f64,
    pub end: f64,
    pub content: String,
}