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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
pub mod api;
pub mod r#impl;
use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, path::PathBuf};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DirectoryInfo {
pub name: String,
pub banner: Option<PathBuf>,
#[serde(default)]
pub kind: DirectoryKind,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum DirectoryKind {
Folder,
Series,
Show,
Season,
}
impl Default for DirectoryKind {
fn default() -> Self {
Self::Folder
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ItemInfo {
pub title: String,
pub duration: f64, // in seconds
pub description_head: String,
pub description: String,
pub poster: Option<PathBuf>,
pub backdrop: 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,
}
#[derive(Debug, Clone, Decode, Encode)]
pub struct SeekIndex {
pub blocks: Vec<BlockIndex>,
}
#[derive(Debug, Clone, Decode, Encode)]
pub struct BlockIndex {
pub pts: u64,
pub source_off: usize,
pub size: usize,
}
|