From a344cce770b009e46f5966a1b76eff6ba848f8eb Mon Sep 17 00:00:00 2001 From: ILOVEPIE Date: Sun, 11 Feb 2024 18:32:17 -0800 Subject: [PATCH] Updated Typescript types. --- types/sabre.d.ts | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/types/sabre.d.ts b/types/sabre.d.ts index 5952b30..4197854 100644 --- a/types/sabre.d.ts +++ b/types/sabre.d.ts @@ -1,10 +1,39 @@ type CanvasDrawable = HTMLCanvasElement | OffscreenCanvas; +type SABREOptions = { + fonts?: Array, + subtitles?: string, + colorSpace?:number, + resolution?:number[2], + nativeResolution?:number[2] +} +type ContextType = "2d" | "bitmap"; declare namespace sabre { + namespace VideoColorSpace { + const AUTOMATIC: number; + const AUTOMATIC_PC: number; + const RGB: number; + const BT601_TV: number; + const BT601_PC: number; + const BT709_TV: number; + const BT709_PC: number; + const BT2020_TV: number; + const BT2020_PC: number; + const BT2020_CL_TV: number; + const BT2020_CL_PC: number; + const BT2100_PQ: number; + const BT2100_HLG: number; + const SMPTE240M_TV: number; + const SMPTE240M_PC: number; + const FCC_TV: number; + const FCC_PC: number; + } class SABRERenderer { - constructor(loadFont: (name: string) => void); + constructor(loadFont: (name: string) => void, options: SABREOptions = {}); - loadSubtitles(subsText: string): void; + loadSubtitles(subsText: string, fonts: Array): void; + setColorSpace(colorSpace: number, width?: number, height?: number): void; + setViewport(width: number, height: number): void; checkReadyToRender(): boolean; @@ -13,6 +42,6 @@ declare namespace sabre { getFrameAsUri(time: number, callback: (objUri: string) => void): void; - drawFrame(time: number, canvas: CanvasDrawable, contextType?: string): void; + drawFrame(time: number, canvas: CanvasDrawable, contextType?: ContextType): void; } } \ No newline at end of file