aboutsummaryrefslogtreecommitdiff
path: root/common/src/lib.rs
blob: 90cbd3e08c5e874e0a25e712dd158bd79f9eb61d (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
42
43
44
45
pub mod r#impl;

use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, path::PathBuf};

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DirectoryInfo {
    pub name: String,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ItemInfo {
    pub title: String,
    pub duration: f64, // in seconds
    pub banner: Option<PathBuf>,
    pub tracks: BTreeMap<usize, SourceTrack>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct SourceTrack {
    pub path: PathBuf,
    pub track_number: u64,
    pub kind: SourceTrackKind,
    pub name: String,
    pub codec: String,
    pub language: String,
    pub default_duration: Option<u64>,
    pub codec_private: Option<Vec<u8>>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum SourceTrackKind {
    Video {
        width: u64,
        height: u64,
        fps: f64,
    },
    Audio {
        channels: usize,
        sample_rate: f64,
        bit_depth: usize,
    },
    Subtitles,
}