aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/profiles.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-02 22:35:53 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-02 22:35:53 +0200
commitf50a0e48df9ee2ffdfccd013cb4165c7994f8ee4 (patch)
treece647bbda7a0b34aa1448cdf2f53844d3eff2ed4 /web/script/player/profiles.ts
parent7450134996a94c4629f1e112e90ad458a84c0c04 (diff)
downloadjellything-f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4.tar
jellything-f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4.tar.bz2
jellything-f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4.tar.zst
prepare automatic track selection
Diffstat (limited to 'web/script/player/profiles.ts')
-rw-r--r--web/script/player/profiles.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/web/script/player/profiles.ts b/web/script/player/profiles.ts
new file mode 100644
index 0000000..3b3379a
--- /dev/null
+++ b/web/script/player/profiles.ts
@@ -0,0 +1,22 @@
+import { OVar } from "../jshelper/mod.ts";
+import { EncodingProfile, JhlsMetadata } from "./jhls.d.ts";
+
+export interface EncodingProfileExt extends EncodingProfile { id: number }
+export class ProfileSelector {
+ profiles_video: EncodingProfileExt[] = []
+ profiles_audio: EncodingProfileExt[] = []
+ profiles_subtitles: EncodingProfileExt[] = []
+
+ constructor(private bandwidth: OVar<number>, private metadata: JhlsMetadata) {
+ for (let id = 0; id < metadata.extra_profiles.length; id++) {
+ const p = metadata.extra_profiles[id];
+ if (p.audio) this.profiles_audio.push({ id, ...p })
+ if (p.video) this.profiles_video.push({ id, ...p })
+ if (p.subtitles) this.profiles_subtitles.push({ id, ...p })
+ }
+ }
+
+ select_optimal_profile(track: number, profile: OVar<EncodingProfileExt>) {
+ // TODO
+ }
+}