aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/profiles.ts
diff options
context:
space:
mode:
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
+ }
+}