types.ts
⎇
Raw
1export interface SubtitleTrack {
2 //ordinal among subtitle streams, matching ffmpeg's 0:s:<streamIndex> mapping
3 streamIndex: number;
4 language?: string;
5 title?: string;
6 default: boolean;
7 forced: boolean;
8 codec?: string;
9}
10
11export interface AudioTrack {
12 //ordinal among audio streams, matching ffmpeg's 0:a:<streamIndex> mapping
13 streamIndex: number;
14 language?: string;
15 title?: string;
16 default: boolean;
17}
18
19export interface Chapter {
20 start: number;
21 end?: number;
22 title: string;
23}
24
25export interface VideoExtras {
26 subtitleTracks: SubtitleTrack[];
27 chapters: Chapter[];
28}
29
30export interface Metadata {
31 duration: number;
32 trackNumber?: number;
33 title?: string;
34 artist?: string;
35 album?: string;
36 genre?: string[];
37 audioCodec?: string;
38 audioBitrate?: number;
39 videoCodec?: string;
40 videoBitrate?: number;
41 videoWidth?: number;
42 videoHeight?: number;
43 frameRate?: number;
44 interlaced?: boolean;
45 container?: string;
46 audioTracks?: AudioTrack[];
47 subtitleTracks?: SubtitleTrack[];
48}
49
50export interface IsVideoResponse {
51 isVideo: boolean;
52}
53
54export interface MediaFile {
55 metadata: Metadata;
56}
57
58export interface Directory {
59 files: FileListing;
60}
61
62//Scanned = we know which children exist
63//Unknown = either:
64// - not scanned (is a subdirectory and recursive=false)
65// - only partially exists, because some deeper file was scanned, and this entry only exists as a link
66export interface DirectoryWithStatus {
67 files: FileListingWithStatus;
68 status: "Scanned" | "Unknown";
69}
70
71export type FileListing = Record<string, Directory | MediaFile>;
72export type FileListingWithStatus = Record<string, DirectoryWithStatus | MediaFile>;
73
74export enum MediaContainer {
75 mp4 = "mp4",
76 webm = "webm",
77 mp3 = "mp3",
78 ogg = "ogg",
79}
80
81export enum VideoCodec {
82 none = "none",
83 av1 = "av1",
84 h264 = "h264",
85 h265 = "h265",
86 vp9 = "vp9",
87}
88
89export enum AudioCodec {
90 opus = "opus",
91 aac = "aac",
92 vorbis = "vorbis",
93 mp3 = "mp3",
94 flac = "flac",
95}
96
97export enum VideoEncodingSetting {
98 veryfast = "veryfast",
99 fast = "fast",
100 balanced = "balanced",
101 quality = "quality",
102}
103