-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
58 lines (52 loc) · 1.46 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { ProbeResult } from "./js-binding";
import type { Readable } from "stream";
export class OpusEncoder {
public constructor(sampleRate: number, channels: number);
public encode(data: Buffer): Buffer;
public decode(data: Buffer): Buffer;
public setBitrate(bitrate: number): void;
public getBitrate(): number;
public applyEncoderCtl(request: number, value: number): void;
public applyDecoderCtl(request: number, value: number): void;
public get version(): string;
public hasEncoder(): boolean;
public hasDecoder(): boolean;
public static create(sampleRate: number, channels: number): OpusEncoder;
}
export {
CodecType,
MetadataField,
ProbeResult,
getOpusVersion,
probe,
probeSync,
} from "./js-binding";
export type StreamProbeResult = {
stream: Readable;
result: ProbeResult;
};
export interface Metadata {
title: string | null;
author: string | null;
genre: string | null;
album: string | null;
year: string | null;
duration: number | null;
composer: string | null;
bpm: number | null;
}
export interface ProbeStreamOptions {
/**
* If true, mediaplex will probe the stream synchronously. Defaults to false.
*/
sync?: boolean;
/**
* The maximum number of bytes to read from the stream. Defaults to 2MB.
*/
probeSize?: number;
}
export function probeStream(
stream: Readable,
options?: ProbeStreamOptions,
): Promise<StreamProbeResult>;
export function readMetadata(result: ProbeResult): Metadata;