Skip to content

Commit

Permalink
Updated Typescript types.
Browse files Browse the repository at this point in the history
  • Loading branch information
ILOVEPIE committed Feb 12, 2024
1 parent 8ed21c6 commit 9788606
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions types/sabre.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
type CanvasDrawable = HTMLCanvasElement | OffscreenCanvas;
type SABREOptions = {
fonts?: Array<Font>,
subtitles?: string,
colorSpace?:number,
resolution?:number[],
nativeResolution?:number[]
}
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<Font>): void;

setColorSpace(colorSpace: number, width?: number, height?: number): void;

setViewport(width: number, height: number): void;

checkReadyToRender(): boolean;
Expand All @@ -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;
}
}

0 comments on commit 9788606

Please sign in to comment.