From f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 2 Oct 2023 22:35:53 +0200 Subject: prepare automatic track selection --- web/script/player/profiles.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 web/script/player/profiles.ts (limited to 'web/script/player/profiles.ts') 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, 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) { + // TODO + } +} -- cgit v1.2.3-70-g09d2