aboutsummaryrefslogtreecommitdiff
path: root/common/src/jhls.rs
blob: eadf9a2087070ff62d8979dadbe4dd44efdb4811 (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
/*
    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 crate::SourceTrack;
use serde::{Deserialize, Serialize};
use std::ops::Range;

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct JhlsMetadata {
    pub duration: f64,
    pub extra_profiles: Vec<EncodingProfile>,
    pub tracks: Vec<JhlsTrack>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct JhlsTrack {
    pub info: SourceTrack,
    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,
    },
}